Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit faa68671 authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

Fallback to global actions if assistant is not available

Change-Id: I8c5c34f8b29967eace022ab3eed035b1e68efcb6
parent de93ef49
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -648,6 +648,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    private int mCurrentUserId;

    private AssistUtils mAssistUtils;

    // Maps global key codes to the components that will handle them.
    private GlobalKeyManager mGlobalKeyManager;

@@ -1357,6 +1359,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    private boolean hasAssistant() {
        return mAssistUtils.getAssistComponentForUser(mCurrentUserId) != null;
    }

    private int getResolvedLongPressOnPowerBehavior() {
        if (FactoryTest.isLongPressOnPowerOffEnabled()) {
            return LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM;
@@ -1364,7 +1370,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        // 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()) {
        if (mLongPressOnPowerBehavior == LONG_PRESS_POWER_ASSISTANT &&
                (!isDeviceProvisioned() || !hasAssistant())) {
            return LONG_PRESS_POWER_GLOBAL_ACTIONS;
        }

@@ -2242,6 +2249,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mSafeModeEnabledVibePattern = getLongIntArray(mContext.getResources(),
                com.android.internal.R.array.config_safeModeEnabledVibePattern);

        mAssistUtils = new AssistUtils(mContext);

        mGlobalKeyManager = new GlobalKeyManager(mContext);

        // Controls rotation and the like.