From 32d03f38b7d40a166a58027c0591c4ce13bf0bbd Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 13 Mar 2023 22:48:51 +0800 Subject: [PATCH] Skip notifying change without visibility change To reduce unnecessary calculations. Note that legacy transition still needs it because if a transition is prepared, it still requires to add the no change records into mOpeningApps to trigger animation callback, e.g. onAnimationFinished. Bug: 159103089 Test: CtsWindowManagerDeviceTestCases Change-Id: Id9b95d1fa57581e661b9beb7e6d3614235715f22 --- services/core/java/com/android/server/wm/ActivityRecord.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 424c3271cde62..87aa837d2e9c2 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -5226,6 +5226,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A Slog.w(TAG_WM, "Attempted to set visibility of non-existing app token: " + token); return; } + if (visible == mVisibleRequested && visible == mVisible + && mTransitionController.isShellTransitionsEnabled()) { + // For shell transition, it is no-op if there is no state change. + return; + } if (visible) { mDeferHidingClient = false; }