Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e76794ad authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Reduce showing starting window from a task trampoline

This skips adding a starting window when a task with starting window
starts another existing task with task fragment organizer while the
task snapshot cannot be used.

That avoids showing consecutive 2 solid color slash starting windows
in a short time with a task transition animation, which looks a bit
redundant. Especially, if the second task is a task fragment host,
then the starting window, the transition may wait for organizer to
response after app has drawn, which could be also wasteful.

Fix: 377973063
Flag: EXEMPT bugfix
Test: LongClickMicMicrobenchmark
Test: An existing TaskA with embedded activity in background.
      Launch a new TaskT. And TaskT launches the TaskA
      with a different intent (allowTaskSnapshot=false)
      in its activity's onCreate. Then wen moving TaskA to front,
      it should not have a starting window.
Change-Id: I795ac2be0c56aaa2544f9b647cbadaf9b6c9fd98
parent 66b4d2f7
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2537,6 +2537,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                }
            }
            if (!activityAllDrawn && !isActivityHome) {
                // Only check the special case of a fragment host task because the starting window
                // may not be visible if the client organizer delays the transition ready.
                if (task.mTaskFragmentHostProcessName != null) {
                    // It may be launched from a task trampoline that already has a starting window.
                    // Return NONE because 2 consecutive splashes may not look smooth in visual.
                    final Task prevTask = task.getParent().getTaskBelow(task);
                    if (prevTask != null) {
                        final ActivityRecord prevTaskTop = prevTask.getTopMostActivity();
                        if (prevTaskTop != null && prevTaskTop.hasStartingWindow()) {
                            return STARTING_WINDOW_TYPE_NONE;
                        }
                    }
                }
                return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
            }
        }