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

Commit 3edf573f authored by Achim Thesmann's avatar Achim Thesmann
Browse files

Allow system process by opt in

With explict opt in to allow to start ALWAYS system processes should be
allowed to start.

Test: atest BackgroundActivityLaunchTests
Flag: com.android.window.flags.bal_additional_start_modes
Bug: 352182359
Change-Id: Ia0ece6f5455e946e69fcae5c889fa556ee0e0a42
parent c6ad9c24
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1164,8 +1164,9 @@ public class BackgroundActivityStartController {
     * or {@link #BAL_BLOCK} if the launch should be blocked
     */
    BalVerdict checkBackgroundActivityStartAllowedByRealCallerInBackground(BalState state) {
        if (state.mCheckedOptions.getPendingIntentBackgroundActivityStartMode()
                == MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
        boolean allowAlways = state.mCheckedOptions.getPendingIntentBackgroundActivityStartMode()
                == MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS;
        if (allowAlways
                && hasBalPermission(state.mRealCallingUid, state.mRealCallingPid)) {
            return new BalVerdict(BAL_ALLOW_PERMISSION,
                    /*background*/ false,
@@ -1177,8 +1178,7 @@ public class BackgroundActivityStartController {
                + state.mRealCallingPid + ", " + state.mRealCallingPackage + ") "
                + balStartModeToString(
                state.mCheckedOptions.getPendingIntentBackgroundActivityStartMode()));
        if (state.mCheckedOptions.getPendingIntentBackgroundActivityStartMode()
                == MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
        if (allowAlways
                && mService.hasSystemAlertWindowPermission(state.mRealCallingUid,
                state.mRealCallingPid, state.mRealCallingPackage)) {
            Slog.w(
@@ -1192,7 +1192,7 @@ public class BackgroundActivityStartController {

        // if the realCallingUid is a persistent system process, abort if the IntentSender
        // wasn't allowed to start an activity
        if (state.mAllowBalExemptionForSystemProcess
        if ((allowAlways || state.mAllowBalExemptionForSystemProcess)
                && state.mIsRealCallingUidPersistentSystemProcess) {
            return new BalVerdict(BAL_ALLOW_ALLOWLISTED_UID,
                    /*background*/ false,