From a947e298d13ac8ef84139bab957e7e9fd59c2c6f Mon Sep 17 00:00:00 2001 From: Hui Yu Date: Wed, 9 Dec 2020 10:31:13 -0800 Subject: [PATCH] Remove DeviceConfig mFlagFgsStartTempAllowListEnabled. BG-FGS-Lauch always check temp allowlist now. Bug: 171305836 Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java Change-Id: I06d4218497402b16b5d3c67b2aeaaf438636272e --- .../com/android/server/am/ActiveServices.java | 3 +-- .../server/am/ActivityManagerConstants.java | 21 ------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index dffe0ba7ac788..c364c8463f1b0 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -5285,8 +5285,7 @@ public final class ActiveServices { } if (ret == FGS_FEATURE_DENIED) { - if (mAm.mConstants.mFlagFgsStartTempAllowListEnabled - && mAm.isWhitelistedForFgsStartLocked(r.appInfo.uid)) { + if (mAm.isWhitelistedForFgsStartLocked(r.appInfo.uid)) { // uid is on DeviceIdleController's user/system allowlist // or AMS's FgsStartTempAllowList. ret = FGS_FEATURE_ALLOWED_BY_DEVICE_IDLE_ALLOW_LIST; diff --git a/services/core/java/com/android/server/am/ActivityManagerConstants.java b/services/core/java/com/android/server/am/ActivityManagerConstants.java index b4e856bb07066..b0f296f68a471 100644 --- a/services/core/java/com/android/server/am/ActivityManagerConstants.java +++ b/services/core/java/com/android/server/am/ActivityManagerConstants.java @@ -166,13 +166,6 @@ final class ActivityManagerConstants extends ContentObserver { private static final String KEY_DEFAULT_FGS_STARTS_RESTRICTION_ENABLED = "default_fgs_starts_restriction_enabled"; - /** - * Default value for mFlagFgsStartTempAllowListEnabled if not explicitly set in - * Settings.Global. - */ - private static final String KEY_DEFAULT_FGS_STARTS_TEMP_ALLOWLIST_ENABLED = - "default_fgs_starts_temp_allowlist_enabled"; - /** * Whether FGS notification display is deferred following the transition into * the foreground state. Default behavior is {@code true} unless overridden. @@ -372,10 +365,6 @@ final class ActivityManagerConstants extends ContentObserver { // at all. volatile boolean mFlagFgsStartRestrictionEnabled = false; - // When the foreground service background start restriction is enabled, if the app in - // DeviceIdleController's Temp AllowList is allowed to bypass the restriction. - volatile boolean mFlagFgsStartTempAllowListEnabled = false; - // Whether we defer FGS notifications a few seconds following their transition to // the foreground state. Applies only to S+ apps; enabled by default. volatile boolean mFlagFgsNotificationDeferralEnabled = true; @@ -540,9 +529,6 @@ final class ActivityManagerConstants extends ContentObserver { case KEY_DEFAULT_FGS_STARTS_RESTRICTION_ENABLED: updateFgsStartsRestriction(); break; - case KEY_DEFAULT_FGS_STARTS_TEMP_ALLOWLIST_ENABLED: - updateFgsStartsTempAllowList(); - break; case KEY_DEFERRED_FGS_NOTIFICATIONS_ENABLED: updateFgsNotificationDeferralEnable(); break; @@ -809,13 +795,6 @@ final class ActivityManagerConstants extends ContentObserver { /*defaultValue*/ false); } - private void updateFgsStartsTempAllowList() { - mFlagFgsStartTempAllowListEnabled = DeviceConfig.getBoolean( - DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, - KEY_DEFAULT_FGS_STARTS_TEMP_ALLOWLIST_ENABLED, - /*defaultValue*/ false); - } - private void updateFgsNotificationDeferralEnable() { mFlagFgsNotificationDeferralEnabled = DeviceConfig.getBoolean( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,