LPP will now always launch either GlobalActions or the Assistant.

Previously, on devices that default to launching Assistant
on long-press power, toggling this checkbox in Settings
would switch between that default (launching Assistant) and
a no-op. Those devices now toggle between Assistant and
GlobalActions (the power menu), just like devices that have
the old default behavior of LPP launching GlobalActions.

Change-Id: Id36031e70825da195f9c30ce05b3ae3d5e49b5fb
Test: make RunSettingsRoboTests \
	ROBOTEST_FILTER=LongPressPowerButtonPreferenceControllerTest
Bug: 192946325
This commit is contained in:
Daniel Sandler
2021-08-18 00:22:22 +00:00
committed by Dan Sandler
parent cee3e9bfce
commit 509670cb0d
2 changed files with 10 additions and 9 deletions

View File

@@ -199,7 +199,7 @@ public class LongPressPowerButtonPreferenceControllerTest {
@Test
public void preferenceUnchecked_assistDefault_setNoAction() {
// Value out of range chosen deliberately.
// Ensure that the Assistant is the default behavior for LPP.
when(mResources.getInteger(
com.android.internal.R.integer.config_longPressOnPowerBehavior))
.thenReturn(
@@ -209,13 +209,12 @@ public class LongPressPowerButtonPreferenceControllerTest {
assertThat(Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.POWER_BUTTON_LONG_PRESS, -1)).isEqualTo(
LongPressPowerButtonPreferenceController.LONG_PRESS_POWER_NO_ACTION);
LongPressPowerButtonPreferenceController.LONG_PRESS_POWER_GLOBAL_ACTIONS);
assertThat(Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.KEY_CHORD_POWER_VOLUME_UP, -1)).isEqualTo(
LongPressPowerButtonPreferenceController.KEY_CHORD_POWER_VOLUME_UP_NO_ACTION);
verify(mController.mAssistSwitch).setSummary(
getString(
R.string.power_menu_summary_long_press_for_assist_disabled_no_action));
verify(mController.mAssistSwitch).setSummary(getString(
R.string.power_menu_summary_long_press_for_assist_disabled_with_power_menu));
}
private String getString(@StringRes int id) {