aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-12-06 16:57:43 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-12-06 16:57:43 +0100
commitc489b6a8ebf75862959a3b32fb50e7af84852c86 (patch)
treecc7af3d29b158d8d5bed547054190fa7673d163a
parent97821f0633ee708939a95cf4b71599cb2367b036 (diff)
put device id into setting for doze
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 3e161f9..efa641a 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -1520,14 +1520,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);
@@ -1560,7 +1565,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;
}
}