Guard swipe to notification gesture with system settings preference

Bug: 154080211
Test: make and install, check the gesture works as expectedly
Change-Id: Ibd6bbd595d2fba5d68e66eb54e4a7fec160b9bf8
This commit is contained in:
Jerry Chang
2020-06-23 21:40:05 +08:00
parent 0b51b916b0
commit 779efaca91
3 changed files with 41 additions and 16 deletions
@@ -31,6 +31,9 @@ public class SecureSettingsObserver extends ContentObserver {
public static final String NOTIFICATION_BADGING = "notification_badging";
/** Hidden field Settings.Secure.ONE_HANDED_MODE_ENABLED */
public static final String ONE_HANDED_ENABLED = "one_handed_mode_enabled";
/** Hidden field Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED */
public static final String ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED =
"swipe_bottom_to_notification_enabled";
private final ContentResolver mResolver;
private final String mKeySetting;
@@ -87,4 +90,15 @@ public class SecureSettingsObserver extends ContentObserver {
return new SecureSettingsObserver(
context.getContentResolver(), listener, ONE_HANDED_ENABLED, 1);
}
/**
* Constructs settings observer for {@link #ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED}
* preference.
*/
public static SecureSettingsObserver newSwipeToNotificationSettingsObserver(Context context,
OnChangeListener listener) {
return new SecureSettingsObserver(
context.getContentResolver(), listener,
ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 1);
}
}