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

Commit 81d6564d authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Reset pending relaunch count on activity stopped

There are 2 potential cases which could lead to unpaired count.
1. ActivityRelaunchItem is queued by ClientLifecycleManager, so
   it is not sent by AR#relaunchActivityLocked, then the count
   is always increased even if the later deferred transaction
   is failed with RemoteException.
2. System server's binder buffer is full, then the transaction
   from client is failed to invoke activityRelaunched to decrease
   the count.

This avoids the stale count make ActivityRecord#isSyncFinished
always false.

Bug: 341499017
Flag: EXEMPT bugfix
Test: Hard code to skip calling finishRelaunching.
      Change display density or size in Settings.
      Loop return to home and launch apps from home.
      The worst case is only transition timeout once.
Change-Id: I35230330033f9ce7cf26527b45ef60d2927bc075
parent 56b9b7a3
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -6748,6 +6748,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        destroySurfaces();
        destroySurfaces();
        // Remove any starting window that was added for this app if they are still around.
        // Remove any starting window that was added for this app if they are still around.
        removeStartingWindow();
        removeStartingWindow();
        // This is unlikely to happen because the sequence of lifecycle should invoke
        // finishRelaunching before being stopped. Reset the potential unpaired count in case
        // the binder transaction of relaunch is failed, so the transition won't be blocked.
        if (mPendingRelaunchCount > 0) {
            Slog.i(TAG, "Clear pending relaunch count on stopped " + this);
            clearRelaunching();
        }
        if (finishing) {
        if (finishing) {
            abortAndClearOptionsAnimation();
            abortAndClearOptionsAnimation();