Root cause for Gear 2 high battery consumption found, at least for non-Samsung phones

Search This thread

mpogr

Senior Member
Jan 16, 2008
185
63
Melbourne
Edit: with new Gear Manager (Jun release), this method doesn't work anymore. The new approach is to install a "contact synchroniser killer" app on the rooted watch. More details are in this post.

==================================================================================================================================================================================

Hi all,

Ever since I started using my Gear 2 Neo with my HTC One M8 phone (using the guide in this forum), I noticed that my watch consumes battery significantly faster than most of the users have been reporting. Even more strangely, sometimes after resetting both the phone and the watch (and I've done this a lot while experimenting and trying to get more stuff working) I had streaks of stellar battery life, well in line with optimistic reports here and elsewhere, but then, after a while, it started deteriorating very quickly.

So I decided it was time to do something about it. I installed Tizen SDK, hooked the watch up and started poking around. The first thing I noticed my watch CPU was, most of the time, sitting on 40%! Well, that doesn't sound right, does it? Then I noticed the log (located under /var/log/dlog_main) was full with messages related to contact synchronisation. It turns out the damn thing synchronises all of my contacts every several seconds. The trouble is I have well over 1500 contacts (that's consolidated from different sources, the number of raw contacts should be well over 3000). So it takes significant time to do this, meaning my watch (and the phone!) are thrashed by these stupid full contact syncs all the time! What's even more striking is the fact it doesn't help when I change it to "favourites only". Apparently, this affects only the contacts displayed on the watch, however, the sync process still takes all of them.

At this point I started poking around Samsung APK files to try and understand what was going on. Apparently, the APK responsible for contact sync is called GOPROVIDERS. Indeed, if you kill it, the thrashing stops, however, other important functions cease working as well. Aside of Contacts vanishing from the Gear, "Find my phone" is gone as well, but, more importantly, notifications stop working. While I could tolerate the first two, the last one was too much to give up.

I started decompiling and analysing sources. Apparently, there is a process running every several seconds that analyses if any changes have been made to the contacts. It uses pretty bizarre logic which seems to be relying on Samsung-specific fields in the contacts. Now, this already sounds suspicious, and, apparently, leads to full sync every several seconds. Obviously, the more contacts you have, the harder you're hit.

An interesting point in all this is that I'm not 100% sure the logic is working properly even on Samsung devices, so it might well be that the same issue is affecting people with high number of contacts using Samsung phones as well. I'd be really interested to see any feedbacks regarding this.

So, long story short, instead of fixing the logic (which is quite difficult in SMALI), I made a simple change which dilutes this logic invocations, right now 1:64. Since then I'm enjoying MUCH improved battery life.

The fixed APK is attached. You're welcome to give it a try at your own risk (you need to enable installation from untrusted sources + reboot and clean dalvik cache).
 

Attachments

  • goproviders-signed.apk
    2.6 MB · Views: 893
  • goprovider-signed-20140529.apk
    2.6 MB · Views: 9,990
Last edited:

BigDanInTX

Senior Member
May 19, 2009
152
33
League City, TX
The fixed APK is attached. You're welcome to give it a try at your own risk (you need to enable installation from untrusted sources + reboot and clean dalvik cache).

Someone who knows where this should be shared and divulged to the rest of the community should do so! It sounds like this is a pretty bad bug that should be addressed officially, but BIG TIME props to you for figuring this all out!!

Thank you!!!
 
Last edited:

DAGr8

Inactive Recognized Developer
Feb 27, 2010
3,713
6,309
Montreal
Im on samsung f/w (note3) yesterday ive experience on severe battery drain .. in a few hours it was completely drained.. I wasnt even wearing it.. so that logic aint the only faulty one .. thx for tgat fix.. il see if it helps

Sent from my SM-N900W8 using XDA Premium 4 mobile app
 

mpogr

