Monday, July 27, 2015
What happened to Wakelock detector ?
I am one of the responsible developers of Wakelock detector (WLD)
Here I am going to share and discuss what had been going on with Wakelock detector in recent years.
First of all, I apologize for language mistakes written in English. I will try to fix mistakes later on when I will have more free time.
As a brief history of our app called "Wakelock detector" , the idea came up from our friend who had problem with his phone screen being randomly turn on by mysterious apps. So, we decided to detect which app was causing the phone wake up. Later, we stumbled on "BetterBatteryStats"(BBS) which was open-source and it could help to detect partial wake locks. Partial wake lock (also we call it CPU wake lock) is a feature used by Android developers to hold the system awake while screen is off. It would be better if the reader of this blog understands Android wakelocks well. Check this presentation for a knowledge. There are many sources on internet. Anyways, BBS did not have screen wakelocks, and it was more advanced which made it more difficult to understand for many users. So, we decided to simplify the wake lock statistics and concentrate only on wakelocks. We learnt a lot from BBS source code and we were very grateful for that. Their approach was accessing battery statistics (including wake lock stats) via java reflection. It was excellent way to go as it required single "Battery_stats" permission from users.
Everything was going well, the overall rating of WLD in GooglePlay was as high as 4.8 at that time.
But, something unexpected happened in KitKat. Google after they realized that developers could gain app usage information(which leads to some privacy issues) by using non-public API (reflection) they closed the hole. They opened the battery stats access only to system apps. Default battery statistics app of Android is a system app, so it works without problem.
At first, there was no solution for this problem. BBS and GSam came up with the idea to install the app as a system app (by copying to /system/app folder)
We wanted to fix with other solution. Android has a "dumpsys" command, which dumps statistics and the output can be parsed. So, we used "dumpsys batterystats" and parsed output and displayed wake lock statistics. But it still required ROOT access. The good thing about this method was it could run on non-rooted Kitkat devices with a workaround.
The workaround is easy for the people who know what is adb , however, for ordinary users it might be very difficult to accomplish at first time. That is why, we made PC version of Wakelock detector for Windows OS users.
Recently, the Google Play rating of WLD plunged down to 4.2, the reason for that was the users thought that WLD should work without ROOT and some Rooted users who had inappropriate version of SuperSU was causing problems. Above all, mismanagement was major reason of rating plunge.
Finally, we released 1.8.0 version of WLD, we added a new feature "Install as system app"
This feature requires ROOT, and it copies the apk file of WLD into /system/priv-app folder.
This can be done with other apps too, you can find many helper apps by searching "Install as system app" in GooglePlay. After installing as system app, the phone needs to rebooted!
Then you can revoke ROOT access, as Root is no more required. It can work fine as it worked pre Kit-Kat OS.
As a conclusion, It is hard to say that Google will open wake lock statistics with public API, and workaround for non rooted users is hard to simplify for ordinary users (although we are looking for different angles to simplify the process) The solution is to Root device, which is not well recommended by manufactures. But achieving excellent battery life takes some courage and effort.
Wakelock Detector Google Play link
Presentation about Wakelock
XDA forum for technical discussions:
How to use Wakelock detector