From 1d03b5c4b8fa87c8f2221b47d9ab90af45a31a21 Mon Sep 17 00:00:00 2001 From: Kazuki Takise Date: Thu, 2 Jul 2020 13:30:25 +0900 Subject: [PATCH] Reset allDrawn when an activity is relaunched Currently when windowing mode of a task changes, |ActivityRecord.allDrawn| is not set to false, so the corresponding app transition starts immediately without waiting for the next buffer. (For open transitions, opening activities become visible from invisible, which triggers clearAllDrawn(), but this is not the case of change transitions). I think there are basically two ideas to fix this: 1. Call clearALlDrawn() when MSG_RESIZE is posted. This should work in most cases, but there are a few concerns: (i) Posting MSG_RESIZE doesn't necessarily mean relayout is called because the arguments passed with MSG_RESIZE are cached on the client side and if there's no change, relayout is not triggered. (ii) There should be other config changes by which apps are redrawn than resizing. 2. Call clearALlDrawn() when apps are relaunched. This is what this CL does. This should cover resize cases plus other config changes. Also when an app is restarted, it's guaranteed (or at least the framework assumes) that a new surface is created and relayout is called for it. Bug: 159294946 Tets: go/wm-smoke Test: Manually confirmed buffers were synchronized in change transitions. Change-Id: Ibb9eb3ce27f44940a216d6c9ac20d5cdc47dd617 --- services/core/java/com/android/server/wm/ActivityRecord.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index ab6f894454c9b..0fe40be799984 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -3028,6 +3028,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // from the client it-self to the parent surface (owned by us). detachChildren(); + clearAllDrawn(); + mPendingRelaunchCount++; }