From 86bd1dce8d13c117c8a73e38753caeb451e739ef Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 28 Jul 2021 22:02:18 -0700 Subject: [PATCH] Clear command queue of OverviewCommandHelper on home tap Fixes: 194934483 Test: manual Change-Id: Id83b341245793c38c305e6ada5581ac4e49527a7 --- .../android/launcher3/BaseQuickstepLauncher.java | 13 +++++++++++++ .../android/quickstep/OverviewCommandHelper.java | 5 +++++ .../android/quickstep/TouchInteractionService.java | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index e1d05746af..b4b29aaae3 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -64,6 +64,7 @@ import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.IntSet; import com.android.launcher3.util.ObjectWrapper; import com.android.launcher3.util.UiThreadHelper; +import com.android.quickstep.OverviewCommandHelper; import com.android.quickstep.RecentsModel; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; @@ -109,6 +110,7 @@ public abstract class BaseQuickstepLauncher extends Launcher private OverviewActionsView mActionsView; private @Nullable TaskbarManager mTaskbarManager; + private @Nullable OverviewCommandHelper mOverviewCommandHelper; private @Nullable LauncherTaskbarUIController mTaskbarUIController; private final ServiceConnection mTisBinderConnection = new ServiceConnection() { @Override @@ -117,6 +119,8 @@ public abstract class BaseQuickstepLauncher extends Launcher mTaskbarManager.setLauncher(BaseQuickstepLauncher.this); Log.d(TAG, "TIS service connected"); resetServiceBindRetryState(); + + mOverviewCommandHelper = ((TISBinder) iBinder).getOverviewCommandHelper(); } @Override @@ -159,6 +163,15 @@ public abstract class BaseQuickstepLauncher extends Launcher super.onDestroy(); } + @Override + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + + if (mOverviewCommandHelper != null) { + mOverviewCommandHelper.clearPendingCommands(); + } + } + public QuickstepTransitionManager getAppTransitionManager() { return mAppTransitionManager; } diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index 89c2ed8ed1..5d1f90885a 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -109,6 +109,11 @@ public class OverviewCommandHelper { MAIN_EXECUTOR.execute(() -> addCommand(cmd)); } + @UiThread + public void clearPendingCommands() { + mPendingCommands.clear(); + } + private TaskView getNextTask(RecentsView view) { final TaskView runningTaskView = view.getRunningTaskView(); diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index e55f1d16ec..61622eebda 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -297,6 +297,10 @@ public class TouchInteractionService extends Service implements PluginListener