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

Commit 1123ba31 authored by Andy Wickham's avatar Andy Wickham
Browse files

Gesture-excluding activities also exclude Assistant gesture.

Bug: 157824552
Change-Id: Ie324ed86c8d7694fed263840975c02e676533ad1
parent 6eac5722
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYS
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED;

import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.PendingIntent;
import android.app.RemoteAction;
import android.app.Service;
@@ -487,13 +488,13 @@ public class TouchInteractionService extends Service implements PluginListener<O

                ActiveGestureLog.INSTANCE.addLog("setInputConsumer: " + mConsumer.getName());
                mUncheckedConsumer = mConsumer;
            } else if (mDeviceState.isUserUnlocked()
                    && mDeviceState.isFullyGesturalNavMode()
                    && mDeviceState.canTriggerAssistantAction(event)) {
            } else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode()) {
                newGestureState = createGestureState();
                // Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we should
                // not interrupt it. QuickSwitch assumes that interruption can only happen if the
                // next gesture is also quick switch.
                ActivityManager.RunningTaskInfo runningTask = newGestureState.getRunningTask();
                if (mDeviceState.canTriggerAssistantAction(event, runningTask)) {
                    // Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we
                    // should not interrupt it. QuickSwitch assumes that interruption can only
                    // happen if the next gesture is also quick switch.
                    mUncheckedConsumer = new AssistantInputConsumer(
                            this,
                            newGestureState,
@@ -503,6 +504,10 @@ public class TouchInteractionService extends Service implements PluginListener<O
                    newGestureState = DEFAULT_STATE;
                    mUncheckedConsumer = InputConsumer.NO_OP;
                }
            } else {
                newGestureState = DEFAULT_STATE;
                mUncheckedConsumer = InputConsumer.NO_OP;
            }

            // Save the current gesture state
            mGestureState = newGestureState;
@@ -572,7 +577,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
            handleOrientationSetup(base);
        }
        if (mDeviceState.isFullyGesturalNavMode()) {
            if (mDeviceState.canTriggerAssistantAction(event)) {
            if (mDeviceState.canTriggerAssistantAction(event, newGestureState.getRunningTask())) {
                base = new AssistantInputConsumer(
                    this,
                    newGestureState,
+5 −3
Original line number Diff line number Diff line
@@ -525,13 +525,15 @@ public class RecentsAnimationDeviceState implements

    /**
     * @param ev An ACTION_DOWN motion event
     * @return whether the given motion event can trigger the assistant.
     * @param task Info for the currently running task
     * @return whether the given motion event can trigger the assistant over the current task.
     */
    public boolean canTriggerAssistantAction(MotionEvent ev) {
    public boolean canTriggerAssistantAction(MotionEvent ev, ActivityManager.RunningTaskInfo task) {
        return mAssistantAvailable
                && !QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags)
                && mOrientationTouchTransformer.touchInAssistantRegion(ev)
                && !isLockToAppActive();
                && !isLockToAppActive()
                && !isGestureBlockedActivity(task);
    }

    /**