Avoid pausing bar appearance by starting window when relaunching

1. Starting window is valid to affect bar appearance, so if the
   activity is relaunching with starting window, do not add
   to mRelaunchingSystemBarColorApps. Also because the original
   purpose is to avoid changing the candidate window due to
   the activity doesn't contain a window in a short time, e.g.
   rotation changes without persevering window.
2. When the main window of activity completes draw relaunch, it
   should compare with the actual main window. Otherwise
   findMainWindow() may return starting window that doesn't match
   the activity window.

Bug: 263066320
Test: 1. Assume an activity's splash starting window is white
         background with non-light bar theme.
      2. Launch it and then it requests light bar.
      3. Return to home.
      4. Launch it again and it calls recreate().
         The final appearance should be light bar.
Change-Id: I4f93c1d577ac22a53a9b55ae80260041ce5b5b4b
This commit is contained in:
Riddle Hsu
2023-02-10 11:19:07 +00:00
parent 86d323463d
commit 51c23d3cec
2 changed files with 2 additions and 2 deletions

View File

@@ -2200,7 +2200,7 @@ public class DisplayPolicy {
* Called when an app has started replacing its main window.
*/
void addRelaunchingApp(ActivityRecord app) {
if (mSystemBarColorApps.contains(app)) {
if (mSystemBarColorApps.contains(app) && !app.hasStartingWindow()) {
mRelaunchingSystemBarColorApps.add(app);
}
}

View File

@@ -6037,7 +6037,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
Slog.i(TAG, "finishDrawing of orientation change: " + this + " " + duration + "ms");
mOrientationChangeRedrawRequestTime = 0;
} else if (mActivityRecord != null && mActivityRecord.mRelaunchStartTime != 0
&& mActivityRecord.findMainWindow() == this) {
&& mActivityRecord.findMainWindow(false /* includeStartingApp */) == this) {
final long duration =
SystemClock.elapsedRealtime() - mActivityRecord.mRelaunchStartTime;
Slog.i(TAG, "finishDrawing of relaunch: " + this + " " + duration + "ms");