From 3ea61b66aff93631e646e38a632d360c2a4a2375 Mon Sep 17 00:00:00 2001 From: Mehdi Alizadeh Date: Fri, 13 Dec 2019 15:37:18 -0800 Subject: [PATCH] Rename methods to reflect the correct names of nav modes Bug: 146004827 Test: make RunSettingsRoboTests ROBOTEST_FILTER=SystemNavigationGestureSettingsTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=SystemNavigationPreferenceControllerTest Change-Id: I00602c41aed5e675b8e0d3df7a3b3b318e6ec903 --- .../SystemNavigationGestureSettings.java | 4 ++-- .../SystemNavigationPreferenceController.java | 11 ++++------- ...stemNavigationPreferenceControllerTest.java | 18 ++++++++++++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java index 0bd6b211cb4..9e783886d8d 100644 --- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java +++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java @@ -258,9 +258,9 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i @VisibleForTesting static String getCurrentSystemNavigationMode(Context context) { - if (SystemNavigationPreferenceController.isEdgeToEdgeEnabled(context)) { + if (SystemNavigationPreferenceController.isGestureNavigationEnabled(context)) { return KEY_SYSTEM_NAV_GESTURAL; - } else if (SystemNavigationPreferenceController.isSwipeUpEnabled(context)) { + } else if (SystemNavigationPreferenceController.is2ButtonNavigationEnabled(context)) { return KEY_SYSTEM_NAV_2BUTTONS; } else { return KEY_SYSTEM_NAV_3BUTTONS; diff --git a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java index d0d81552ff5..ab83a9d5f05 100644 --- a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java +++ b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java @@ -43,9 +43,9 @@ public class SystemNavigationPreferenceController extends BasePreferenceControll @Override public CharSequence getSummary() { - if (isEdgeToEdgeEnabled(mContext)) { + if (isGestureNavigationEnabled(mContext)) { return mContext.getText(R.string.edge_to_edge_navigation_title); - } else if (isSwipeUpEnabled(mContext)) { + } else if (is2ButtonNavigationEnabled(mContext)) { return mContext.getText(R.string.swipe_up_to_switch_apps_title); } else { return mContext.getText(R.string.legacy_navigation_title); @@ -86,15 +86,12 @@ public class SystemNavigationPreferenceController extends BasePreferenceControll } } - static boolean isSwipeUpEnabled(Context context) { - if (isEdgeToEdgeEnabled(context)) { - return false; - } + static boolean is2ButtonNavigationEnabled(Context context) { return NAV_BAR_MODE_2BUTTON == context.getResources().getInteger( com.android.internal.R.integer.config_navBarInteractionMode); } - static boolean isEdgeToEdgeEnabled(Context context) { + static boolean isGestureNavigationEnabled(Context context) { return NAV_BAR_MODE_GESTURAL == context.getResources().getInteger( com.android.internal.R.integer.config_navBarInteractionMode); } diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java index 3163f9ab801..48cf4b31bcf 100644 --- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java @@ -137,30 +137,36 @@ public class SystemNavigationPreferenceControllerTest { public void testIsSwipeUpEnabled() { SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode, NAV_BAR_MODE_2BUTTON); - assertThat(SystemNavigationPreferenceController.isSwipeUpEnabled(mContext)).isTrue(); + assertThat(SystemNavigationPreferenceController.is2ButtonNavigationEnabled( + mContext)).isTrue(); SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode, NAV_BAR_MODE_3BUTTON); - assertThat(SystemNavigationPreferenceController.isSwipeUpEnabled(mContext)).isFalse(); + assertThat(SystemNavigationPreferenceController.is2ButtonNavigationEnabled( + mContext)).isFalse(); SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode, NAV_BAR_MODE_GESTURAL); - assertThat(SystemNavigationPreferenceController.isSwipeUpEnabled(mContext)).isFalse(); + assertThat(SystemNavigationPreferenceController.is2ButtonNavigationEnabled( + mContext)).isFalse(); } @Test public void testIsEdgeToEdgeEnabled() { SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode, NAV_BAR_MODE_GESTURAL); - assertThat(SystemNavigationPreferenceController.isEdgeToEdgeEnabled(mContext)).isTrue(); + assertThat(SystemNavigationPreferenceController.isGestureNavigationEnabled( + mContext)).isTrue(); SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode, NAV_BAR_MODE_3BUTTON); - assertThat(SystemNavigationPreferenceController.isEdgeToEdgeEnabled(mContext)).isFalse(); + assertThat(SystemNavigationPreferenceController.isGestureNavigationEnabled( + mContext)).isFalse(); SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode, NAV_BAR_MODE_2BUTTON); - assertThat(SystemNavigationPreferenceController.isEdgeToEdgeEnabled(mContext)).isFalse(); + assertThat(SystemNavigationPreferenceController.isGestureNavigationEnabled( + mContext)).isFalse(); } @Test