From 9eae563ab356b07a4e67648e0f349842dad75cb4 Mon Sep 17 00:00:00 2001 From: Henrique Silva Date: Thu, 17 Jan 2019 21:40:14 -0200 Subject: [PATCH] samsung: doze: Fix AoD default pref * Fixes non-working pulse notifications from sensors until user toggles the main switch and also sets the proper initial status of the AoD preference for the devices that have the feature available. Signed-off-by: Henrique Silva Change-Id: I8e554decca3734b165fdc722d904d90713666db9 --- doze/src/org/lineageos/settings/doze/Utils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doze/src/org/lineageos/settings/doze/Utils.java b/doze/src/org/lineageos/settings/doze/Utils.java index d6ff02ac..b8b5df95 100644 --- a/doze/src/org/lineageos/settings/doze/Utils.java +++ b/doze/src/org/lineageos/settings/doze/Utils.java @@ -65,8 +65,12 @@ public final class Utils { } protected static boolean isAlwaysOnEnabled(Context context) { + final boolean enabledByDefault = context.getResources() + .getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled); + return Settings.Secure.getIntForUser(context.getContentResolver(), - DOZE_ALWAYS_ON, 1, UserHandle.USER_CURRENT) != 0; + DOZE_ALWAYS_ON, alwaysOnDisplayAvailable(context) && enabledByDefault ? 1 : 0, + UserHandle.USER_CURRENT) != 0; } protected static boolean isDozeEnabled(Context context) {