From 7a28cf4d16541926358dca664e787f68537d29df Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 6 Jun 2025 14:21:37 +0100 Subject: [PATCH] Use visibleNonExcludedTask as runningTask in 3 button flow as well - The same logic is introduced in `InputConsumerUtils` to fix same issue for Circle to Search, but didn't get added to 3 button - Copying the same logic to find the task underneath the Overlay (e.g. CtS or Gemini) to OverviewCommandHelper to fix the issue Fix: 422147244 Test: Start CtS or Gemini overview an app, tap Recents button Flag: EXEMPT bug fix Change-Id: I9934288f72c8964d84265b2488fd2ee1ca4ff7f7 --- .../quickstep/OverviewCommandHelper.kt | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt index b89280a275..bf7b77e8d2 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt @@ -60,6 +60,7 @@ import com.android.quickstep.views.RecentsView import com.android.quickstep.views.TaskView import com.android.systemui.shared.recents.model.ThumbnailData import com.android.systemui.shared.system.InteractionJankMonitorWrapper +import com.android.wm.shell.Flags.enableShellTopTaskTracking import java.io.PrintWriter import java.util.concurrent.ConcurrentLinkedDeque import java.util.concurrent.TimeUnit @@ -455,12 +456,28 @@ constructor( } val gestureState = - touchInteractionService.createGestureState( - command.displayId, - GestureState.DEFAULT_STATE, - GestureState.TrackpadGestureType.NONE, - ) - gestureState.isHandlingAtomicEvent = true + touchInteractionService + .createGestureState( + command.displayId, + GestureState.DEFAULT_STATE, + GestureState.TrackpadGestureType.NONE, + ) + .apply { + isHandlingAtomicEvent = true + if (!enableShellTopTaskTracking()) { + val runningTask = runningTask + // In the case where we are in an excluded, translucent overlay, ignore it + // and treat the running activity as the task behind the overlay. + val otherVisibleTask = runningTask?.visibleNonExcludedTask + if (otherVisibleTask != null) { + ActiveGestureProtoLogProxy.logUpdateGestureStateRunningTask( + otherVisibleTask.packageName ?: "MISSING", + runningTask.packageName ?: "MISSING", + ) + updateRunningTask(otherVisibleTask) + } + } + } val interactionHandler = touchInteractionService .getSwipeUpHandlerFactory(command.displayId)