From b5a5b1132e40227b926a7821390a98db71426d65 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 26 Jul 2022 21:06:18 +0800 Subject: [PATCH] Skip reveal animation with invisible starting window If the app window is drawn before the starting window, the visibility flags of starting window will be cleared in ActivityRecord#commitVisibility. Then it is unnecessary to play the reveal animation for an invisible starting window. Bug: 240239537 Test: com.android.server.wm.flicker.launch.OpenAppWarmTest Change-Id: Ib1d585e9384989cc8aab95e3b3d891555106713c --- data/etc/services.core.protolog.json | 18 +++++---------- .../com/android/server/wm/ActivityRecord.java | 23 ++++++------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json index d52c70becf75b..a78724b87777a 100644 --- a/data/etc/services.core.protolog.json +++ b/data/etc/services.core.protolog.json @@ -907,6 +907,12 @@ "group": "WM_DEBUG_REMOTE_ANIMATIONS", "at": "com\/android\/server\/wm\/RemoteAnimationController.java" }, + "-1237827119": { + "message": "Schedule remove starting %s startingWindow=%s animate=%b Callers=%s", + "level": "VERBOSE", + "group": "WM_DEBUG_STARTING_WINDOW", + "at": "com\/android\/server\/wm\/ActivityRecord.java" + }, "-1228653755": { "message": "Launch on display check: displayId=%d callingPid=%d callingUid=%d", "level": "DEBUG", @@ -1015,12 +1021,6 @@ "group": "WM_DEBUG_ORIENTATION", "at": "com\/android\/server\/wm\/WindowState.java" }, - "-1128015008": { - "message": "Schedule remove starting %s startingWindow=%s startingView=%s Callers=%s", - "level": "VERBOSE", - "group": "WM_DEBUG_STARTING_WINDOW", - "at": "com\/android\/server\/wm\/ActivityRecord.java" - }, "-1117599386": { "message": "Deferring rotation, display is not enabled.", "level": "VERBOSE", @@ -3877,12 +3877,6 @@ "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, - "1742235936": { - "message": "Removing startingView=%s", - "level": "VERBOSE", - "group": "WM_DEBUG_STARTING_WINDOW", - "at": "com\/android\/server\/wm\/ActivityRecord.java" - }, "1746778201": { "message": "Set freezing of %s: visible=%b freezing=%b visibleRequested=%b. %s", "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 6c1f3bbef9e3d..69bbff3a4db12 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2728,8 +2728,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } final StartingSurfaceController.StartingSurface surface; - final StartingData startingData = mStartingData; + final boolean animate; if (mStartingData != null) { + animate = prepareAnimation && mStartingData.needRevealAnimation() + && mStartingWindow.isVisibleByPolicy(); + ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Schedule remove starting %s startingWindow=%s" + + " animate=%b Callers=%s", this, mStartingWindow, animate, + Debug.getCallers(5)); surface = mStartingSurface; mStartingData = null; mStartingSurface = null; @@ -2747,21 +2752,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } - - ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Schedule remove starting %s startingWindow=%s" - + " startingView=%s Callers=%s", this, mStartingWindow, mStartingSurface, - Debug.getCallers(5)); - - final Runnable removeSurface = () -> { - ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Removing startingView=%s", surface); - try { - surface.remove(prepareAnimation && startingData.needRevealAnimation()); - } catch (Exception e) { - Slog.w(TAG_WM, "Exception when removing starting window", e); - } - }; - - removeSurface.run(); + surface.remove(animate); } /**