Always enable double tap and pick up gestures

Both gestures should also work when AOD is on.

Test: make RunSettingsRoboTests ROBOTEST_FILTER=DoubleTapScreenPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=PickupGesturePreferenceControllerTest
Test: manual
Bug: 111414690
Change-Id: I6552b6b6581a942dbc54f5320dda102c2ac62517
This commit is contained in:
Lucas Dupin
2018-08-09 17:05:45 -07:00
parent 06c9bd2cdb
commit 3f773b3be3
5 changed files with 21 additions and 94 deletions

View File

@@ -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();