Disable lift-to-wake when always-on is checked

The setting has little to no meaning when AOD is on.

Test: make
ROBOTEST_FILTER=AmbientDisplayAlwaysOnPreferenceControllerTest
RunSettingsRoboTests -j
Bug:62391405
Change-Id:If5492227755ca81ec0bcf921a81e2bfd33a85b9c
This commit is contained in:
Geoffrey Pitsch
2017-07-10 10:30:05 -04:00
parent e70a06a5d5
commit 8d973761ad
7 changed files with 56 additions and 6 deletions

View File

@@ -34,6 +34,10 @@ public class AmbientDisplayConfiguration {
return true;
}
public boolean pulseOnPickupCanBeModified(int user) {
return true;
}
public boolean pulseOnDoubleTapAvailable() {
return true;
}

View File

@@ -48,11 +48,13 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {
@Mock SwitchPreference mSwitchPreference;
AmbientDisplayAlwaysOnPreferenceController mController;
boolean mCallbackInvoked;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mController = new AmbientDisplayAlwaysOnPreferenceController(mContext, mConfig);
mController = new AmbientDisplayAlwaysOnPreferenceController(mContext, mConfig,
() -> { mCallbackInvoked = true; });
}
@Test
@@ -75,6 +77,13 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {
verify(mSwitchPreference).setChecked(false);
}
@Test
public void onPreferenceChange_callback() throws Exception {
assertThat(mCallbackInvoked).isFalse();
mController.onPreferenceChange(mSwitchPreference, true);
assertThat(mCallbackInvoked).isTrue();
}
@Test
public void onPreferenceChange_enable() throws Exception {
mController.onPreferenceChange(mSwitchPreference, true);

View File

@@ -83,4 +83,18 @@ public class PIckupGesturePreferenceControllerTest {
assertThat(mController.isSwitchPrefEnabled()).isFalse();
}
@Test
public void testCanHandleClicks_configIsSet_shouldReturnTrue() {
when(mAmbientDisplayConfiguration.pulseOnPickupCanBeModified(anyInt())).thenReturn(true);
assertThat(mController.canHandleClicks()).isTrue();
}
@Test
public void testCanHandleClicks_configIsNotSet_shouldReturnFalse() {
when(mAmbientDisplayConfiguration.pulseOnPickupCanBeModified(anyInt())).thenReturn(false);
assertThat(mController.canHandleClicks()).isFalse();
}
}