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

Commit b0c09876 authored by Oluwarotimi Adesina's avatar Oluwarotimi Adesina Committed by Android (Google) Code Review
Browse files

Merge "Revert "Disabling FGS start from System Alert Window"" into main

parents df190ff9 b4f0f300
Loading
Loading
Loading
Loading
+3 −33
Original line number Diff line number Diff line
@@ -372,15 +372,6 @@ public final class ActiveServices {
    @Overridable
    public static final long FGS_BOOT_COMPLETED_RESTRICTIONS = 296558535L;

    /**
     * Disables foreground service background starts in System Alert Window for all types
     * unless it already has a System Overlay Window.
     */
    @ChangeId
    @EnabledSince(targetSdkVersion = VERSION_CODES.VANILLA_ICE_CREAM)
    @Overridable
    public static final long FGS_SAW_RESTRICTIONS = 319471980L;

    final ActivityManagerService mAm;

    // Maximum number of services that we allow to start in the background
@@ -8535,33 +8526,12 @@ public final class ActiveServices {
            }
        }

        // The flag being enabled isn't enough to deny background start: we need to also check
        // if there is a system alert UI present.
        if (ret == REASON_DENIED) {
            // Flag check: are we disabling SAW FGS background starts?
            final boolean shouldDisableSaw = Flags.fgsDisableSaw()
                    && CompatChanges.isChangeEnabled(FGS_BOOT_COMPLETED_RESTRICTIONS, callingUid);
            if (shouldDisableSaw) {
                final ProcessRecord processRecord = mAm
                        .getProcessRecordLocked(targetService.processName,
                        targetService.appInfo.uid);
                if (processRecord != null) {
                    if (processRecord.mState.hasOverlayUi()) {
            if (mAm.mAtmInternal.hasSystemAlertWindowPermission(callingUid, callingPid,
                    callingPackage)) {
                ret = REASON_SYSTEM_ALERT_WINDOW_PERMISSION;
            }
        }
                } else {
                    Slog.e(TAG, "Could not find process record for SAW check");
                }
            } else {
                if (mAm.mAtmInternal.hasSystemAlertWindowPermission(callingUid, callingPid,
                        callingPackage)) {
                    ret = REASON_SYSTEM_ALERT_WINDOW_PERMISSION;
                }
            }
        }

        // Check for CDM apps with either REQUEST_COMPANION_RUN_IN_BACKGROUND or
        // REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND.
+0 −7
Original line number Diff line number Diff line
@@ -22,13 +22,6 @@ flag {
    bug: "296558535"
}

flag {
    name: "fgs_disable_saw"
    namespace: "backstage_power"
    description: "Disable System Alert Window FGS start"
    bug: "296558535"
}

flag {
    name: "bfgs_managed_network_access"
    namespace: "backstage_power"