From 6c5731d55c079a559a9714e77f6fc52a11c25db3 Mon Sep 17 00:00:00 2001 From: Arian Date: Thu, 18 May 2023 14:48:41 +0200 Subject: [PATCH] sm6150-common: parts: Handle gestures category similar to pickup and proximity Change-Id: I37d67cb457da7d04b83045e81693d35c58842471 --- .../settings/doze/DozeSettingsFragment.java | 13 ++++++++----- .../src/org/lineageos/settings/doze/DozeUtils.java | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java index 1e92e53..b845d6c 100644 --- a/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java +++ b/parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java @@ -79,10 +79,9 @@ public class DozeSettingsFragment extends PreferenceFragment dozeEnabled && DozeUtils.isAlwaysOnEnabled(getActivity())); mDozeBrightnessPreference.setOnPreferenceChangeListener(this); - mWakeOnGesturePreference = (SwitchPreference) findPreference(DozeUtils.WAKE_ON_GESTURE_KEY); - mWakeOnGesturePreference.setEnabled(dozeEnabled); - mWakeOnGesturePreference.setOnPreferenceChangeListener(this); - + PreferenceCategory gesturesCategory = + (PreferenceCategory) getPreferenceScreen().findPreference( + DozeUtils.CATEG_GESTURES); PreferenceCategory pickupSensorCategory = (PreferenceCategory) getPreferenceScreen().findPreference( DozeUtils.CATEG_PICKUP_SENSOR); @@ -90,6 +89,10 @@ public class DozeSettingsFragment extends PreferenceFragment (PreferenceCategory) getPreferenceScreen().findPreference( DozeUtils.CATEG_PROX_SENSOR); + mWakeOnGesturePreference = (SwitchPreference) findPreference(DozeUtils.WAKE_ON_GESTURE_KEY); + mWakeOnGesturePreference.setEnabled(dozeEnabled); + mWakeOnGesturePreference.setOnPreferenceChangeListener(this); + mPickUpPreference = (SwitchPreference) findPreference(DozeUtils.GESTURE_PICK_UP_KEY); mPickUpPreference.setEnabled(dozeEnabled); mPickUpPreference.setOnPreferenceChangeListener(this); @@ -117,7 +120,7 @@ public class DozeSettingsFragment extends PreferenceFragment } else { DozeUtils.updateDozeBrightnessIcon(getContext(), mDozeBrightnessPreference); } - mWakeOnGesturePreference.setDependency(DozeUtils.ALWAYS_ON_DISPLAY); + gesturesCategory.setDependency(DozeUtils.ALWAYS_ON_DISPLAY); pickupSensorCategory.setDependency(DozeUtils.ALWAYS_ON_DISPLAY); proximitySensorCategory.setDependency(DozeUtils.ALWAYS_ON_DISPLAY); } diff --git a/parts/src/org/lineageos/settings/doze/DozeUtils.java b/parts/src/org/lineageos/settings/doze/DozeUtils.java index 170cc7a..6dc121b 100644 --- a/parts/src/org/lineageos/settings/doze/DozeUtils.java +++ b/parts/src/org/lineageos/settings/doze/DozeUtils.java @@ -47,6 +47,7 @@ public final class DozeUtils { protected static final String ALWAYS_ON_DISPLAY = "always_on_display"; protected static final String DOZE_BRIGHTNESS_KEY = "doze_brightness"; protected static final String WAKE_ON_GESTURE_KEY = "wake_on_gesture"; + protected static final String CATEG_GESTURES = "gestures"; protected static final String CATEG_PICKUP_SENSOR = "pickup_sensor"; protected static final String CATEG_PROX_SENSOR = "proximity_sensor";