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

Commit 35b84b23 authored by Hao Ke's avatar Hao Ke Committed by Android (Google) Code Review
Browse files

Merge "Reintroduce grace period for ASM" into main

parents fbc5cab4 e9250238
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -23,6 +23,17 @@ flag {
    bug: "230590090"
}

flag {
  name: "asm_reintroduce_grace_period"
  namespace: "responsible_apis"
  description: "Allow launches within the grace period for ASM apps"
  bug: "367702727"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}


flag {
    name: "content_uri_permission_apis"
    is_exported: true
+11 −4
Original line number Diff line number Diff line
@@ -1120,7 +1120,9 @@ public class BackgroundActivityStartController {
            @Nullable Task targetTask, int launchFlags, int balCode, int callingUid,
            int realCallingUid, TaskDisplayArea preferredTaskDisplayArea) {
        // BAL Exception allowed in all cases
        if (balCode == BAL_ALLOW_ALLOWLISTED_UID) {
        if (balCode == BAL_ALLOW_ALLOWLISTED_UID
                || (android.security.Flags.asmReintroduceGracePeriod()
                    && balCode == BAL_ALLOW_GRACE_PERIOD)) {
            return true;
        }

@@ -1173,10 +1175,15 @@ public class BackgroundActivityStartController {
                ArrayList<Task> visibleTasks = displayArea.getVisibleTasks();
                for (int i = 0; i < visibleTasks.size(); i++) {
                    Task task = visibleTasks.get(i);
                    if (android.security.Flags.asmReintroduceGracePeriod()) {
                        bas = checkTopActivityForAsm(task, callingUid, /*sourceRecord*/null, bas);
                    } else {
                        if (visibleTasks.size() == 1 && task.isActivityTypeHomeOrRecents()) {
                            bas.optedIn(task.getTopMostActivity());
                        } else {
                        bas = checkTopActivityForAsm(task, callingUid, /*sourceRecord*/null, bas);
                            bas = checkTopActivityForAsm(
                                task, callingUid, /*sourceRecord*/null, bas);
                        }
                    }
                }
            }