Battery saving experiments for Wear OS


Wear OS has been highly ignored by Google and manufacturers alike. No feature additions, no better watches (Hopefully Google does release one)
My biggest concern along with lot of others who enjoy using Android Wears has been the battery life. I conducted a set of experiments on my Huawei Watch 2 in an attempt to get some more juice out my watch.

Some of the well-known ideas that exist out today are: not using Ambient mode or tilt on wake. Meh, it might be better to not use the watch and save battery.

Save screen battery drain

I ran a set of tests under the hypothesis that a Dim screen would save battery.
Screen kills battery. Turning off ambient mode and battery shoots up. What if we could reduce battery drain by reducing the brightness further than the possible brightness? It of course makes sense since most of my time is spent indoors where even the lowest brightness is too bright.

You might have come across the TruDark app(which somehow doesn’t exist anywhere anymore) and that does the exactly this.

So I added a simple software screen filter which runs and makes the screen dimmer. Why should it save battery? Simply because lesser intensity of pixels would lead to lower battery usage.

Setup details

Aim was to try and reduce variables other than battery lost due to the screen. Some variables such as Wifi and Bluetooth power usage can possibly be missed from this experiment. Following are my settings for my experiment:

    • Always on display enabled
    • Tilt to Wake disabled
    • Do not disturb mode to avoid battery drainage due to Vibrations or screen wake
READ ALSO  Twitter responds to Kamala Harris' call to suspend Trump's account

Results

Bummer! It didn’t work

Here are the results of experiments:
Battery drop with a screen dimmer: 3.67% battery loss per hour

Without a screen dimmer: Just 2.75% battery loss an hour

What’s next?

  • Possible reason for battery drain to increase: Battery drain caused due to a service running in background causes a lot more battery drain than caused by the screen in the ambient mode.
    There can possibly be other ways to implement the screen dimmer or other ways in which we can do it efficiently. Let me know if you have any suggestions!
  • Possible solution going ahead: Create and test with a new watch face. A watch face is redrawn only once a minute in ambient mode so any losses due to the above reason should go away.
    If this is successful, then it would be the way to go ahead for watch face developers.
    Note: This is something already part of Bubble Watch faces, would love to know if it helped anyone save battery.

Technical details if you are interested

We create a service which runs forever and draws on top of any screen.
We use need to provide overlay permission so that we can draw on top of other apps:


Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                           Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, 0);

On receiving the result from the intent, we start our service


startService(new Intent(this, WearDimmerService.class));

In order to run forever, we create a STICKY service.


public int onStartCommand(Intent intent, int flags, int startId) {
    return START_STICKY;
}

In the onCreate command, we create a layout manager which draws on top of our existing display with dimming added.


WindowManager windowManager_tmp = (WindowManager)getApplicationContext()
                                      .getSystemService(Context.WINDOW_SERVICE);
layoutParams = new WindowManager.LayoutParams();
windowManager = (WindowManager)getApplication().getSystemService(Context.WINDOW_SERVICE);
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
layoutParams.width = windowManager_tmp.getDefaultDisplay().getWidth();
layoutParams.height = windowManager_tmp.getDefaultDisplay().getHeight();
layoutParams.format = PixelFormat.TRANSLUCENT;
layoutParams.dimAmount = 0.5f;
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                     | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                     | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                     | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                     | WindowManager.LayoutParams.FLAG_FULLSCREEN
                     | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
                     | WindowManager.LayoutParams.FLAG_DIM_BEHIND;
final LayoutInflater layoutInflater = LayoutInflater.from(getApplication());
linearLayout = (LinearLayout) layoutInflater.inflate(R.layout.dim, null);
windowManager.addView(linearLayout, layoutParams);

TLDR: I tried creating a screen dimmer attempting to save battery on my Huawei Watch 2 Wear OS smartwatch. No success here, It ended up eating more battery than without it. Guess will have to continue to charge it every day.



Source link

?
WP Twitter Auto Publish Powered By : XYZScripts.com