Loading services/core/java/com/android/server/am/ActiveServices.java +5 −11 Original line number Diff line number Diff line Loading @@ -8950,18 +8950,12 @@ public final class ActiveServices { if (!mAm.mConstants.mFgsStartRestrictionCheckCallerTargetSdk) { return true; // In this case, we only check the service's target SDK level. } final int callingUid; if (Flags.newFgsRestrictionLogic()) { // We always consider SYSTEM_UID to target S+, so just enable the restrictions. if (actualCallingUid == Process.SYSTEM_UID) { return true; } callingUid = actualCallingUid; } else { // Legacy logic used mRecentCallingUid. callingUid = r.mRecentCallingUid; } if (!CompatChanges.isChangeEnabled(FGS_BG_START_RESTRICTION_CHANGE_ID, callingUid)) { if (!CompatChanges.isChangeEnabled(FGS_BG_START_RESTRICTION_CHANGE_ID, actualCallingUid)) { return false; // If the caller targets < S, then we still disable the restrictions. } Loading services/core/java/com/android/server/am/ServiceRecord.java +3 −6 Original line number Diff line number Diff line Loading @@ -278,24 +278,21 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN * Whether to use the new "while-in-use permission" logic for FGS start */ private boolean useNewWiuLogic_forStart() { return Flags.newFgsRestrictionLogic() // This flag should only be set on V+ && CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_START, appInfo.uid); return CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_START, appInfo.uid); } /** * Whether to use the new "while-in-use permission" logic for capabilities */ private boolean useNewWiuLogic_forCapabilities() { return Flags.newFgsRestrictionLogic() // This flag should only be set on V+ && CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_CAPABILITIES, appInfo.uid); return CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_CAPABILITIES, appInfo.uid); } /** * Whether to use the new "FGS BG start exemption" logic. */ private boolean useNewBfslLogic() { return Flags.newFgsRestrictionLogic() // This flag should only be set on V+ && CompatChanges.isChangeEnabled(USE_NEW_BFSL_LOGIC, appInfo.uid); return CompatChanges.isChangeEnabled(USE_NEW_BFSL_LOGIC, appInfo.uid); } Loading services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java +0 −1 Original line number Diff line number Diff line Loading @@ -258,7 +258,6 @@ public class MockingOomAdjusterTests { mService.mOomAdjuster = mService.mProcessStateController.getOomAdjuster(); mService.mOomAdjuster.mAdjSeq = 10000; mService.mWakefulness = new AtomicInteger(PowerManagerInternal.WAKEFULNESS_AWAKE); mSetFlagsRule.enableFlags(Flags.FLAG_NEW_FGS_RESTRICTION_LOGIC); mUiTierSize = mService.mConstants.TIERED_CACHED_ADJ_UI_TIER_SIZE; mFirstNonUiCachedAdj = sFirstUiCachedAdj + mUiTierSize; Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +5 −11 Original line number Diff line number Diff line Loading @@ -8950,18 +8950,12 @@ public final class ActiveServices { if (!mAm.mConstants.mFgsStartRestrictionCheckCallerTargetSdk) { return true; // In this case, we only check the service's target SDK level. } final int callingUid; if (Flags.newFgsRestrictionLogic()) { // We always consider SYSTEM_UID to target S+, so just enable the restrictions. if (actualCallingUid == Process.SYSTEM_UID) { return true; } callingUid = actualCallingUid; } else { // Legacy logic used mRecentCallingUid. callingUid = r.mRecentCallingUid; } if (!CompatChanges.isChangeEnabled(FGS_BG_START_RESTRICTION_CHANGE_ID, callingUid)) { if (!CompatChanges.isChangeEnabled(FGS_BG_START_RESTRICTION_CHANGE_ID, actualCallingUid)) { return false; // If the caller targets < S, then we still disable the restrictions. } Loading
services/core/java/com/android/server/am/ServiceRecord.java +3 −6 Original line number Diff line number Diff line Loading @@ -278,24 +278,21 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN * Whether to use the new "while-in-use permission" logic for FGS start */ private boolean useNewWiuLogic_forStart() { return Flags.newFgsRestrictionLogic() // This flag should only be set on V+ && CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_START, appInfo.uid); return CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_START, appInfo.uid); } /** * Whether to use the new "while-in-use permission" logic for capabilities */ private boolean useNewWiuLogic_forCapabilities() { return Flags.newFgsRestrictionLogic() // This flag should only be set on V+ && CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_CAPABILITIES, appInfo.uid); return CompatChanges.isChangeEnabled(USE_NEW_WIU_LOGIC_FOR_CAPABILITIES, appInfo.uid); } /** * Whether to use the new "FGS BG start exemption" logic. */ private boolean useNewBfslLogic() { return Flags.newFgsRestrictionLogic() // This flag should only be set on V+ && CompatChanges.isChangeEnabled(USE_NEW_BFSL_LOGIC, appInfo.uid); return CompatChanges.isChangeEnabled(USE_NEW_BFSL_LOGIC, appInfo.uid); } Loading
services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java +0 −1 Original line number Diff line number Diff line Loading @@ -258,7 +258,6 @@ public class MockingOomAdjusterTests { mService.mOomAdjuster = mService.mProcessStateController.getOomAdjuster(); mService.mOomAdjuster.mAdjSeq = 10000; mService.mWakefulness = new AtomicInteger(PowerManagerInternal.WAKEFULNESS_AWAKE); mSetFlagsRule.enableFlags(Flags.FLAG_NEW_FGS_RESTRICTION_LOGIC); mUiTierSize = mService.mConstants.TIERED_CACHED_ADJ_UI_TIER_SIZE; mFirstNonUiCachedAdj = sFirstUiCachedAdj + mUiTierSize; Loading