From e20d2b0e13e3e3df8c1cb5d451d1b46693813c19 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 17 Nov 2022 00:06:04 +0800 Subject: [PATCH] Skip unnecessary redraw request for sync It is the similar with [1], but the condition was changed for non-sync blast that mPrepareSyncSeqId will always be 0. So add a case that assumes client will receive RELAYOUT_RES_FIRST_TIME, then it already will report draw. [1]: I6faad4b9adac7334df7caf3d23df59bd3e96bfd9 Bug: 258880446 Bug: 231435331 Test: Enable shell transition. While cold/warm/hot launch app or swipe to recents, there should only be one finishDrawing per window. Change-Id: I955bd7509863c2cbb0e0706cc1dfba9ce99ce10e --- services/core/java/com/android/server/wm/WindowState.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 86dd0b5452b5f..55a6032d8838b 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -6136,9 +6136,10 @@ class WindowState extends WindowContainer implements WindowManagerP if (mRedrawForSyncReported) { return false; } - if (mInRelayout && mPrepareSyncSeqId > 0) { - // The last sync seq id will return to the client, so there is no need to request the - // client to redraw. + if (mInRelayout && (mPrepareSyncSeqId > 0 || (mViewVisibility == View.VISIBLE + && mWinAnimator.mDrawState == DRAW_PENDING))) { + // The client will report draw if it gets the sync seq id from relayout or it is + // drawing for being visible, then no need to request redraw. return false; } return useBLASTSync();