Senior Member
Jan 16, 2008
185
63
Melbourne
Guys, everyone with abnormal drain, it would be extremely helpful to troubleshoot your root cause if you could send me the log file from your watch that includes the affected time span. In order to do that:
  1. Enable USB debugging on the watch (under settings->Gear Info)
  2. Download and install Tizen SDK.
  3. Connect your watch to the computer using its charging cradle.
  4. Open the command line (cmd.exe), change to the folder where the SDK files are installed (the default is c:\tizen-sdk\tools) and then run the following command:
    Code:
    sdb pull /var/log/dlog_main
This will pull the log file to the same folder. Then send it to me via PM (ZIP first!), so I could have a look.
 
Last edited:

DAGr8

Inactive Recognized Developer
Feb 27, 2010
3,713
6,309
Montreal
Guys, everyone with abnormal drain, it would be extremely helpful to troubleshoot your root cause if you could send me the log file from your watch that includes the affected time span. In order to do that:
  1. Download and install Tizen SDK.
  2. Connect your watch to the computer using its charging cradle.
  3. Open the command line (cmd.exe), change to the folder where the SDK files are installed (the default is c:\tizen-sdk\tools) and then run the following command:
    Code:
    sdb pull /var/log/dlog_main
This will pull the log file to the same folder. Then send it to me via PM (ZIP first!), so I could have a look.

well I decided to reformat my watch in case that woudl help but will surely grab a log next time somethign like this occurs.
 

thesparky007

Senior Member
Oct 15, 2008
1,781
972
Excellent work mpogr!! Will try this and report back

Sent from my GT-I9505 using Tapatalk
 

apexhugger

Member
May 30, 2014
7
0
I think I too have this issue and I have an S5. Does the goproviders-signed.apk go onto the phone or the Gear2?

Are there some instructions on getting the goproviders-signed.apk file onto the Gear2?
 

mpogr

Senior Member
Jan 16, 2008
185
63
Melbourne
I think I too have this issue and I have an S5. Does the goproviders-signed.apk go onto the phone or the Gear2?

Are there some instructions on getting the goproviders-signed.apk file onto the Gear2?
The APK file is installed on the phone. It is strongly advised to clear goproviders data before installing it.
I just made a new version of this APK corresponding to the new version of Gear Manager (2.1.14052101), it's attached to this post.
 

Attachments

  • goprovider-signed-20140529.apk
    2.6 MB · Views: 564

apexhugger

Member
May 30, 2014
7
0
The APK file is installed on the phone. It is strongly advised to clear goproviders data before installing it.
I just made a new version of this APK corresponding to the new version of Gear Manager (2.1.14052101), it's attached to this post.

Thanks for that. Is there a guide for getting this file onto the Gear2 (and clearing goproviders data)?

I'm quite new to this but good at following instructions ;)
 

mpogr

Senior Member
Jan 16, 2008
185
63
Melbourne
Thanks for that. Is there a guide for getting this file onto the Gear2 (and clearing goproviders data)?

I'm quite new to this but good at following instructions ;)
Clearing data is usually available under "Settings->Apps" and then find the app (goproviders) and find "Clear Data" buton.
In terms of installing, you need to enable installation from untrusted sources first of all. Then, you can use any file manager software (e.g. "Root Explorer" or "Super Manager"), when you tap on an APK file, it will ask if you want to install it.
 

apexhugger

Member
May 30, 2014
7
0
Clearing data is usually available under "Settings->Apps" and then find the app (goproviders) and find "Clear Data" buton.
In terms of installing, you need to enable installation from untrusted sources first of all. Then, you can use any file manager software (e.g. "Root Explorer" or "Super Manager"), when you tap on an APK file, it will ask if you want to install it.

I'm having trouble getting this file to install, it doesn't let let me tap install (tapping Install does nothing). Does the phone need to be rooted?
 

bubblebuddyi

Senior Member
Jul 3, 2008
310
46
Won't let me install, keeps failing.
Any ideas? I uninstalled with root uninstaller, still fails.

Do you think disabling Super User would temp fix the drain?

Sent from my SM-G900T using XDA Free mobile app
 

Attachments

  • 1401489246203.jpg
    1401489246203.jpg
    80.4 KB · Views: 441
