From 55e760275ade295ec9eede257c1c5d6d1efbae8c Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 13 Apr 2023 22:32:24 +0800 Subject: [PATCH] Ignore tap ouside for transient-hide task Because with transient launch, launcher is moved to top when animating recents animation. Then before the surface of transient hide task disappears on screen, the tap outside may still be triggered. Which will send another TO_FRONT transition (app=CHANGE, recents=CLOSE). This add the same condition as legacy recents did in onPointerDownOutsideFocusLocked to skip handling the tap. Also let RecentsTransitionHandler cancel the animation and restore the state (hide recents, reorder app to top and show it) if the unexpected TO_FRONT happens (e.g. setFocusedTask on hide task). Bug: 278055698 Test: Launch an activity with a dialog. Swipe-up and tap screen quickly. Home is still visible. Change-Id: I1d22cb7a391d71b0d5cc0fa57cd8303458a4434d --- .../wm/shell/recents/RecentsTransitionHandler.java | 7 ++++++- .../java/com/android/server/wm/WindowManagerService.java | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java index c8d6a5e8e00b2..44d7e6de8ec4d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java @@ -540,7 +540,12 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { mergeActivityOnly(info, t); } else if (!didMergeThings) { // Didn't recognize anything in incoming transition so don't merge it. - Slog.w(TAG, "Don't know how to merge this transition."); + Slog.w(TAG, "Don't know how to merge this transition, foundRecentsClosing=" + + foundRecentsClosing); + if (foundRecentsClosing) { + mWillFinishToHome = false; + cancel(false /* toHome */); + } return; } // At this point, we are accepting the merge. diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 8fecf111d98cb..99d0ea86e2f48 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -8526,6 +8526,14 @@ public class WindowManagerService extends IWindowManager.Stub // while in overview return; } + final WindowState w = t.getWindowState(); + if (w != null) { + final Task task = w.getTask(); + if (task != null && w.mTransitionController.isTransientHide(task)) { + // Don't disturb transient animation by accident touch. + return; + } + } ProtoLog.i(WM_DEBUG_FOCUS_LIGHT, "onPointerDownOutsideFocusLocked called on %s", t);