wire-android_legacy icon indicating copy to clipboard operation
wire-android_legacy copied to clipboard

High power usage even when the app is not actively used

Open freijon opened this issue 8 years ago • 95 comments

The problem

I regularly get a warning from Android that Wire is "draining my battery heavily". When I compare the CPU total in the power overview, Wire seems unusual high compared to other apps.

Environment

  • Version: Wire 2.32.325 and older versions
  • OS: OxygenOS OP3_O2_Open_15 (based on Android 7.1.1)
  • Model: OnePlus 3
  • Network: mostly on LTE

Details

Open Wire. Wire doesn't even have do be used to drain the battery, it can be open in the background.

Link to Debug logs

wire_debug_report.txt

freijon avatar May 09 '17 16:05 freijon

Agreed, it's terrible. screenshot_2017-05-16-07-52-50

ec1oud avatar May 16 '17 05:05 ec1oud

I am also experiencing this issue. It started after upgrading from Wire 2.30.321 and has been present in all versions since. It seems like the issue is Wire keeps the device awake. See the attached screenshots for a comparison with Telegram on the same device.

screenshot_20170528-141511 screenshot_20170528-141524

The device is running CM 13 which is based on Android 6.0.1 without Google Play Services.

kostadinstoilov avatar May 28 '17 11:05 kostadinstoilov

Hello everyone! Is it happening with GCM enabled or not?

red-avtovo avatar May 29 '17 08:05 red-avtovo

With the risk of sounding stupid: What is GCM and how do I know if it's enabled or not? :)

freijon avatar May 29 '17 10:05 freijon

I think he means google#s push service

frzifus avatar May 29 '17 13:05 frzifus

Hello @red-avtovo

I am observing this issue on a device without Google Play services so GCM is not being used.

kostadinstoilov avatar May 29 '17 14:05 kostadinstoilov

Basically we are using cloud based notification service system to be able to get notifications. If we don't have ability to use GCM (Google Cloud Messaging = Google Play Services), the app is using WebSocket connection to the backend. That's why it drains quite much energy.

red-avtovo avatar May 29 '17 15:05 red-avtovo

That makes sense, but I did not experience this in Wire 2.30.321 so I believe there is some regression that is causing this battery drain issue.

kostadinstoilov avatar May 29 '17 15:05 kostadinstoilov

Makes sense.

Sounds like there needs to be an open alternative for push notifications then. What are all the other SMS-replacement apps doing? I googled and I see that mqtt is one idea. There must be a TCP connection always open, to the server, but it can be configured to be long-lived and not to require much maintenance traffic somehow. For example https://ollieparsley.com/2013/05/20/using-mqtt-as-a-gcm-replacement-for-android-push-notifications/ http://tokudu.com/post/50024574938/how-to-implement-push-notifications-for-android But then, that ought to be set up as a drop-in replacement solution and made available on F-Droid, so that every app doesn't have to open its own TCP connection. (Searches there...) Oh look: https://sourceforge.net/projects/androidpn/ Also https://github.com/kontalk/androidclient/wiki/Push-notification-without-Google-Cloud-Messaging https://microg.org/ That sounds like it would be worth a try.

Ideally the phone would have a routable IP address so that a central server wouldn't be required. (The rollout of IPv6 was supposed to solve the address-shortage problem.) Does that actually happen at least on some networks? If it can be detected, maybe use that technique first, then fall back to AndroidPN or MicroG on a phone which does not have GCM?

ec1oud avatar May 29 '17 15:05 ec1oud

I am also experiencing severe battery drain because of wire. It started with 2.34.338 or 2.33.336, I'm not sure. I was experiencing the problems described in issue #760 , which 2.33.336 update corrected. So I'm wondering if the latest update is not able to interface with GCM. Keep awake for wire is basically the same as how long I've had the phone off the charger.

I am using a google pixel running android 7.1.2 and google play services 11.0.55.

kylgry avatar Jun 04 '17 17:06 kylgry

Oki i wrote my comment already here: https://github.com/wireapp/wire-android/issues/164 I don't know which one is the correct one.

I'm using the latest WIRE version on Android, with a HTC 10 and Android 7.1.2 without gapps or any Google services tho! The Battery drain is massive and not normal or acceptable at all. I will deinstall this app until this is fixed.(good that we have desktop apps) This app drains almost my entire battery life over one day, just alone, it is ridiculous. wire1

I love WIRE and how the devs do work on it and keep it running and improving. But this has to be handled with priority imho.

Edit: I need to add, that Telegram does not have such battery issues at all, also Conversations XMPP app does not too. In fact, no other app drains that much battery like WIRE does currently. And I do not use google play services/GCM at all, on my device, so all apps run without GCM actually for me. And therfor, MicroG is not a solution and rather more like a workaround, because it needs "Signature Spoofing" to work. Something that LineageOS does not and will not support in the future in their builds. Which I agree with.

I do not want to be forced to do that just to have good battery life on a single app when all other apps seem to have no issues with it at all. (telegram, conversations, threema etc.) I really hope WIRE devs are gonna fix this soon.

ghost avatar Jun 05 '17 00:06 ghost

I don't believe this issue is related to GCM or WebSockets. I was using Wire with WebSockets for several months without any battery draining issues, my issues started after I upgraded from Wire 2.30.321. This was the last version that did not drain the battery for me. I would gladly downgrade to that APK as a workaround but it no longer works unfortunately

kostadinstoilov avatar Jun 05 '17 09:06 kostadinstoilov

