diff --git a/res/values/strings.xml b/res/values/strings.xml index df98e0e424f..2174d905ddd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9601,7 +9601,7 @@ Double-tap to check device - To check time, notification icons, and other info, double-tap your screen. + To check time, notifications, and other info, double-tap your screen. Lift to check phone @@ -9611,11 +9611,11 @@ Lift to check device - To check time, notification icons, and other info, pick up your phone. + To check time, notifications, and other info, pick up your phone. - To check time, notification icons, and other info, pick up your tablet. + To check time, notifications, and other info, pick up your tablet. - To check time, notification icons, and other info, pick up your device. + To check time, notifications, and other info, pick up your device. Swipe fingerprint for notifications diff --git a/src/com/android/settings/gestures/DoubleTapScreenPreferenceController.java b/src/com/android/settings/gestures/DoubleTapScreenPreferenceController.java index 04bdedcccef..4a2357024c3 100644 --- a/src/com/android/settings/gestures/DoubleTapScreenPreferenceController.java +++ b/src/com/android/settings/gestures/DoubleTapScreenPreferenceController.java @@ -16,7 +16,7 @@ package com.android.settings.gestures; -import static android.provider.Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP; +import static android.provider.Settings.Secure.DOZE_DOUBLE_TAP_GESTURE; import android.annotation.UserIdInt; import android.content.Context; @@ -36,7 +36,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro private static final String PREF_KEY_VIDEO = "gesture_double_tap_screen_video"; - private final String SECURE_KEY = DOZE_PULSE_ON_DOUBLE_TAP; + private final String SECURE_KEY = DOZE_DOUBLE_TAP_GESTURE; private AmbientDisplayConfiguration mAmbientConfig; @UserIdInt @@ -59,7 +59,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro @VisibleForTesting static boolean isSuggestionComplete(AmbientDisplayConfiguration config, SharedPreferences prefs) { - return !config.pulseOnDoubleTapAvailable() + return !config.doubleTapSensorAvailable() || prefs.getBoolean(DoubleTapScreenSettings.PREF_KEY_SUGGESTION_COMPLETE, false); } @@ -70,11 +70,6 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro return UNSUPPORTED_ON_DEVICE; } - // Can't change Double Tap when AOD is enabled. - if (!getAmbientConfig().ambientDisplayAvailable()) { - return DISABLED_DEPENDENT_SETTING; - } - return AVAILABLE; } @@ -96,12 +91,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro @Override public boolean isChecked() { - return getAmbientConfig().pulseOnDoubleTapEnabled(mUserId); - } - - @Override - protected boolean canHandleClicks() { - return !getAmbientConfig().alwaysOnEnabled(mUserId); + return getAmbientConfig().doubleTapGestureEnabled(mUserId); } private AmbientDisplayConfiguration getAmbientConfig() { diff --git a/src/com/android/settings/gestures/PickupGesturePreferenceController.java b/src/com/android/settings/gestures/PickupGesturePreferenceController.java index 53a4447cbe0..7460183bda0 100644 --- a/src/com/android/settings/gestures/PickupGesturePreferenceController.java +++ b/src/com/android/settings/gestures/PickupGesturePreferenceController.java @@ -16,7 +16,7 @@ package com.android.settings.gestures; -import static android.provider.Settings.Secure.DOZE_PULSE_ON_PICK_UP; +import static android.provider.Settings.Secure.DOZE_PICK_UP_GESTURE; import android.annotation.UserIdInt; import android.content.Context; @@ -37,7 +37,7 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll private static final String PREF_KEY_VIDEO = "gesture_pick_up_video"; private final String mPickUpPrefKey; - private final String SECURE_KEY = DOZE_PULSE_ON_PICK_UP; + private final String SECURE_KEY = DOZE_PICK_UP_GESTURE; private AmbientDisplayConfiguration mAmbientConfig; @UserIdInt @@ -57,21 +57,16 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) { AmbientDisplayConfiguration ambientConfig = new AmbientDisplayConfiguration(context); return prefs.getBoolean(PickupGestureSettings.PREF_KEY_SUGGESTION_COMPLETE, false) - || !ambientConfig.pulseOnPickupAvailable(); + || !ambientConfig.dozePickupSensorAvailable(); } @Override public int getAvailabilityStatus() { // No hardware support for Pickup Gesture - if (!getAmbientConfig().dozePulsePickupSensorAvailable()) { + if (!getAmbientConfig().dozePickupSensorAvailable()) { return UNSUPPORTED_ON_DEVICE; } - // Can't change Pickup Gesture when AOD is enabled. - if (!getAmbientConfig().ambientDisplayAvailable()) { - return DISABLED_DEPENDENT_SETTING; - } - return AVAILABLE; } @@ -87,7 +82,7 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll @Override public boolean isChecked() { - return getAmbientConfig().pulseOnPickupEnabled(mUserId); + return getAmbientConfig().pickupGestureEnabled(mUserId); } @Override @@ -101,16 +96,6 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll isChecked ? ON : OFF); } - @Override - public boolean canHandleClicks() { - return pulseOnPickupCanBeModified(); - } - - @VisibleForTesting - boolean pulseOnPickupCanBeModified() { - return getAmbientConfig().pulseOnPickupCanBeModified(mUserId); - } - private AmbientDisplayConfiguration getAmbientConfig() { if (mAmbientConfig == null) { mAmbientConfig = new AmbientDisplayConfiguration(mContext); diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapScreenPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapScreenPreferenceControllerTest.java index a36dbf7dcc7..654d9b64f63 100644 --- a/tests/robotests/src/com/android/settings/gestures/DoubleTapScreenPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapScreenPreferenceControllerTest.java @@ -17,7 +17,6 @@ package com.android.settings.gestures; import static com.android.settings.core.BasePreferenceController.AVAILABLE; -import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING; import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.anyInt; @@ -59,21 +58,21 @@ public class DoubleTapScreenPreferenceControllerTest { @Test public void testIsChecked_configIsSet_shouldReturnTrue() { // Set the setting to be enabled. - when(mAmbientDisplayConfiguration.pulseOnDoubleTapEnabled(anyInt())).thenReturn(true); + when(mAmbientDisplayConfiguration.doubleTapGestureEnabled(anyInt())).thenReturn(true); assertThat(mController.isChecked()).isTrue(); } @Test public void testIsChecked_configIsNotSet_shouldReturnFalse() { - when(mAmbientDisplayConfiguration.pulseOnDoubleTapEnabled(anyInt())).thenReturn(false); + when(mAmbientDisplayConfiguration.doubleTapGestureEnabled(anyInt())).thenReturn(false); assertThat(mController.isChecked()).isFalse(); } @Test public void isSuggestionCompleted_ambientDisplay_falseWhenNotVisited() { - when(mAmbientDisplayConfiguration.pulseOnDoubleTapAvailable()).thenReturn(true); + when(mAmbientDisplayConfiguration.doubleTapSensorAvailable()).thenReturn(true); // No stored value in shared preferences if not visited yet. final Context context = RuntimeEnvironment.application; final SharedPreferences prefs = @@ -85,7 +84,7 @@ public class DoubleTapScreenPreferenceControllerTest { @Test public void isSuggestionCompleted_ambientDisplay_trueWhenVisited() { - when(mAmbientDisplayConfiguration.pulseOnDoubleTapAvailable()).thenReturn(false); + when(mAmbientDisplayConfiguration.doubleTapSensorAvailable()).thenReturn(false); final Context context = RuntimeEnvironment.application; final SharedPreferences prefs = new SuggestionFeatureProviderImpl(context).getSharedPrefs(context); @@ -97,18 +96,6 @@ public class DoubleTapScreenPreferenceControllerTest { .isSuggestionComplete(mAmbientDisplayConfiguration, prefs)).isTrue(); } - @Test - public void canHandleClicks_falseWhenAlwaysOnEnabled() { - when(mAmbientDisplayConfiguration.alwaysOnEnabled(anyInt())).thenReturn(true); - assertThat(mController.canHandleClicks()).isFalse(); - } - - @Test - public void canHandleClicks_trueWhenAlwaysOnDisabled() { - when(mAmbientDisplayConfiguration.alwaysOnEnabled(anyInt())).thenReturn(false); - assertThat(mController.canHandleClicks()).isTrue(); - } - @Test public void getAvailabilityStatus_aodNotSupported_UNSUPPORTED_ON_DEVICE() { when(mAmbientDisplayConfiguration.doubleTapSensorAvailable()).thenReturn(false); @@ -118,15 +105,6 @@ public class DoubleTapScreenPreferenceControllerTest { assertThat(availabilityStatus).isEqualTo(UNSUPPORTED_ON_DEVICE); } - @Test - public void getAvailabilityStatus_aodOn_DISABLED_DEPENDENT_SETTING() { - when(mAmbientDisplayConfiguration.doubleTapSensorAvailable()).thenReturn(true); - when(mAmbientDisplayConfiguration.ambientDisplayAvailable()).thenReturn(false); - final int availabilityStatus = mController.getAvailabilityStatus(); - - assertThat(availabilityStatus).isEqualTo(DISABLED_DEPENDENT_SETTING); - } - @Test public void getAvailabilityStatus_aodSupported_aodOff_AVAILABLE() { when(mAmbientDisplayConfiguration.doubleTapSensorAvailable()).thenReturn(true); diff --git a/tests/robotests/src/com/android/settings/gestures/PickupGesturePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/PickupGesturePreferenceControllerTest.java index af0146bc8ce..17fa7cd308f 100644 --- a/tests/robotests/src/com/android/settings/gestures/PickupGesturePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/gestures/PickupGesturePreferenceControllerTest.java @@ -17,7 +17,6 @@ package com.android.settings.gestures; import static com.android.settings.core.BasePreferenceController.AVAILABLE; -import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING; import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.anyInt; @@ -62,7 +61,7 @@ public class PickupGesturePreferenceControllerTest { @Test public void testIsChecked_configIsSet_shouldReturnTrue() { // Set the setting to be enabled. - when(mAmbientDisplayConfiguration.pulseOnPickupEnabled(anyInt())).thenReturn(true); + when(mAmbientDisplayConfiguration.pickupGestureEnabled(anyInt())).thenReturn(true); assertThat(mController.isChecked()).isTrue(); } @@ -70,27 +69,11 @@ public class PickupGesturePreferenceControllerTest { @Test public void testIsChecked_configIsNotSet_shouldReturnFalse() { // Set the setting to be disabled. - when(mAmbientDisplayConfiguration.pulseOnPickupEnabled(anyInt())).thenReturn(false); + when(mAmbientDisplayConfiguration.pickupGestureEnabled(anyInt())).thenReturn(false); assertThat(mController.isChecked()).isFalse(); } - @Test - public void testCanHandleClicks_configIsSet_shouldReturnTrue() { - mController = spy(mController); - doReturn(true).when(mController).pulseOnPickupCanBeModified(); - - assertThat(mController.canHandleClicks()).isTrue(); - } - - @Test - public void testCanHandleClicks_configIsNotSet_shouldReturnFalse() { - mController = spy(mController); - doReturn(false).when(mController).pulseOnPickupCanBeModified(); - - assertThat(mController.canHandleClicks()).isFalse(); - } - @Test public void isSuggestionCompleted_ambientDisplayPickup_trueWhenVisited() { when(mContext.getResources().getBoolean(anyInt())).thenReturn(true); @@ -106,25 +89,16 @@ public class PickupGesturePreferenceControllerTest { @Test public void getAvailabilityStatus_aodNotSupported_UNSUPPORTED_ON_DEVICE() { - when(mAmbientDisplayConfiguration.dozePulsePickupSensorAvailable()).thenReturn(false); + when(mAmbientDisplayConfiguration.dozePickupSensorAvailable()).thenReturn(false); when(mAmbientDisplayConfiguration.ambientDisplayAvailable()).thenReturn(false); final int availabilityStatus = mController.getAvailabilityStatus(); assertThat(availabilityStatus).isEqualTo(UNSUPPORTED_ON_DEVICE); } - @Test - public void getAvailabilityStatus_aodOn_DISABLED_DEPENDENT_SETTING() { - when(mAmbientDisplayConfiguration.dozePulsePickupSensorAvailable()).thenReturn(true); - when(mAmbientDisplayConfiguration.ambientDisplayAvailable()).thenReturn(false); - final int availabilityStatus = mController.getAvailabilityStatus(); - - assertThat(availabilityStatus).isEqualTo(DISABLED_DEPENDENT_SETTING); - } - @Test public void getAvailabilityStatus_aodSupported_aodOff_AVAILABLE() { - when(mAmbientDisplayConfiguration.dozePulsePickupSensorAvailable()).thenReturn(true); + when(mAmbientDisplayConfiguration.dozePickupSensorAvailable()).thenReturn(true); when(mAmbientDisplayConfiguration.ambientDisplayAvailable()).thenReturn(true); final int availabilityStatus = mController.getAvailabilityStatus();