diff options
| author | 2022-07-11 20:00:53 +0000 | |
|---|---|---|
| committer | 2022-07-11 20:00:53 +0000 | |
| commit | c20b2f0e407577ad3ee428a0b53b233b526b18e0 (patch) | |
| tree | cbcfa9772839be52492b8eec46edc741b5368fdf | |
| parent | 520e69b92c0a193ff33c743db8146979acf9aba5 (diff) | |
| parent | 45b540163a253e1e6afcd5d34db61457248dece5 (diff) | |
Merge "[Shell-Transition] clean-up some isAnimating call points" into tm-qpr-dev am: 45b540163a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19086047
Change-Id: I19ba26b0f40a0edc0076191db1214d751401a537
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
5 files changed, 28 insertions, 26 deletions
diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json index 6706e4e87e0d..f01e2e809c21 100644 --- a/data/etc/services.core.protolog.json +++ b/data/etc/services.core.protolog.json @@ -577,12 +577,6 @@ "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, - "-1521427940": { - "message": "commitVisibility: %s: visible=%b mVisibleRequested=%b", - "level": "VERBOSE", - "group": "WM_DEBUG_APP_TRANSITIONS", - "at": "com\/android\/server\/wm\/ActivityRecord.java" - }, "-1517908912": { "message": "requestScrollCapture: caught exception dispatching to window.token=%s", "level": "WARN", @@ -1513,6 +1507,12 @@ "group": "WM_DEBUG_FOCUS_LIGHT", "at": "com\/android\/server\/wm\/DisplayContent.java" }, + "-636553602": { + "message": "commitVisibility: %s: visible=%b visibleRequested=%b, isInTransition=%b, runningAnimation=%b, caller=%s", + "level": "VERBOSE", + "group": "WM_DEBUG_APP_TRANSITIONS", + "at": "com\/android\/server\/wm\/ActivityRecord.java" + }, "-635082269": { "message": "******** booted=%b msg=%b haveBoot=%b haveApp=%b haveWall=%b wallEnabled=%b haveKeyguard=%b", "level": "INFO", diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index d4155d13992c..867be2427741 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -224,6 +224,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WIND import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES; +import static com.android.server.wm.WindowManagerService.sEnableShellTransitions; import static com.android.server.wm.WindowState.LEGACY_POLICY_VISIBILITY; import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN; @@ -3149,15 +3150,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mWillCloseOrEnterPip = willCloseOrEnterPip; } - /** - * Returns whether this {@link ActivityRecord} is considered closing. Conditions are either - * 1. Is this app animating and was requested to be hidden - * 2. App is delayed closing since it might enter PIP. - */ - boolean isClosingOrEnteringPip() { - return (isAnimating(TRANSITION | PARENTS, ANIMATION_TYPE_APP_TRANSITION) - && !mVisibleRequested) || mWillCloseOrEnterPip; + boolean willCloseOrEnterPip() { + return mWillCloseOrEnterPip; } + /** * @return Whether AppOps allows this package to enter picture-in-picture. */ @@ -5272,12 +5268,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } final int windowsCount = mChildren.size(); + // With Shell-Transition, the activity will running a transition when it is visible. + // It won't be included when fromTransition is true means the call from finishTransition. + final boolean runningAnimation = sEnableShellTransitions ? visible + : isAnimating(PARENTS, ANIMATION_TYPE_APP_TRANSITION); for (int i = 0; i < windowsCount; i++) { - mChildren.get(i).onAppVisibilityChanged(visible, isAnimating(PARENTS, - ANIMATION_TYPE_APP_TRANSITION)); + mChildren.get(i).onAppVisibilityChanged(visible, runningAnimation); } setVisible(visible); setVisibleRequested(visible); + ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "commitVisibility: %s: visible=%b" + + " visibleRequested=%b, isInTransition=%b, runningAnimation=%b, caller=%s", + this, isVisible(), mVisibleRequested, isInTransition(), runningAnimation, + Debug.getCallers(5)); if (!visible) { stopFreezingScreen(true, true); } else { @@ -5300,9 +5303,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A task.dispatchTaskInfoChangedIfNeeded(false /* force */); task = task.getParent().asTask(); } - ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, - "commitVisibility: %s: visible=%b mVisibleRequested=%b", this, - isVisible(), mVisibleRequested); final DisplayContent displayContent = getDisplayContent(); displayContent.getInputMonitor().setUpdateInputWindowsNeededLw(); if (performLayout) { diff --git a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java index 0d4cfa3a8128..3e6e06a27fdc 100644 --- a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java +++ b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java @@ -234,7 +234,7 @@ final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider // private static boolean isImeLayeringTarget(@NonNull InsetsControlTarget target, @NonNull InsetsControlTarget dcTarget) { - return !dcTarget.getWindow().isClosing() && target == dcTarget; + return !isImeTargetWindowClosing(dcTarget.getWindow()) && target == dcTarget; } private static boolean isAboveImeLayeringTarget(@NonNull InsetsControlTarget target, @@ -256,7 +256,14 @@ final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider final InsetsControlTarget target = mDisplayContent.getImeTarget(IME_TARGET_CONTROL); return target == mImeRequester && (mImeRequester.getWindow() == null - || !mImeRequester.getWindow().isClosing()); + || !isImeTargetWindowClosing(mImeRequester.getWindow())); + } + + private static boolean isImeTargetWindowClosing(@NonNull WindowState win) { + return win.mAnimatingExit || win.mActivityRecord != null + && (win.mActivityRecord.isInTransition() + && !win.mActivityRecord.isVisibleRequested() + || win.mActivityRecord.willCloseOrEnterPip()); } private boolean isTargetChangedWithinActivity(InsetsControlTarget target) { diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 46091d842c2a..30d18ab04369 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -3461,10 +3461,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mClient.asBinder().isBinderAlive(); } - boolean isClosing() { - return mAnimatingExit || (mActivityRecord != null && mActivityRecord.isClosingOrEnteringPip()); - } - void sendAppVisibilityToClients() { super.sendAppVisibilityToClients(); diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 40e266c71328..11a7c7ddf778 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -2118,7 +2118,6 @@ public class DisplayContentTests extends WindowTestsBase { final WindowState appWin2 = createWindow(null, TYPE_BASE_APPLICATION, act2, "appWin2"); appWin2.setHasSurface(true); assertTrue(appWin2.canBeImeTarget()); - doReturn(true).when(appWin1).isClosing(); doReturn(true).when(appWin1).inTransitionSelfOrParent(); // Test step 3: Verify appWin2 will be the next IME target and the IME snapshot surface will |