Loading services/core/java/com/android/server/am/ActiveServices.java +33 −3 Original line number Diff line number Diff line Loading @@ -372,6 +372,15 @@ 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 Loading Loading @@ -8526,12 +8535,33 @@ 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. Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +33 −3 Original line number Diff line number Diff line Loading @@ -372,6 +372,15 @@ 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 Loading Loading @@ -8526,12 +8535,33 @@ 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. Loading