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

Commit b4f0f300 authored by Pechetty Sravani's avatar Pechetty Sravani Committed by Android (Google) Code Review
Browse files

Revert "Disabling FGS start from System Alert Window"

Revert submission 25506346-296558535

Reason for revert: Potential culprit for b/327528820- verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Reverted changes: /q/submissionid:25506346-296558535

Change-Id: I7f400d2f5ae77281614f49b760301b5b396e4475
parent ce5f8eb5
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
@@ -8534,33 +8525,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"