From d0c7a757799835dd57ed880d1abc3e41357ade14 Mon Sep 17 00:00:00 2001 From: Henrique Silva Date: Thu, 17 Jan 2019 21:40:14 -0200 Subject: msm8996-common: 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 Signed-off-by: Davide Garberi --- doze/src/org/lineageos/settings/doze/Utils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'doze') diff --git a/doze/src/org/lineageos/settings/doze/Utils.java b/doze/src/org/lineageos/settings/doze/Utils.java index bc7c955..edcb60e 100644 --- a/doze/src/org/lineageos/settings/doze/Utils.java +++ b/doze/src/org/lineageos/settings/doze/Utils.java @@ -99,8 +99,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 alwaysOnDisplayAvailable(Context context) { -- cgit v1.2.3