From 78c601a499770b8a508c96a99c766812f9424de1 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 21 Sep 2022 18:36:44 +0800 Subject: [PATCH] Skip syncing draw for non seamless rotation window To avoid multiple applyWithNextDraw consuming buffers, especially for insets provider window. Seamless rotation window may not be covered by the screenshot, such as display cutout. Then it still needs to be synced as how legacy transition did in WindowState#seamlesslyRotateIfAllowed. Bug: 247856453 Test: Enable taskbar (adb shell wm size 2600x2200) and rotate screen multiple times. No flicker and no ANR. Change-Id: I51f85b481d65fb4f954fb75c8de6a3b9fc561971 --- .../java/com/android/server/wm/AsyncRotationController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/core/java/com/android/server/wm/AsyncRotationController.java b/services/core/java/com/android/server/wm/AsyncRotationController.java index 1266db5bff980..8c5f05365837b 100644 --- a/services/core/java/com/android/server/wm/AsyncRotationController.java +++ b/services/core/java/com/android/server/wm/AsyncRotationController.java @@ -202,10 +202,16 @@ class AsyncRotationController extends FadeAnimationController implements Consume // target windows. But the windows still need to use sync transaction to keep the appearance // in previous rotation, so request a no-op sync to keep the state. for (int i = mTargetWindowTokens.size() - 1; i >= 0; i--) { + if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST + && mTargetWindowTokens.valueAt(i).mAction != Operation.ACTION_SEAMLESS) { + // Expect a screenshot layer will cover the non seamless windows. + continue; + } final WindowToken token = mTargetWindowTokens.keyAt(i); for (int j = token.getChildCount() - 1; j >= 0; j--) { // TODO(b/234585256): The consumer should be handleFinishDrawing(). token.getChildAt(j).applyWithNextDraw(t -> {}); + if (DEBUG) Slog.d(TAG, "Sync draw for " + token.getChildAt(j)); } } mIsSyncDrawRequested = true;