samsung: doze: Make AOD preference not persistent

Change-Id: I9d80e94de02d35c85765302a01b53020824dd0ff
tirimbino
Luca Stefani 6 years ago committed by Bruno Martins
parent 42ed17551b
commit f69e8a5140
  1. 4
      doze/res/xml/gesture_panel.xml
  2. 1
      doze/src/org/lineageos/settings/doze/SamsungDozeSettings.java
  3. 2
      doze/src/org/lineageos/settings/doze/Utils.java

@ -19,10 +19,10 @@
<SwitchPreference <SwitchPreference
android:key="always_on_display" android:key="always_on_display"
android:defaultValue="false"
android:disableDependentsState="true" android:disableDependentsState="true"
android:title="@string/ambient_display_always_on_title" 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 <PreferenceCategory
android:key="proximity_sensor" android:key="proximity_sensor"

@ -53,6 +53,7 @@ public class SamsungDozeSettings extends PreferenceFragment
mAlwaysOnDisplayPreference = findPreference(Utils.ALWAYS_ON_DISPLAY); mAlwaysOnDisplayPreference = findPreference(Utils.ALWAYS_ON_DISPLAY);
mAlwaysOnDisplayPreference.setEnabled(dozeEnabled); mAlwaysOnDisplayPreference.setEnabled(dozeEnabled);
mAlwaysOnDisplayPreference.setChecked(Utils.isAlwaysOnEnabled(getActivity()));
mAlwaysOnDisplayPreference.setOnPreferenceChangeListener(this); mAlwaysOnDisplayPreference.setOnPreferenceChangeListener(this);
mHandwavePreference = findPreference(Utils.GESTURE_HAND_WAVE_KEY); mHandwavePreference = findPreference(Utils.GESTURE_HAND_WAVE_KEY);

@ -64,7 +64,7 @@ public final class Utils {
return new AmbientDisplayConfiguration(context).alwaysOnAvailable(); return new AmbientDisplayConfiguration(context).alwaysOnAvailable();
} }
private static boolean isAlwaysOnEnabled(Context context) { protected static boolean isAlwaysOnEnabled(Context context) {
return Settings.Secure.getIntForUser(context.getContentResolver(), return Settings.Secure.getIntForUser(context.getContentResolver(),
DOZE_ALWAYS_ON, 1, UserHandle.USER_CURRENT) != 0; DOZE_ALWAYS_ON, 1, UserHandle.USER_CURRENT) != 0;
} }

Loading…
Cancel
Save