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

Commit ceb8296c authored by Evan Rosky's avatar Evan Rosky
Browse files

Properly mark asyncStart situations

While not likely, there is a chance that other asyncStart
situations happen during a chain (since these are leaving
the global lock after-all). So, just in case, properly
push/pop asyncStart tracking even tho there's no chain
logic yet.

Bug: 325114242
Test: existing tests
Flag: com.android.window.flags.transit_tracker_plumbing
Change-Id: I7cb7275f0799141c6b9e0384116a1794a38d1ae5
parent eb9a751f
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -299,6 +299,14 @@ public class ActionChain {
            mStack.removeLast();
            mStack.removeLast();
        }
        }


        /**
         * Temporary query. Eventually anything that needs to check this should have its own chain
         * link.
         */
        boolean isInChain() {
            return !mStack.isEmpty();
        }

        /**
        /**
         * Special handling during "gaps" in atomicity while using the async-start hack. The
         * Special handling during "gaps" in atomicity while using the async-start hack. The
         * "end" tracking needs to account for this and we also want to track/report how often
         * "end" tracking needs to account for this and we also want to track/report how often
+8 −0
Original line number Original line Diff line number Diff line
@@ -2811,6 +2811,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        final ActivityOptions activityOptions = options != null
        final ActivityOptions activityOptions = options != null
                ? options.getOptions(this)
                ? options.getOptions(this)
                : null;
                : null;
        boolean inChain;
        synchronized (mService.mGlobalLock) {
        synchronized (mService.mGlobalLock) {
            final boolean isCallerRecents = mRecentTasks.isCallerRecents(callingUid);
            final boolean isCallerRecents = mRecentTasks.isCallerRecents(callingUid);
            boolean moveHomeTaskForward = isCallerRecents;
            boolean moveHomeTaskForward = isCallerRecents;
@@ -2926,6 +2927,10 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            intent = task.intent;
            intent = task.intent;
            intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
            intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
            userId = task.mUserId;
            userId = task.mUserId;
            inChain = mService.mChainTracker.isInChain();
            if (inChain) {
                mService.mChainTracker.pushAsyncStart();
            }
        }
        }
        // ActivityStarter will acquire the lock where the places need, so execute the request
        // ActivityStarter will acquire the lock where the places need, so execute the request
        // outside of the lock.
        // outside of the lock.
@@ -2948,6 +2953,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                    task.removeIfPossible("start-from-recents");
                    task.removeIfPossible("start-from-recents");
                }
                }
                mService.continueWindowLayout();
                mService.continueWindowLayout();
                if (inChain) {
                    mService.mChainTracker.popAsyncStart();
                }
            }
            }
        }
        }
    }
    }