I am also seeing massive battery drain without gcm. I know wire will use more battery without google services btbi believe what we are experiencing is excessive and beyond what should be normal. There has to be a bug.

I have also corresponded with another wire user that did not have nearly the battery drain some of us are seeing. This user was on version 2.28.317.

This issue is referring to the same bug affecting the users in issue #164.

klundry avatar Jun 06 '17 03:06 klundry

I had the same problem with two devices, one having Google Play Services (thus with GCM) but without a Google account, the other using microG (a free Google Services replacement also incl. GCM). Both devices were running fine before and the problem started as well with one of the recent Wire updates. However I could resolve the problem by manually upgrading Google Play Services resp. microG!

My speculation is: The new Wire update expects a newer Google Play Services/GCM version and if GCM is not up-to-date anymore it silently falls back to WebSocket. As a result Wire is affected by the WebSocket bug (#164) that drains the battery. If this speculation is correct, I would suggest that Wire should warn the user about the outdated GCM! Also: It would be nice if Wire could show somewhere whether it actually uses GCM or WebSocket so that one can more easily identify this. (Maybe have it in the settings – in the future this could be extended to manual choose which one to use? :wink:)

For those fellows using microG: (For clarification: microG refers to a whole project. The app that replaces Google Services is called "Services Core" or "GmsCore"). The last stable version of Services Core (0.2.4) uses an outdated version number – you need to update to one of the latest prerelease versions (0.2.4-…)! Either download it directly from the website (dropdown button reveals the prerelease versions) or update it via F-Droid (maybe "experimental updates" have to be enabled to see prerelease versions). Unfortunately there is an issue with F-Droid and microG: If you have installed "Services Core" from the microG repository, it will show up as "Unified Nlp (no GAPPS)" from the official F-Droid repository. This comment by @landry314 explains ways how to update "Services Core" nevertheless.

Awerick avatar Jun 23 '17 14:06 Awerick

I'm using the latest MicroG. However, there currently was an update to 0.2.4-103 (or something like that), and I have not yet noticed the battery drain (however for me it never was so bad as some report here).

Ra72xx avatar Jun 23 '17 18:06 Ra72xx

I have a similar issue with mine. The difference is that I get a notification about power draining, but when I go into details it uses far less then any other app in there, usually only 1%.

Wire (for android) version: 2.36.343 (from google play store. Android OS: 7.1.1 (Ozygen OS 4.1.6)

Strit avatar Jul 04 '17 08:07 Strit

@Strit I think this is because it drains the power via Google Play Services, at least that is how I think it works. Google Play Services power consumption is much higher if Wire is running.

I hope someone is going to work on this issue soon. I stopped using Wire on my mobile because of this.

freijon avatar Jul 04 '17 08:07 freijon

Might be true @freijon but I don't notice any real battery drain at all. It still has 50% left on the battery when I go to bed.

Strit avatar Jul 04 '17 08:07 Strit

For me it's 50% in the evening when Wire is running during the day vs. up to 3 days without Wire.

freijon avatar Jul 04 '17 10:07 freijon

@freijon: It would be interesting to know which "Google Play Services" version is installed on your phone. The latest version seems to be 11.0.??. I am not sure about version 10 but if you are on version 9 or below, this is probably the reason for the battery drain! (Do you use the "Google Play Store" and let it automatically update your apps? If so, it should actually update "Google Play Services" automatically…)

Awerick avatar Jul 04 '17 11:07 Awerick

@Awerick: I have version 11.0.55 installed on my device.

freijon avatar Jul 04 '17 11:07 freijon

And still the battery gets drained? Interesting, then there seems to be another issue besides(/instead?) the one I speculated…

Awerick avatar Jul 04 '17 12:07 Awerick

Same issue on LineageOS without gapps. No microG eather. Battery drain ridiculously high. I downgraded to v2.30.321 as stated by @kostadinstoilov for a camarison. No battery drain, the version is buggy though. The issue obviously concerns both, GSM and WebSocket. Hope they can fix it soon.

decuba avatar Jul 04 '17 15:07 decuba

Experiencing similiar drain on CopperheadOS, which means no gapps.

Nubzori avatar Jul 05 '17 13:07 Nubzori

What I'm also not getting: Why is this labeled as "enhancement"? It's clearly an issue (bug?) and not a feature request. And it's a killer for me!

freijon avatar Jul 05 '17 16:07 freijon

Any updates on this bug from the Wire team?

CarstenULarsen avatar Jul 07 '17 06:07 CarstenULarsen

Hello @freijon, @CL4RSEN and everyone,

We are aware of the battery issue and it is marked 'high priority' on our end. We will most likely have a service run to fix bugs by the end of July. Thanks for all the feedback you have provided! Best,

lucilacaranza avatar Jul 07 '17 11:07 lucilacaranza

Hi,

In case it's any use to your team, it looks like the battery issue (in my case anyway, Galaxy S7, Android 7.0) is caused by the ZMessagingService in the sync library not releasing WakeLocks:

screenshot_20170715-102140

bradfier avatar Jul 15 '17 09:07 bradfier

In the latest version (2.37.349), one wakelock (FutureService) remains out of two. Had both FutureService and ZMessagingService on the previous version of Wire. Android 7.1.2, no google apps.

sergachev avatar Jul 20 '17 12:07 sergachev

Battery drain still extremely high in the new version 2.37.349. Seems like nothing has chaged at this point. In my case it is 15% to 18% after one day run without any active use of wire-app (lineageOS, no gapps, OnePlus3). For me the app is useless untill it's fixed.

decuba avatar Jul 21 '17 20:07 decuba