Stefan and some users pointed the issue of power consumption to our app RECENT. After works in a few days, we fixed this problem. Please check the image below, the latest version of Recent in Google Play has minimum power consumption.
Here we share our works to reduce power consumption.
First, we take Wakelock Detector (Many thanks to suggestion from Stefan) to identify why this problem occur. Over crank repeats and CPU time are the first matters we found out. After tests with mask to Timer, we confirm the large power consumption is caused by Timer.
After code review, we find out why our app RECENT call Timer in higher frequency: to obtain the parameter “number of use” and “last time of use” of each installed app on device, showed as picture below:
The first optimization plan we take is to optimize codes after the app enables the Timer, since we still hope to show all users the information of “number of use” and “last time of use”. So, after optimization, we reduce 80% CUP time.
BUT we believe our RECENT should take much smaller power consumption that comes from consideration of saving power to smart phones. After review to usage scenarios, we think providing information of “number of use” and “last time of use” cannot help users much more.
So we have our second optimization plan: completely remove Timer.
Frankly speaking, the result with second optimization plan is really satisfied. The power consumption of RECENT could be ignored on real machine.
Utilities for tests: Wakelock Detector, DU Battery Saver
Test Machine: Google Nexus 7
Many thanks to the supports from Stefan, Leon Kehoe, Jamie, Michael B.N..
THANK YOU your guys helped us to the work of optimizing power consumption.
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?