From 4b5ed59098a666baa8bc3a4d8a9713d144edbd14 Mon Sep 17 00:00:00 2001 From: Issei Suzuki Date: Thu, 2 Jul 2020 19:03:30 +0200 Subject: [PATCH] Fix bubble shows empty content after rotating the device. When the device is rotated while a Bubble is expanded, the following things happen after the device rotation. 1. an activity of the Bubble is started, and app transition TRANSIT_SHOW_SINGLE_TASK_DISPLAY is prepared. 2. the server waits until the Bubble activity draws contents on its surface, i.e. an app transition is executed. 3. the server trigger ITaskStackListner#onSingleTaskDisplayDrawn 4. SysUI makes a Surface of the Bubble activity opaque. Depending on the status of Bubble activity, another app transition can be prepared before the first step above, which is sticky so prevents taking the following steps. This change allows to override an app transition which has already been prepared, so an app transition TRANSIT_SHOW_SINGLE_TASK_DISPLAY is always executed; thus callback is triggered. Bug: 158675422 Test: manual, open a Bubble and rotate device several times. Change-Id: I24fb649c1301e5f5a2443f3eaed166049b5f6108 --- services/core/java/com/android/server/wm/ActivityStack.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 8f0de7312ee5a..225c2094fd398 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -2058,7 +2058,12 @@ class ActivityStack extends Task { if (r.mLaunchTaskBehind) { transit = TRANSIT_TASK_OPEN_BEHIND; } else if (getDisplay().isSingleTaskInstance()) { + // If a new task is being launched in a single task display, we don't need + // to play normal animation, but need to trigger a callback when an app + // transition is actually handled. So ignore already prepared activity, and + // override it. transit = TRANSIT_SHOW_SINGLE_TASK_DISPLAY; + keepCurTransition = false; } else { // If a new task is being launched, then mark the existing top activity as // supporting picture-in-picture while pausing only if the starting activity