From dd2654493fc627c123da20c68d0e7d520d9414e0 Mon Sep 17 00:00:00 2001 From: Bill Lin Date: Mon, 15 Mar 2021 11:20:41 +0800 Subject: [PATCH] 2/ Set Swipe bottom for notification OFF by default Note: 1) The "Swipe bottom for notification" will still available in Settings 2) If user had ever turn ON this settings, then we will NOT help user change() any setting for this purpose. Test: facory reset and observe the default function if OFF Bug: 182711813 Change-Id: I9d76c6c5c83a1dcfaaf289b5af9dcc996bb943fa --- ...ipeBottomToNotificationPreferenceController.java | 2 +- ...ottomToNotificationPreferenceControllerTest.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java b/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java index 04a32de6bd8..5eba5394388 100644 --- a/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java +++ b/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java @@ -76,7 +76,7 @@ public class SwipeBottomToNotificationPreferenceController extends TogglePrefere @Override public boolean isChecked() { return Settings.Secure.getInt(mContext.getContentResolver(), - SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, ON) == ON; + SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, OFF) == ON; } @Override diff --git a/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java index a1c0c8f5396..c6d823371a4 100644 --- a/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java @@ -58,7 +58,7 @@ public class SwipeBottomToNotificationPreferenceControllerTest { mController.setChecked(true); assertThat(Settings.Secure.getInt(mContext.getContentResolver(), - SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 1)).isEqualTo(1); + SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 0)).isEqualTo(1); } @Test @@ -66,7 +66,7 @@ public class SwipeBottomToNotificationPreferenceControllerTest { mController.setChecked(false); assertThat(Settings.Secure.getInt(mContext.getContentResolver(), - SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 1)).isEqualTo(0); + SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 0)).isEqualTo(0); } @Test @@ -109,4 +109,13 @@ public class SwipeBottomToNotificationPreferenceControllerTest { assertThat(mController.getSummary()).isEqualTo( mContext.getText(R.string.gesture_setting_off)); } + + @Test + public void getDefaultConfig_returnsOffState() { + SystemProperties.set(OneHandedEnablePreferenceController.SUPPORT_ONE_HANDED_MODE, "false"); + Settings.Secure.resetToDefaults(mContext.getContentResolver(), + Settings.Secure.ONE_HANDED_MODE_ENABLED); + + assertThat(mController.isChecked()).isFalse(); + } }