Small improvements, refactoring

This commit is contained in:
M66B
2019-09-26 12:11:46 +02:00
parent 0d6edc2bfb
commit e6e0a00767
6 changed files with 66 additions and 56 deletions

View File

@@ -289,12 +289,7 @@ public class ServiceSynchronize extends ServiceBase {
setUnseen(null);
if (state != null && state.isRunning()) {
Boolean ignoring = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
ignoring = (pm != null && pm.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID));
}
Log.e("Destroy while running ignoring=" + ignoring);
Log.e("Destroy while monitor running ignoring=" + Helper.isIgnoringOptimizations(this));
state.stop();
}
@@ -576,6 +571,11 @@ public class ServiceSynchronize extends ServiceBase {
final Thread main = Thread.currentThread();
if (state != null && state.isRunning()) {
Log.e("Monitor running ignoring=" + Helper.isIgnoringOptimizations(this));
state.stop();
}
state = new Core.State(networkState);
state.runnable(new Runnable() {
private PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);