signalapp / libsignal-service-java

A Java/Android library for communicating with the Signal messaging service.
GNU General Public License v3.0
587 stars 271 forks source link

Replacing Thread.sleep with alarms for android devices #54

Closed theBoatman closed 6 years ago

theBoatman commented 6 years ago

First: This is nearly the same as #53 submitted by dpapavas. I had finished it before I saw that there is an other merge request with nearly the same code open. If you are happy with #53 or just don't want to spend more time on this, feel free to stop reading here and close it without comment.

This is just a resubmission of #52 with the changes @moxie0 has specified. It had been only minor change requests, so it should match all needs now. I ran this code for several weeks and everything is stable.

It's a few lines less than #53 and as it reuses the PendingIntent and not creating it every minute it might be a tiny bit more efficient. To use the new behaviour only one line needs to be changed in SignalAndroid as requested.

theBoatman commented 6 years ago

As time goes by I had the chance to test this on several devices. Currently I tried:

all without Gapps. Additionally I tested on Android 8.1.0 with gapps (stock rom without any modification). On all devices without gapps the code worked as expected. On the one with gapps no change to the official build was noticeable.

sicherha commented 6 years ago

This PR should now be obsolete thanks to c37cbf5.