diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-12-10 21:45:19 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-12-10 21:45:19 +0100 |
commit | 0aa694b7a2c070d3b93c8c934b96967071ff68b1 (patch) | |
tree | 24b452ad1f65daf73879ade961ef14cf51481f55 /src/main/java | |
parent | c528e0ac5e6db450304a7eaf1aeb5ced47757d8e (diff) |
put device id into setting for doze
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index c859264a9..002162041 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -1709,14 +1709,19 @@ public class ConversationActivity extends XmppActivity return connection == null ? -1 : connection.getFeatures().getMaxHttpUploadSize(); } + private String getBatteryOptimizationPreferenceKey() { + @SuppressLint("HardwareIds") String device = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); + return "show_battery_optimization" + (device == null ? "" : device); + } + private void setNeverAskForBatteryOptimizationsAgain() { - getPreferences().edit().putBoolean("show_battery_optimization", false).apply(); + getPreferences().edit().putBoolean(getBatteryOptimizationPreferenceKey(), false).apply(); } private void openBatteryOptimizationDialogIfNeeded() { if (hasAccountWithoutPush() && isOptimizingBattery() - && getPreferences().getBoolean("show_battery_optimization", true)) { + && getPreferences().getBoolean(getBatteryOptimizationPreferenceKey(), true)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.battery_optimizations_enabled); builder.setMessage(R.string.battery_optimizations_enabled_dialog); @@ -1747,7 +1752,7 @@ public class ConversationActivity extends XmppActivity private boolean hasAccountWithoutPush() { for (Account account : xmppConnectionService.getAccounts()) { - if (account.getStatus() != Account.State.DISABLED && !xmppConnectionService.getPushManagementService().available(account)) { + if (account.getStatus() == Account.State.ONLINE && !xmppConnectionService.getPushManagementService().available(account)) { return true; } } |