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

Commit ea7e9e98 authored by Achim Thesmann's avatar Achim Thesmann
Browse files

Introduce flag to enable grace period deprecation

Currently there is a flag that reenables grace period exemption for new task launches under ASM. This just makes sure that the default state is to allow (original behavior) in case of a rollback.

Test: atest BackgroundActivityLaunchTest
Bug: 416033243
Flag: android.security.asm_ignore_grace_period_exemption
Change-Id: I1e7a827a2fc5687224b0f7fb4b8904706b5d743f
parent 75d2fa94
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -31,13 +31,10 @@ flag {
}

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

flag {
+2 −2
Original line number Diff line number Diff line
@@ -1414,7 +1414,7 @@ public class BackgroundActivityStartController {
            }
            return true;
        }
        if (android.security.Flags.asmReintroduceGracePeriod() && balVerdict.isBasedOnCaller()
        if (!android.security.Flags.asmIgnoreGracePeriodExemption() && balVerdict.isBasedOnCaller()
                && balVerdict.isInGracePeriod() && balVerdict.getCode() == BAL_ALLOW_GRACE_PERIOD) {
            if (DEBUG_ACTIVITY_STARTS) {
                Slog.d(TAG, "[ASM] allowed based on grace period. verdict: " + balVerdict);
@@ -1488,7 +1488,7 @@ 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()) {
                    if (!android.security.Flags.asmIgnoreGracePeriodExemption()) {
                        bas = checkTopActivityForAsm(task, callingUid, /*sourceRecord*/null, bas);
                    } else {
                        if (visibleTasks.size() == 1 && task.isActivityTypeHomeOrRecents()) {