From 5d85ba60a661344d5b3ce244ac8e5e39329831d8 Mon Sep 17 00:00:00 2001 From: Matt Casey Date: Fri, 11 Jun 2021 12:26:45 -0400 Subject: [PATCH] Show global actions instead of assistant for LPP in setup wizard Assistant can't be opened during device setup, and new users may not know how to get to the power menu if LPP is assigned to the assistant, so this ensures they can find a way to turn off or reboot the device. Bug: 190432896 Test: Ensure LPP is configured to start the assistant. Then, adb shell settings put global device_provisioned 0 and LPP should open global actions, then adb shell settings put global device_provisioned 1 and it should be the assistant again. Test: Also test using the actual setup wizard flow. Change-Id: Ida693297a03d0eda08b557078868de77f3902e2d --- .../java/com/android/server/policy/PhoneWindowManager.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index f3b8c7e3e209f..a2421355e8685 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -1181,6 +1181,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (FactoryTest.isLongPressOnPowerOffEnabled()) { return LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM; } + + // If the config indicates the assistant behavior but the device isn't yet provisioned, show + // global actions instead. + if (mLongPressOnPowerBehavior == LONG_PRESS_POWER_ASSISTANT && !isDeviceProvisioned()) { + return LONG_PRESS_POWER_GLOBAL_ACTIONS; + } + return mLongPressOnPowerBehavior; }