Tag Archives: Powersave

Yesterday, When I was ready to develop OPG Pro with i9100, Battery life is full, but suddenly found this phone was turned off. I wonder what happened? Let us see this classic battery case.

1. First, Check Battery option in system settings, the red square shows battery life instantly dropped down, Both Youku and cell standby consume 96% of battery life. However, it is difficult to see from them, and may be it made a mistake to misdiagnose as cell standby

2. Secondly, let us into OPG Pro of Battery Doctor, From the chart, It is more intuitive to show battery life instantly dropped down, Such as the electrocardiogram

3. Let’s look at the reasons of power consumption, what events happened? from 60% to 31%, there are two important events, a wakelock and screen wakeup, this wakelock wake up system so that Android system can not sleep. +screen mean that screen awaked and turned on suddenly.

4. Then, Find out which applications have wakelock permissions? the figure only two applications.

5. Switch statistics to the last charge or statistics to the last unplugged, kernel wakelocks or Partial wakelocks, To find out the main wakelock. the longest realtime of “mywakelock” is 21 hours 48 minutes, it is the reason.

6. Although it is known mywakelock led to drain, let us return to the first pic, the power consumption of Youku reached 6%, Is Youku creates mywakelock? At this point, Decompile Youku apk to see this wakelock.

Now we provide a new service for you. We are working hard to develop Cloud Battery Stats. it predicts power consumption of each device and app by big data. big data means more people use OPG or OPG Pro and it is more accurate.

In one command prompt you can watch the entropy_avail with this one liner:

while :; do cat /proc/sys/kernel/random/entropy_avail; sleep 1;done

In a second command prompt you can do the sysctl thing…

we can find that write_wakeup_threshold doesn’t effect entropy_avail at all.

But read_wakeup_threshold is a totally different

Try:

busybox sysctl -w kernel.random.read_wakeup_threshold=2048

The entropy_avail just started climbing….

All the way up to 3600+ and just stayed there. Never went down at all.
Actually, the more I did stuff with the phone, the faster the level would climb.

we played with different values.
Setting it to 1000… entropy would go up to 3000 and then drop to 2000 and up to 3000 again….
Setting to 750…. entropy would go up to 2250 and drop to 1500 and up to 2250 again…

Android 4.4_r1 removed the possibility for apps to request for the BATTERY_INFO permission, This is the commit https://android.googlesource.com/pla…f8db87b%5E%21/
The reason (issue mentioned) for the commit is unknown.
This permission and the access to batterystats – formerly known as batteryinfo – service is vital for use cases (and apps) dealing with analysing awake and wakeup causes (battery drainers) as this services gives access to partial wakelocks and alarms.

I would like to request a rollback of the mentioned commit. See issue 61975