Last edited:

mpogr

Senior Member
Jan 16, 2008
185
63
Melbourne
It is.

Sent from my SM-G900T using XDA Free mobile app
Actually, I think I faced it before. Gear Manager apparently checks if all of its components are installed and sometimes silently reinstalls them again.
Please, uninstall goproviders and install the alternative APK quickly afterwards.
I use Super Manager, one advantage of it is that you can see if the app is already installed (it show uninstall option when you tap on the APK in such case). I saw once, when I uninstalled the original app and then tried installing the new APK, it failed, but then, after tapping on it again, Super Manager showed that it was already installed. What I think happened was Gear Manager silently reinstalled the original app while I was trying to install the new one. Uninstalling (from Super Manager) and quickly installing again fixed it.
 

bubblebuddyi

Senior Member
Jul 3, 2008
310
46
Actually, I think I faced it before. Gear Manager apparently checks if all of its components are installed and sometimes silently reinstalls them again.
Please, uninstall goproviders and install the alternative APK quickly afterwards.
I use Super Manager, one advantage of it is that you can see if the app is already installed (it show uninstall option when you tap on the APK in such case). I saw once, when I uninstalled the original app and then tried installing the new APK, it failed, but then, after tapping on it again, Super Manager showed that it was already installed. What I think happened was Gear Manager silently reinstalled the original app while I was trying to install the new one. Uninstalling (from Super Manager) and quickly installing again fixed it.

I tried that with Root Uninstaller, it definitely silently installs it. Faster then I could install it. And apparently disabling Root in SU uninstalled it, because now I can't re-enable it. As long as I'm not rooted, I shouldn't have an issue right?

Sent from my SM-G900T using XDA Free mobile app
 

mpogr

Senior Member
Jan 16, 2008
185
63
Melbourne
I tried that with Root Uninstaller, it definitely silently installs it. Faster then I could install it. And apparently disabling Root in SU uninstalled it, because now I can't re-enable it. As long as I'm not rooted, I shouldn't have an issue right?

