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:
@@ -34,6 +34,10 @@ public class AmbientDisplayConfiguration {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean pulseOnPickupCanBeModified(int user) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean pulseOnDoubleTapAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user