Loading res/values/strings.xml +4 −4 Original line number Diff line number Diff line Loading @@ -9601,7 +9601,7 @@ <string name="ambient_display_title" product="device">Double-tap to check device</string> <!-- Summary text for ambient display double tap [CHAR LIMIT=NONE]--> <string name="ambient_display_summary">To check time, notification icons, and other info, double-tap your screen.</string> <string name="ambient_display_summary">To check time, notifications, and other info, double-tap your screen.</string> <!-- Preference and settings suggestion title text for ambient display pick up (phone) [CHAR LIMIT=60]--> <string name="ambient_display_pickup_title" product="default">Lift to check phone</string> Loading @@ -9611,11 +9611,11 @@ <string name="ambient_display_pickup_title" product="device">Lift to check device</string> <!-- Summary text for ambient display (phone) [CHAR LIMIT=NONE]--> <string name="ambient_display_pickup_summary" product="default">To check time, notification icons, and other info, pick up your phone.</string> <string name="ambient_display_pickup_summary" product="default">To check time, notifications, and other info, pick up your phone.</string> <!-- Summary text for ambient display (tablet) [CHAR LIMIT=NONE]--> <string name="ambient_display_pickup_summary" product="tablet">To check time, notification icons, and other info, pick up your tablet.</string> <string name="ambient_display_pickup_summary" product="tablet">To check time, notifications, and other info, pick up your tablet.</string> <!-- Summary text for ambient display (device) [CHAR LIMIT=NONE]--> <string name="ambient_display_pickup_summary" product="device">To check time, notification icons, and other info, pick up your device.</string> <string name="ambient_display_pickup_summary" product="device">To check time, notifications, and other info, pick up your device.</string> <!-- Title text for swiping downwards on fingerprint sensor for notifications [CHAR LIMIT=80]--> <string name="fingerprint_swipe_for_notifications_title">Swipe fingerprint for notifications</string> src/com/android/settings/gestures/DoubleTapScreenPreferenceController.java +4 −14 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading @@ -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); } Loading @@ -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; } Loading @@ -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() { Loading src/com/android/settings/gestures/PickupGesturePreferenceController.java +5 −20 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading @@ -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; } Loading @@ -87,7 +82,7 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll @Override public boolean isChecked() { return getAmbientConfig().pulseOnPickupEnabled(mUserId); return getAmbientConfig().pickupGestureEnabled(mUserId); } @Override Loading @@ -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); Loading tests/robotests/src/com/android/settings/gestures/DoubleTapScreenPreferenceControllerTest.java +4 −26 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 = Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading tests/robotests/src/com/android/settings/gestures/PickupGesturePreferenceControllerTest.java +4 −30 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading @@ -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); Loading @@ -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(); Loading Loading
res/values/strings.xml +4 −4 Original line number Diff line number Diff line Loading @@ -9601,7 +9601,7 @@ <string name="ambient_display_title" product="device">Double-tap to check device</string> <!-- Summary text for ambient display double tap [CHAR LIMIT=NONE]--> <string name="ambient_display_summary">To check time, notification icons, and other info, double-tap your screen.</string> <string name="ambient_display_summary">To check time, notifications, and other info, double-tap your screen.</string> <!-- Preference and settings suggestion title text for ambient display pick up (phone) [CHAR LIMIT=60]--> <string name="ambient_display_pickup_title" product="default">Lift to check phone</string> Loading @@ -9611,11 +9611,11 @@ <string name="ambient_display_pickup_title" product="device">Lift to check device</string> <!-- Summary text for ambient display (phone) [CHAR LIMIT=NONE]--> <string name="ambient_display_pickup_summary" product="default">To check time, notification icons, and other info, pick up your phone.</string> <string name="ambient_display_pickup_summary" product="default">To check time, notifications, and other info, pick up your phone.</string> <!-- Summary text for ambient display (tablet) [CHAR LIMIT=NONE]--> <string name="ambient_display_pickup_summary" product="tablet">To check time, notification icons, and other info, pick up your tablet.</string> <string name="ambient_display_pickup_summary" product="tablet">To check time, notifications, and other info, pick up your tablet.</string> <!-- Summary text for ambient display (device) [CHAR LIMIT=NONE]--> <string name="ambient_display_pickup_summary" product="device">To check time, notification icons, and other info, pick up your device.</string> <string name="ambient_display_pickup_summary" product="device">To check time, notifications, and other info, pick up your device.</string> <!-- Title text for swiping downwards on fingerprint sensor for notifications [CHAR LIMIT=80]--> <string name="fingerprint_swipe_for_notifications_title">Swipe fingerprint for notifications</string>
src/com/android/settings/gestures/DoubleTapScreenPreferenceController.java +4 −14 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading @@ -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); } Loading @@ -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; } Loading @@ -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() { Loading
src/com/android/settings/gestures/PickupGesturePreferenceController.java +5 −20 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading @@ -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; } Loading @@ -87,7 +82,7 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll @Override public boolean isChecked() { return getAmbientConfig().pulseOnPickupEnabled(mUserId); return getAmbientConfig().pickupGestureEnabled(mUserId); } @Override Loading @@ -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); Loading
tests/robotests/src/com/android/settings/gestures/DoubleTapScreenPreferenceControllerTest.java +4 −26 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 = Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading
tests/robotests/src/com/android/settings/gestures/PickupGesturePreferenceControllerTest.java +4 −30 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading @@ -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); Loading @@ -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(); Loading