Sent from my SM-G900T using XDA Free mobile app
No idea mate. Just make sure you've got the right "goproviders" installed at the end of the process. The final APK will reside under /data/app and will be named "com.samsung.accessory.goproviders-N.apk" (where N is a number like 1, 2 etc.). Just grab it (e.g. by "adb pull") and do binary comparison with the file you installed ("diff" on Andoid/Linux or "fc /b" on Windows).
 

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    Edit: with new Gear Manager (Jun release), this method doesn't work anymore. The new approach is to install a "contact synchroniser killer" app on the rooted watch. More details are in this post.

    ==================================================================================================================================================================================

    Hi all,

    Ever since I started using my Gear 2 Neo with my HTC One M8 phone (using the guide in this forum), I noticed that my watch consumes battery significantly faster than most of the users have been reporting. Even more strangely, sometimes after resetting both the phone and the watch (and I've done this a lot while experimenting and trying to get more stuff working) I had streaks of stellar battery life, well in line with optimistic reports here and elsewhere, but then, after a while, it started deteriorating very quickly.

    So I decided it was time to do something about it. I installed Tizen SDK, hooked the watch up and started poking around. The first thing I noticed my watch CPU was, most of the time, sitting on 40%! Well, that doesn't sound right, does it? Then I noticed the log (located under /var/log/dlog_main) was full with messages related to contact synchronisation. It turns out the damn thing synchronises all of my contacts every several seconds. The trouble is I have well over 1500 contacts (that's consolidated from different sources, the number of raw contacts should be well over 3000). So it takes significant time to do this, meaning my watch (and the phone!) are thrashed by these stupid full contact syncs all the time! What's even more striking is the fact it doesn't help when I change it to "favourites only". Apparently, this affects only the contacts displayed on the watch, however, the sync process still takes all of them.

    At this point I started poking around Samsung APK files to try and understand what was going on. Apparently, the APK responsible for contact sync is called GOPROVIDERS. Indeed, if you kill it, the thrashing stops, however, other important functions cease working as well. Aside of Contacts vanishing from the Gear, "Find my phone" is gone as well, but, more importantly, notifications stop working. While I could tolerate the first two, the last one was too much to give up.

    I started decompiling and analysing sources. Apparently, there is a process running every several seconds that analyses if any changes have been made to the contacts. It uses pretty bizarre logic which seems to be relying on Samsung-specific fields in the contacts. Now, this already sounds suspicious, and, apparently, leads to full sync every several seconds. Obviously, the more contacts you have, the harder you're hit.

    An interesting point in all this is that I'm not 100% sure the logic is working properly even on Samsung devices, so it might well be that the same issue is affecting people with high number of contacts using Samsung phones as well. I'd be really interested to see any feedbacks regarding this.

    So, long story short, instead of fixing the logic (which is quite difficult in SMALI), I made a simple change which dilutes this logic invocations, right now 1:64. Since then I'm enjoying MUCH improved battery life.

    The fixed APK is attached. You're welcome to give it a try at your own risk (you need to enable installation from untrusted sources + reboot and clean dalvik cache).
    6
    New approach

    OK, the handler I updated in the 2 previous fixes didn't change from the previous version of "goproviders", so I hoped I could just use the same .class file, DEX it, stick into an APK, sign and be done with it. Unfortunately, it looks some other logic has changed, so now the same fix doesn't work anymore.
    So I started investigating the other end, that is, the watch. The major difference is now we have ROOT on the Gear, so why not use it?
    I quickly figured out that the offending process on the watch side was "w-contacts2-consumer". Apparently, if you just kill it, this stops Contact synchronisation only, while Contacts app on the watch remains fully functional. Unfortunately, this process is respawned every time Bluetooth connection is reestablished between the the phone and the watch.
    I was looking for "cron" for Tizen, hoping to put "pkill" into a recurring task that'd run every couple of minutes. Unfortunately, I couldn't find "cron" on the watch, and the version of busybox suggested in one of the threads on this forum doesn't have it precompiled.
    Then I thought: why the heck can't I just write a small app (command line) that would literally just do this:
    Code:
    while(1)
    {
    	system("pkill w-contacts2");
    	sleep(120);
    }
    After a bit of playing around with Tizen SDK, I managed to produce this executable (attached). You can put it into /sbin, making sure permissions are 755. One last thing is to make it run as a service:
    Code:
    systemd-run --unit=kill_contacts.nonsamsung --description="Automatically Kill Contacts Every 2 Minutes" /sbin/kill_contacts
    I don't think it'll survive a reboot though, I'll get it sorted later.

    Now battery consumption is back to normal, and contacts get synchronised every time the watch connects to the phone, which is more than fine with me.
    2
    To make kill_contacts permanent, you can create service so that it will automatically start on reboot

    create file named kill_contacts.service
    Code:
    [Unit]
    Description=Automatically Kill Contacts Every 2 Minutes
    
    [Service]
    ExecStart=/sbin/kill_contacts
    
    [Install]
    WantedBy=multi-user.target

    push this file to /etc/systemd/system
    change mod to 644
    enable service
    start service
    Code:
    c:\sdb root on
    c:\sdb push kill_contacts.service /etc/systemd/system
    c:\sdb shell
    sh-3.2#chmod 644 /etc/systemd/system/kill_contacts.service
    sh-3.2#systemctl enable /etc/systemd/system/kill_contacts.service
    sh-3.2#systemctl start kill_contacts.service

    check running service using :
    Code:
    journalctl -u kill_contacts.service
    1
    Could you please explain your "logic invocations, right now 1:64" change?
    In the fixed APK the logic is actually invoked 1 time out of 64 attempts. It makes its frequency about every 40 minutes instead of every 30 seconds.
    1
    thanks but I am not been able to uninstall the goproviders app. there is no option to uninstalled View attachment 2807827

    please advice if you can

    Sent from my SM-N900T using Tapatalk
    I use Super Manager for this sort of tasks. Look it up in Google Play store.

    Sent from my GT-I9505 using Tapatalk