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

Commit b20bc8e4 authored by Achim Thesmann's avatar Achim Thesmann Committed by Android (Google) Code Review
Browse files

Merge "Refactor ASM logic to consume separate states" into main

parents 153ef06a 75d2fa94
Loading
Loading
Loading
Loading
+204 −77

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ class BackgroundLaunchProcessController {

        // If app switching is not allowed, we ignore all the start activity grace period
        // exception so apps cannot start itself in onPause() after pressing home button.
        if (checkConfiguration.checkOtherExemptions && appSwitchState == APP_SWITCH_ALLOW) {
        if (checkConfiguration.gracePeriod > 0 && appSwitchState == APP_SWITCH_ALLOW) {
            // Allow if any activity in the caller has either started or finished very recently, and
            // it must be started or finished after last stop app switches time.
            if (lastActivityLaunchTime > lastStopAppSwitchesTime
+9 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm;

import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_PENDING_INTENT;
import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_PERMISSION;
import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_VISIBLE_WINDOW;
import static com.android.server.wm.BackgroundActivityStartController.BAL_BLOCK;
@@ -177,7 +176,13 @@ public class BackgroundActivityStartControllerTests {
        }

        public void setRealCallerVerdict(BalVerdict verdict) {
            if (verdict == null) {
                this.mRealCallerVerdict = Optional.empty();
            } else if (verdict.isImmutable()) {
                this.mRealCallerVerdict = Optional.of(verdict);
            } else {
                this.mRealCallerVerdict = Optional.of(verdict.setBasedOnRealCaller());
            }
        }

        @Override
@@ -488,8 +493,9 @@ public class BackgroundActivityStartControllerTests {

        // assertions
        assertThat(verdict).isEqualTo(realCallerVerdict);
        assertThat(verdict.isBasedOnRealCaller()).isTrue();
        assertThat(mBalAllowedLogs).containsExactly(
                new BalAllowedLog("package.app3/someClass", BAL_ALLOW_PENDING_INTENT));
                new BalAllowedLog("package.app3/someClass", BAL_ALLOW_VISIBLE_WINDOW));

    }