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

@@ -179,16 +179,18 @@ public class LongPressPowerButtonPreferenceController extends TogglePreferenceCo
POWER_BUTTON_LONG_PRESS_SETTING, LONG_PRESS_POWER_ASSISTANT_VALUE);
}
// We need to determine the right disabled value - we set it to device default
// if it's different than Assist, otherwise we fallback to either global actions or power
// menu.
// We need to determine the right disabled value based on the device default
// for long-press power.
// If the default is to start the assistant, then the fallback is GlobalActions.
final int defaultPowerButtonValue = mContext.getResources().getInteger(
POWER_BUTTON_LONG_PRESS_DEFAULT_VALUE_RESOURCE);
if (defaultPowerButtonValue == LONG_PRESS_POWER_ASSISTANT_VALUE) {
return Settings.Global.putInt(mContext.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING, LONG_PRESS_POWER_NO_ACTION);
POWER_BUTTON_LONG_PRESS_SETTING, LONG_PRESS_POWER_GLOBAL_ACTIONS);
}
// If the default is something different than Assist, we use that default.
return Settings.Global.putInt(mContext.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING, defaultPowerButtonValue);
}