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

Commit 09398bf1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Refactoring OverviewCommandHelper (1/3)" into main

parents 380f11e9 e7ae4e31
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
import static com.android.quickstep.OverviewCommandHelper.TYPE_HIDE;


import android.content.Intent;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.BitmapDrawable;
@@ -40,6 +39,7 @@ import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.quickstep.OverviewCommandHelper;
import com.android.quickstep.OverviewCommandHelper;
import com.android.quickstep.OverviewCommandHelper.CommandType;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;
@@ -394,7 +394,7 @@ public class TaskbarUIController {
        if (overviewCommandHelper == null) {
        if (overviewCommandHelper == null) {
            return;
            return;
        }
        }
        overviewCommandHelper.addCommand(TYPE_HIDE);
        overviewCommandHelper.addCommand(CommandType.HIDE);
    }
    }


    /**
    /**
+110 −112
Original line number Original line Diff line number Diff line
@@ -33,6 +33,8 @@ import com.android.launcher3.logging.StatsLogManager
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.*
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.*
import com.android.launcher3.util.Executors
import com.android.launcher3.util.Executors
import com.android.launcher3.util.RunnableList
import com.android.launcher3.util.RunnableList
import com.android.quickstep.OverviewCommandHelper.CommandInfo.CommandStatus
import com.android.quickstep.OverviewCommandHelper.CommandType.*
import com.android.quickstep.util.ActiveGestureLog
import com.android.quickstep.util.ActiveGestureLog
import com.android.quickstep.views.RecentsView
import com.android.quickstep.views.RecentsView
import com.android.quickstep.views.RecentsViewContainer
import com.android.quickstep.views.RecentsViewContainer
@@ -40,6 +42,7 @@ import com.android.quickstep.views.TaskView
import com.android.systemui.shared.recents.model.ThumbnailData
import com.android.systemui.shared.recents.model.ThumbnailData
import com.android.systemui.shared.system.InteractionJankMonitorWrapper
import com.android.systemui.shared.system.InteractionJankMonitorWrapper
import java.io.PrintWriter
import java.io.PrintWriter
import java.util.concurrent.ConcurrentLinkedDeque


/** Helper class to handle various atomic commands for switching between Overview. */
/** Helper class to handle various atomic commands for switching between Overview. */
class OverviewCommandHelper(
class OverviewCommandHelper(
@@ -47,7 +50,7 @@ class OverviewCommandHelper(
    private val overviewComponentObserver: OverviewComponentObserver,
    private val overviewComponentObserver: OverviewComponentObserver,
    private val taskAnimationManager: TaskAnimationManager
    private val taskAnimationManager: TaskAnimationManager
) {
) {
    private val pendingCommands = mutableListOf<CommandInfo>()
    private val commandQueue = ConcurrentLinkedDeque<CommandInfo>()


    /**
    /**
     * Index of the TaskView that should be focused when launching Overview. Persisted so that we do
     * Index of the TaskView that should be focused when launching Overview. Persisted so that we do
@@ -64,22 +67,26 @@ class OverviewCommandHelper(
     */
     */
    private var waitForToggleCommandComplete = false
    private var waitForToggleCommandComplete = false


    private val activityInterface: BaseActivityInterface<*, *>
        get() = overviewComponentObserver.activityInterface

    private val visibleRecentsView: RecentsView<*, *>?
        get() = activityInterface.getVisibleRecentsView<RecentsView<*, *>>()

    /** Called when the command finishes execution. */
    /** Called when the command finishes execution. */
    private fun scheduleNextTask(command: CommandInfo) {
    private fun onCommandFinished(command: CommandInfo) {
        if (pendingCommands.isEmpty()) {
        command.status = CommandStatus.COMPLETED
            Log.d(TAG, "no pending commands to schedule")
        if (commandQueue.first() !== command) {
            return
        }
        if (pendingCommands.first() !== command) {
            Log.d(
            Log.d(
                TAG,
                TAG,
                "next task not scheduled. First pending command type " +
                "next task not scheduled. First pending command type " +
                    "is ${pendingCommands.first()} - command type is: $command"
                    "is ${commandQueue.first()} - command type is: $command"
            )
            )
            return
            return
        }
        }
        Log.d(TAG, "scheduleNextTask called: $command")

        pendingCommands.removeFirst()
        Log.d(TAG, "command executed successfully! $command")
        commandQueue.remove(command)
        executeNext()
        executeNext()
    }
    }


@@ -90,24 +97,21 @@ class OverviewCommandHelper(
     */
     */
    @UiThread
    @UiThread
    private fun executeNext() {
    private fun executeNext() {
        if (pendingCommands.isEmpty()) {
        val command: CommandInfo =
            Log.d(TAG, "executeNext - pendingCommands is empty")
            commandQueue.firstOrNull()
                ?: run {
                    Log.d(TAG, "no pending commands to be executed.")
                    return
                    return
                }
                }
        val command = pendingCommands.first()

        Log.d(TAG, "executing command: $command")
        val result = executeCommand(command)
        val result = executeCommand(command)
        Log.d(TAG, "executeNext command type: $command, result: $result")
        if (result) {
            scheduleNextTask(command)
        }
    }


    @UiThread
        Log.d(TAG, "command executed: $command with result: $result")
    private fun addCommand(command: CommandInfo) {
        if (result) {
        val wasEmpty = pendingCommands.isEmpty()
            onCommandFinished(command)
        pendingCommands.add(command)
        } else {
        if (wasEmpty) {
            Log.d(TAG, "waiting for command callback: $command")
            executeNext()
        }
        }
    }
    }


@@ -117,29 +121,29 @@ class OverviewCommandHelper(
     * dropped.
     * dropped.
     */
     */
    @BinderThread
    @BinderThread
    fun addCommand(type: Int) {
    fun addCommand(type: CommandType) {
        if (pendingCommands.size >= MAX_QUEUE_SIZE) {
        if (commandQueue.size >= MAX_QUEUE_SIZE) {
            Log.d(
            Log.d(TAG, "commands queue is full ($commandQueue). command not added: $type")
                TAG,
                "the pending command queue is full (${pendingCommands.size}). command not added: $type"
            )
            return
            return
        }
        }
        Log.d(TAG, "adding command type: $type")

        val command = CommandInfo(type)
        val command = CommandInfo(type)
        Executors.MAIN_EXECUTOR.execute { addCommand(command) }
        commandQueue.add(command)
        Log.d(TAG, "command added: $command")

        if (commandQueue.size == 1) {
            Executors.MAIN_EXECUTOR.execute { executeNext() }
        }
    }
    }


    @UiThread
    fun canStartHomeSafely(): Boolean = commandQueue.isEmpty() || commandQueue.first().type == HOME

    /** Clear commands from the queue */
    fun clearPendingCommands() {
    fun clearPendingCommands() {
        Log.d(TAG, "clearing pending commands - size: ${pendingCommands.size}")
        Log.d(TAG, "clearing pending commands: $commandQueue")
        pendingCommands.clear()
        commandQueue.clear()
    }
    }


    @UiThread
    fun canStartHomeSafely(): Boolean =
        pendingCommands.isEmpty() || pendingCommands.first().type == TYPE_HOME

    private fun getNextTask(view: RecentsView<*, *>): TaskView? {
    private fun getNextTask(view: RecentsView<*, *>): TaskView? {
        val runningTaskView = view.runningTaskView
        val runningTaskView = view.runningTaskView


@@ -166,7 +170,7 @@ class OverviewCommandHelper(
        if (callbackList != null) {
        if (callbackList != null) {
            callbackList.add {
            callbackList.add {
                Log.d(TAG, "launching task callback: $command")
                Log.d(TAG, "launching task callback: $command")
                scheduleNextTask(command)
                onCommandFinished(command)
                waitForToggleCommandComplete = false
                waitForToggleCommandComplete = false
            }
            }
            Log.d(TAG, "launching task - waiting for callback: $command")
            Log.d(TAG, "launching task - waiting for callback: $command")
@@ -183,21 +187,18 @@ class OverviewCommandHelper(
     * is deferred until [.scheduleNextTask] is called
     * is deferred until [.scheduleNextTask] is called
     */
     */
    private fun executeCommand(command: CommandInfo): Boolean {
    private fun executeCommand(command: CommandInfo): Boolean {
        if (waitForToggleCommandComplete && command.type == TYPE_TOGGLE) {
        command.status = CommandStatus.PROCESSING

        if (waitForToggleCommandComplete && command.type == TOGGLE) {
            Log.d(TAG, "executeCommand: $command - waiting for toggle command complete")
            Log.d(TAG, "executeCommand: $command - waiting for toggle command complete")
            return true
            return true
        }
        }
        val activityInterface: BaseActivityInterface<*, *> =
            overviewComponentObserver.activityInterface


        val visibleRecentsView: RecentsView<*, *>? =
        var recentsView = visibleRecentsView
            activityInterface.getVisibleRecentsView<RecentsView<*, *>>()
        Log.d(TAG, "executeCommand: $command - visibleRecentsView: $recentsView")
        val createdRecentsView: RecentsView<*, *>?
        if (recentsView == null) {

        Log.d(TAG, "executeCommand: $command - visibleRecentsView: $visibleRecentsView")
        if (visibleRecentsView == null) {
            val activity = activityInterface.getCreatedContainer() as? RecentsViewContainer
            val activity = activityInterface.getCreatedContainer() as? RecentsViewContainer
            createdRecentsView = activity?.getOverviewPanel()
            recentsView = activity?.getOverviewPanel()
            val deviceProfile = activity?.getDeviceProfile()
            val deviceProfile = activity?.getDeviceProfile()
            val uiController = activityInterface.getTaskbarController()
            val uiController = activityInterface.getTaskbarController()
            val allowQuickSwitch =
            val allowQuickSwitch =
@@ -207,22 +208,20 @@ class OverviewCommandHelper(
                    (deviceProfile.isTablet || deviceProfile.isTwoPanels)
                    (deviceProfile.isTablet || deviceProfile.isTwoPanels)


            when (command.type) {
            when (command.type) {
                TYPE_HIDE -> {
                HIDE -> {
                    if (!allowQuickSwitch) return true
                    if (!allowQuickSwitch) return true
                    keyboardTaskFocusIndex = uiController!!.launchFocusedTask()
                    keyboardTaskFocusIndex = uiController!!.launchFocusedTask()
                    if (keyboardTaskFocusIndex == -1) return true
                    if (keyboardTaskFocusIndex == -1) return true
                }
                }
                TYPE_KEYBOARD_INPUT ->
                KEYBOARD_INPUT ->
                    if (allowQuickSwitch) {
                    if (allowQuickSwitch) {
                        uiController!!.openQuickSwitchView()
                        uiController!!.openQuickSwitchView()
                        return true
                        return true
                    } else {
                    } else {
                        keyboardTaskFocusIndex = 0
                        keyboardTaskFocusIndex = 0
                    }
                    }
                TYPE_HOME -> {
                HOME -> {
                    ActiveGestureLog.INSTANCE.addLog(
                    ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(HOME)")
                        "OverviewCommandHelper.executeCommand(TYPE_HOME)"
                    )
                    // Although IActivityTaskManager$Stub$Proxy.startActivity is a slow binder call,
                    // Although IActivityTaskManager$Stub$Proxy.startActivity is a slow binder call,
                    // we should still call it on main thread because launcher is waiting for
                    // we should still call it on main thread because launcher is waiting for
                    // ActivityTaskManager to resume it. Also calling startActivity() on bg thread
                    // ActivityTaskManager to resume it. Also calling startActivity() on bg thread
@@ -230,38 +229,37 @@ class OverviewCommandHelper(
                    touchInteractionService.startActivity(overviewComponentObserver.homeIntent)
                    touchInteractionService.startActivity(overviewComponentObserver.homeIntent)
                    return true
                    return true
                }
                }
                TYPE_SHOW ->
                SHOW ->
                    // When Recents is not currently visible, the command's type is
                    // When Recents is not currently visible, the command's type is SHOW
                    // TYPE_SHOW
                    // when overview is triggered via the keyboard overview button or Action+Tab
                    // when overview is triggered via the keyboard overview button or Action+Tab
                    // keys (Not Alt+Tab which is KQS). The overview button on-screen in 3-button
                    // keys (Not Alt+Tab which is KQS). The overview button on-screen in 3-button
                    // nav is TYPE_TOGGLE.
                    // nav is TYPE_TOGGLE.
                    keyboardTaskFocusIndex = 0
                    keyboardTaskFocusIndex = 0
                else -> {}
                TOGGLE -> {}
            }
            }
        } else {
        } else {
            createdRecentsView = visibleRecentsView
            return when (command.type) {
            when (command.type) {
                SHOW -> true // already visible
                TYPE_SHOW -> return true // already visible
                KEYBOARD_INPUT,
                TYPE_KEYBOARD_INPUT,
                HIDE -> {
                TYPE_HIDE -> {
                    if (recentsView.isHandlingTouch) {
                    if (visibleRecentsView.isHandlingTouch) return true
                        true

                    } else {
                        keyboardTaskFocusIndex = PagedView.INVALID_PAGE
                        keyboardTaskFocusIndex = PagedView.INVALID_PAGE
                    val currentPage = visibleRecentsView.nextPage
                        val currentPage = recentsView.nextPage
                    val taskView = visibleRecentsView.getTaskViewAt(currentPage)
                        val taskView = recentsView.getTaskViewAt(currentPage)
                    return launchTask(visibleRecentsView, taskView, command)
                        launchTask(recentsView, taskView, command)
                }
                    }
                TYPE_TOGGLE ->
                }
                    return launchTask(visibleRecentsView, getNextTask(visibleRecentsView), command)
                TOGGLE -> launchTask(recentsView, getNextTask(recentsView), command)
                TYPE_HOME -> {
                HOME -> {
                    visibleRecentsView.startHome()
                    recentsView.startHome()
                    return true
                    true
                }
                }
            }
            }
        }
        }


        createdRecentsView?.setKeyboardTaskFocusIndex(keyboardTaskFocusIndex)
        recentsView?.setKeyboardTaskFocusIndex(keyboardTaskFocusIndex)
        // Handle recents view focus when launching from home
        // Handle recents view focus when launching from home
        val animatorListener: Animator.AnimatorListener =
        val animatorListener: Animator.AnimatorListener =
            object : AnimatorListenerAdapter() {
            object : AnimatorListenerAdapter() {
@@ -275,7 +273,7 @@ class OverviewCommandHelper(
                    Log.d(TAG, "switching to Overview state - onAnimationEnd: $command")
                    Log.d(TAG, "switching to Overview state - onAnimationEnd: $command")
                    super.onAnimationEnd(animation)
                    super.onAnimationEnd(animation)
                    onRecentsViewFocusUpdated(command)
                    onRecentsViewFocusUpdated(command)
                    scheduleNextTask(command)
                    onCommandFinished(command)
                }
                }
            }
            }
        if (activityInterface.switchToRecentsIfVisible(animatorListener)) {
        if (activityInterface.switchToRecentsIfVisible(animatorListener)) {
@@ -326,7 +324,7 @@ class OverviewCommandHelper(
                    command.removeListener(this)
                    command.removeListener(this)


                    activityInterface.getCreatedContainer() ?: return
                    activityInterface.getCreatedContainer() ?: return
                    createdRecentsView?.onRecentsAnimationComplete()
                    recentsView?.onRecentsAnimationComplete()
                }
                }
            }
            }


@@ -365,17 +363,12 @@ class OverviewCommandHelper(
        command.removeListener(handler)
        command.removeListener(handler)
        Trace.endAsyncSection(TRANSITION_NAME, 0)
        Trace.endAsyncSection(TRANSITION_NAME, 0)
        onRecentsViewFocusUpdated(command)
        onRecentsViewFocusUpdated(command)
        scheduleNextTask(command)
        onCommandFinished(command)
    }
    }


    private fun updateRecentsViewFocus(command: CommandInfo) {
    private fun updateRecentsViewFocus(command: CommandInfo) {
        val recentsView: RecentsView<*, *> =
        val recentsView: RecentsView<*, *> = visibleRecentsView ?: return
            overviewComponentObserver.activityInterface.getVisibleRecentsView() ?: return
        if (command.type != KEYBOARD_INPUT && command.type != HIDE && command.type != SHOW) {
        if (
            command.type != TYPE_KEYBOARD_INPUT &&
                command.type != TYPE_HIDE &&
                command.type != TYPE_SHOW
        ) {
            return
            return
        }
        }


@@ -394,9 +387,8 @@ class OverviewCommandHelper(
    }
    }


    private fun onRecentsViewFocusUpdated(command: CommandInfo) {
    private fun onRecentsViewFocusUpdated(command: CommandInfo) {
        val recentsView: RecentsView<*, *> =
        val recentsView: RecentsView<*, *> = visibleRecentsView ?: return
            overviewComponentObserver.activityInterface.getVisibleRecentsView() ?: return
        if (command.type != HIDE || keyboardTaskFocusIndex == PagedView.INVALID_PAGE) {
        if (command.type != TYPE_HIDE || keyboardTaskFocusIndex == PagedView.INVALID_PAGE) {
            return
            return
        }
        }
        recentsView.setKeyboardTaskFocusIndex(PagedView.INVALID_PAGE)
        recentsView.setKeyboardTaskFocusIndex(PagedView.INVALID_PAGE)
@@ -413,15 +405,13 @@ class OverviewCommandHelper(
        return true
        return true
    }
    }


    private fun logShowOverviewFrom(commandType: Int) {
    private fun logShowOverviewFrom(commandType: CommandType) {
        val activityInterface: BaseActivityInterface<*, *> =
            overviewComponentObserver.activityInterface
        val container = activityInterface.getCreatedContainer() as? RecentsViewContainer ?: return
        val container = activityInterface.getCreatedContainer() as? RecentsViewContainer ?: return
        val event =
        val event =
            when (commandType) {
            when (commandType) {
                TYPE_SHOW -> LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_SHORTCUT
                SHOW -> LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_SHORTCUT
                TYPE_HIDE -> LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_QUICK_SWITCH
                HIDE -> LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_QUICK_SWITCH
                TYPE_TOGGLE -> LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_3_BUTTON
                TOGGLE -> LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_3_BUTTON
                else -> return
                else -> return
            }
            }
        StatsLogManager.newInstance(container.asContext())
        StatsLogManager.newInstance(container.asContext())
@@ -438,16 +428,17 @@ class OverviewCommandHelper(


    fun dump(pw: PrintWriter) {
    fun dump(pw: PrintWriter) {
        pw.println("OverviewCommandHelper:")
        pw.println("OverviewCommandHelper:")
        pw.println("  pendingCommands=${pendingCommands.size}")
        pw.println("  pendingCommands=${commandQueue.size}")
        if (pendingCommands.isNotEmpty()) {
        if (commandQueue.isNotEmpty()) {
            pw.println("    pendingCommandType=${pendingCommands.first().type}")
            pw.println("    pendingCommandType=${commandQueue.first().type}")
        }
        }
        pw.println("  mKeyboardTaskFocusIndex=$keyboardTaskFocusIndex")
        pw.println("  keyboardTaskFocusIndex=$keyboardTaskFocusIndex")
        pw.println("  mWaitForToggleCommandComplete=$waitForToggleCommandComplete")
        pw.println("  waitForToggleCommandComplete=$waitForToggleCommandComplete")
    }
    }


    private data class CommandInfo(
    private data class CommandInfo(
        val type: Int,
        val type: CommandType,
        var status: CommandStatus = CommandStatus.IDLE,
        val createTime: Long = SystemClock.elapsedRealtime(),
        val createTime: Long = SystemClock.elapsedRealtime(),
        private var animationCallbacks: RecentsAnimationCallbacks? = null
        private var animationCallbacks: RecentsAnimationCallbacks? = null
    ) {
    ) {
@@ -462,23 +453,30 @@ class OverviewCommandHelper(
        fun removeListener(listener: RecentsAnimationCallbacks.RecentsAnimationListener?) {
        fun removeListener(listener: RecentsAnimationCallbacks.RecentsAnimationListener?) {
            animationCallbacks?.removeListener(listener)
            animationCallbacks?.removeListener(listener)
        }
        }

        enum class CommandStatus {
            IDLE,
            PROCESSING,
            COMPLETED
        }
    }

    enum class CommandType {
        SHOW,
        KEYBOARD_INPUT,
        HIDE,
        TOGGLE, // Navigate to Overview
        HOME, // Navigate to Home
    }
    }


    companion object {
    companion object {
        private const val TAG = "OverviewCommandHelper"
        private const val TAG = "OverviewCommandHelper"

        private const val TRANSITION_NAME = "Transition:toOverview"
        const val TYPE_SHOW: Int = 1
        const val TYPE_KEYBOARD_INPUT: Int = 2
        const val TYPE_HIDE: Int = 3
        const val TYPE_TOGGLE: Int = 4
        const val TYPE_HOME: Int = 5


        /**
        /**
         * Use case for needing a queue is double tapping recents button in 3 button nav. Size of 2
         * Use case for needing a queue is double tapping recents button in 3 button nav. Size of 2
         * should be enough. We'll toss in one more because we're kind hearted.
         * should be enough. We'll toss in one more because we're kind hearted.
         */
         */
        private const val MAX_QUEUE_SIZE = 3
        private const val MAX_QUEUE_SIZE = 3

        private const val TRANSITION_NAME = "Transition:toOverview"
    }
    }
}
}
+7 −7
Original line number Original line Diff line number Diff line
@@ -109,6 +109,7 @@ import com.android.launcher3.util.PluginManagerWrapper;
import com.android.launcher3.util.SafeCloseable;
import com.android.launcher3.util.SafeCloseable;
import com.android.launcher3.util.ScreenOnTracker;
import com.android.launcher3.util.ScreenOnTracker;
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.util.TraceHelper;
import com.android.quickstep.OverviewCommandHelper.CommandType;
import com.android.quickstep.inputconsumers.AccessibilityInputConsumer;
import com.android.quickstep.inputconsumers.AccessibilityInputConsumer;
import com.android.quickstep.inputconsumers.AssistantInputConsumer;
import com.android.quickstep.inputconsumers.AssistantInputConsumer;
import com.android.quickstep.inputconsumers.BubbleBarInputConsumer;
import com.android.quickstep.inputconsumers.BubbleBarInputConsumer;
@@ -246,7 +247,7 @@ public class TouchInteractionService extends Service {
                    return;
                    return;
                }
                }
                TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
                TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
                tis.mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_TOGGLE);
                tis.mOverviewCommandHelper.addCommand(CommandType.TOGGLE);
            });
            });
        }
        }


@@ -256,10 +257,9 @@ public class TouchInteractionService extends Service {
            executeForTouchInteractionService(tis -> {
            executeForTouchInteractionService(tis -> {
                if (triggeredFromAltTab) {
                if (triggeredFromAltTab) {
                    TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
                    TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
                    tis.mOverviewCommandHelper.addCommand(
                    tis.mOverviewCommandHelper.addCommand(CommandType.KEYBOARD_INPUT);
                            OverviewCommandHelper.TYPE_KEYBOARD_INPUT);
                } else {
                } else {
                    tis.mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_SHOW);
                    tis.mOverviewCommandHelper.addCommand(CommandType.SHOW);
                }
                }
            });
            });
        }
        }
@@ -270,7 +270,7 @@ public class TouchInteractionService extends Service {
            executeForTouchInteractionService(tis -> {
            executeForTouchInteractionService(tis -> {
                if (triggeredFromAltTab && !triggeredFromHomeKey) {
                if (triggeredFromAltTab && !triggeredFromHomeKey) {
                    // onOverviewShownFromAltTab hides the overview and ends at the target app
                    // onOverviewShownFromAltTab hides the overview and ends at the target app
                    tis.mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_HIDE);
                    tis.mOverviewCommandHelper.addCommand(CommandType.HIDE);
                }
                }
            });
            });
        }
        }
@@ -595,12 +595,12 @@ public class TouchInteractionService extends Service {
    private final TaskbarNavButtonCallbacks mNavCallbacks = new TaskbarNavButtonCallbacks() {
    private final TaskbarNavButtonCallbacks mNavCallbacks = new TaskbarNavButtonCallbacks() {
        @Override
        @Override
        public void onNavigateHome() {
        public void onNavigateHome() {
            mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_HOME);
            mOverviewCommandHelper.addCommand(CommandType.HOME);
        }
        }


        @Override
        @Override
        public void onToggleOverview() {
        public void onToggleOverview() {
            mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_TOGGLE);
            mOverviewCommandHelper.addCommand(CommandType.TOGGLE);
        }
        }
    };
    };


+2 −1
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.launcher3.util.DisplayController;
import com.android.quickstep.GestureState;
import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.OverviewCommandHelper;
import com.android.quickstep.OverviewCommandHelper;
import com.android.quickstep.OverviewCommandHelper.CommandType;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.InputMonitorCompat;


/**
/**
@@ -200,7 +201,7 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
                        break;
                        break;
                    case MotionEvent.ACTION_BUTTON_RELEASE:
                    case MotionEvent.ACTION_BUTTON_RELEASE:
                        if (isStashedTaskbarHovered) {
                        if (isStashedTaskbarHovered) {
                            mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_HOME);
                            mOverviewCommandHelper.addCommand(CommandType.HOME);
                        }
                        }
                        break;
                        break;
                }
                }