Monday, July 27, 2015

What happened to Wakelock detector ?


Hello everyone,

I am one of the responsible developers of Wakelock detector (WLD)[1]
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.

Links:
Wakelock Detector Google Play link
 - https://play.google.com/store/apps/details?id=com.uzumapps.wakelockdetector
Presentation about Wakelock
 - http://goo.gl/7WgGz
XDA forum for technical discussions:
http://forum.xda-developers.com/showthread.php?t=2179651
How to use Wakelock detector
http://www.slideshare.net/ahikmat1/manual-for-wakelock-detector

38 comments:

  1. hi boss
    how to unintall this software?
    i gave root permission and now i can't uninstall it.
    please help

    ReplyDelete
    Replies
    1. I uninstalled the app from Titanium backup and then booted in Recovery>Wiped Dalvik Cache & Cache>Rebooted to system...It worked for me.

      Delete
    2. there is an option to revoke from system app in the latest version.
      sorry for late reply.

      Delete
    3. Titanium backup hung on restoring WD (system app). I then uninstall/install from play store but it wasn't working and can't be uninstalled. I finally follow Yogesh steps to remove the bad installation.

      Delete
  2. i think because of it i can't install Google play and other google services.

    ReplyDelete
  3. can you please help me to uninstall it
    thanks

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hey guys,

    is it available for android 6? I can install it from Play store but no app is listed in WLD.

    Thanks for helping

    ReplyDelete
  6. Since it doesn't work on Marshmallow, how would I uninstall the system app? Similar apps have an "uninstall" option.

    ReplyDelete
    Replies
    1. Yes it works on Android 6.0.

      I uninstalled the app from Titanium backup and then booted in Recovery>Wiped Dalvik Cache & Cache>Reeboted to system...It worked for me.

      When you reinstall the app, do not install it as system app.

      Delete
  7. I'm glad to be reading this article, I simply want to offer you a huge thumbs up for your great information.
    Tableau Guru
    http://www.sqiar.com

    ReplyDelete
  8. I installed the app but it's not working. I don't want to root my phone so how can it work without that??

    ReplyDelete
    Replies
    1. Hi,
      we developed a workaround,
      follow this tutorial
      http://goo.gl/Yqdh2F

      Delete
  9. Good question Rebecca ..im the same I don't want to root on my phone how do I / we work around it ?

    ReplyDelete
    Replies
    1. Hi,
      we developed a workaround,
      follow this tutorial:
      http://goo.gl/Yqdh2F
      a bit geeky, but you might have a fun doing it.

      Delete
  10. Hi, how is it supposed to run in Android 6.0?. I have root, and after install as system app and reboot, when I open the application I always get an error that say It can not run in this moment....
    thanks

    ReplyDelete
    Replies
    1. please send us more details to our email at uzumapps@gmail.com
      your phone model and app version etc.
      thank you

      Delete
  11. wonderful post. keep it up thanks for sharing such a nice Apps and post. keep it up

    ReplyDelete
  12. I'm new to rooting but I would like to learn. So please no rude comments as this question may seem stupid to some. Has anyone found a successful root for the straight talk core prime sm-s820l? If so could someone point me in the right direction. I've heard rooting a cdma device is impossible but also I've heard it can be done. Id like to root in order to run apps like this on my device at all times.

    ReplyDelete
  13. Hi,
    you can try non root version,
    we developed a workaround,
    follow this tutorial:
    http://goo.gl/Yqdh2F
    a bit geeky, but you might have a fun doing it.

    ReplyDelete
  14. In Android Marshmallow, the system adb is removed. the workaround is not possible.

    But, for some android phones (like Galaxy S6), we can use PC's adb to grant permissions without ROOT.
    It works like: adb -d shell pm grant com.uzumapps.wakelockdetector android.permission.BATTERY_STATS

    Successfully executed, but WLD still tells me to install as system app. Could this be a bug in WLD?

    ReplyDelete
    Replies
    1. yes, you are right,
      it is possible to run WLD after granting permission.
      but it seems this workaround does not work in all devices.

      we will support this Workaround too!
      it needs some little work.
      Thank you for your mentioning this workaround.

      Delete
    2. Does the chrome tool perform the same thing as this from the pc?
      adb -d shell pm grant com.uzumapps.wakelockdetector android.permission.BATTERY_STATS

      The chrome tool description should explain exactly what it's going to do and offer a manual method (using adb on the pc). This will make the tool look less suspicious.

      Delete
  15. My phone keeps on lagging so I need your help

    ReplyDelete
  16. Hi what does it mean to root it on your phone

    ReplyDelete
  17. Hi what does it mean to root it on your phone

    ReplyDelete
  18. Does this work on Android 7? I got it to add battery_stats on Android 6, but no luck with Android 7? How about how to do it for Android 7 using adb? I have used adb to add permissions to other packages...Thanks!

    ReplyDelete
  19. Does this work on Android 7? I got it to add battery_stats on Android 6, but no luck with Android 7? How about how to do it for Android 7 using adb? I have used adb to add permissions to other packages...Thanks!

    ReplyDelete
  20. By using this app will it wipe my personal data from device?

    ReplyDelete
    Replies
    1. no, it only shows advanced battery stats which cannot be seen in default android

      Delete
  21. CA fonctionne vraiment mais il faut bien l'installert

    ReplyDelete
  22. Phone: OnePlus One - ROM: TugaPowerROM N21.0 (LineageOS, based on Android 7.1.1, rooted with MagiskSU). When I try to install app as system it gave me: "An error occurred mounting system rw. Aborted". Any suggestion?

    ReplyDelete
    Replies
    1. I've been getting the same error on a Nexus 6p stock rooted with Magisk.

      Delete