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

Commit 5eb5b1f8 authored by Hani Kazmi's avatar Hani Kazmi Committed by Android (Google) Code Review
Browse files

Merge "Allow ASM launch if callingUid on top" into main

parents ab7b5561 c85fa896
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -1997,11 +1997,7 @@ class ActivityStarter {
            }
        }

        boolean shouldBlockActivityStart = true;
        // Used for logging/toasts. Would we block the start if target sdk was U and feature was
        // enabled?
        boolean wouldBlockActivityStartIgnoringFlags = true;

        Pair<Boolean, Boolean> pair = null;
        if (mSourceRecord != null) {
            boolean passesAsmChecks = true;
            Task sourceTask = mSourceRecord.getTask();
@@ -2017,14 +2013,25 @@ class ActivityStarter {

            if (passesAsmChecks) {
                Task taskToCheck = taskToFront ? sourceTask : targetTask;
                // first == false means Should Block
                // second == false means Would Block disregarding flags
                Pair<Boolean, Boolean> pair = ActivityTaskSupervisor
                pair = ActivityTaskSupervisor
                        .doesTopActivityMatchingUidExistForAsm(taskToCheck, mSourceRecord.getUid(),
                                mSourceRecord);
                shouldBlockActivityStart = !pair.first;
                wouldBlockActivityStartIgnoringFlags = !pair.second;
            }
        } else if (!taskToFront) {
            // We don't have a sourceRecord, and we're launching into an existing task.
            // Allow if callingUid is top of stack.
            pair = ActivityTaskSupervisor
                    .doesTopActivityMatchingUidExistForAsm(targetTask, mCallingUid,
                            /*sourceRecord*/null);
        }

        boolean shouldBlockActivityStart = true;
        if (pair != null) {
            // We block if feature flag is enabled
            shouldBlockActivityStart = !pair.first;
            // Used for logging/toasts. Would we block if target sdk was U and feature was
            // enabled? If so, we can't return here but we also might not block at the end
            boolean wouldBlockActivityStartIgnoringFlags = !pair.second;

            if (!wouldBlockActivityStartIgnoringFlags) {
                return true;