samsung: doze: Make AOD preference not persistent
authorLuca Stefani <luca.stefani.ge1@gmail.com>
Tue, 8 Jan 2019 14:15:43 +0000 (15:15 +0100)
committerBruno Martins <bgcngm@gmail.com>
Wed, 13 Jan 2021 14:25:00 +0000 (15:25 +0100)
Change-Id: I9d80e94de02d35c85765302a01b53020824dd0ff

doze/res/xml/gesture_panel.xml
doze/src/org/lineageos/settings/doze/SamsungDozeSettings.java
doze/src/org/lineageos/settings/doze/Utils.java

index c281eb1322f15e80bc83d6855b702b39d07dd97e..5680fda6a62bc18a49d4aad6d948bbea5d741ac1 100644 (file)
 
     <SwitchPreference
         android:key="always_on_display"
-        android:defaultValue="false"
         android:disableDependentsState="true"
         android:title="@string/ambient_display_always_on_title"
-        android:summary="@string/ambient_display_always_on_summary" />
+        android:summary="@string/ambient_display_always_on_summary"
+        android:persistent="false" />
 
     <PreferenceCategory
         android:key="proximity_sensor"
index cdf6ac2e0405d3ac8cb77764da9b3c68b91f75d7..546fec182f32bd1fba35a969cbe0e8fcb0952e05 100644 (file)
@@ -53,6 +53,7 @@ public class SamsungDozeSettings extends PreferenceFragment
 
         mAlwaysOnDisplayPreference = findPreference(Utils.ALWAYS_ON_DISPLAY);
         mAlwaysOnDisplayPreference.setEnabled(dozeEnabled);
+        mAlwaysOnDisplayPreference.setChecked(Utils.isAlwaysOnEnabled(getActivity()));
         mAlwaysOnDisplayPreference.setOnPreferenceChangeListener(this);
 
         mHandwavePreference = findPreference(Utils.GESTURE_HAND_WAVE_KEY);
index e5b7daa2356fc9924d7396ab60802d764bc34cea..c874690015d5a23f49ef44ab5e8fd5a98d662a4d 100644 (file)
@@ -64,7 +64,7 @@ public final class Utils {
         return new AmbientDisplayConfiguration(context).alwaysOnAvailable();
     }
 
-    private static boolean isAlwaysOnEnabled(Context context) {
+    protected static boolean isAlwaysOnEnabled(Context context) {
         return Settings.Secure.getIntForUser(context.getContentResolver(),
                 DOZE_ALWAYS_ON, 1, UserHandle.USER_CURRENT) != 0;
     }