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

Unverified Commit 633d60e7 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 bb304dd2
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -734,6 +734,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;

@@ -1620,6 +1622,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;
@@ -1627,7 +1633,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;
        }

@@ -2543,6 +2550,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);

        mAssistUtils = new AssistUtils(mContext);

        mGlobalKeyManager = new GlobalKeyManager(mContext);

        // Controls rotation and the like.