Merge "Always enable double tap and pick up gestures"
This commit is contained in:
committed by
Android (Google) Code Review
commit
03b578f557
@@ -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);
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user