diff --git a/services/core/java/com/android/server/am/AppRestrictionController.java b/services/core/java/com/android/server/am/AppRestrictionController.java index 376709c42ddec..1129c19bce873 100644 --- a/services/core/java/com/android/server/am/AppRestrictionController.java +++ b/services/core/java/com/android/server/am/AppRestrictionController.java @@ -69,6 +69,7 @@ import static android.os.PowerExemptionManager.REASON_ROLE_EMERGENCY; import static android.os.PowerExemptionManager.REASON_SYSTEM_ALLOW_LISTED; import static android.os.PowerExemptionManager.REASON_SYSTEM_MODULE; import static android.os.PowerExemptionManager.REASON_SYSTEM_UID; +import static android.os.PowerExemptionManager.reasonCodeToString; import static android.os.Process.SYSTEM_UID; import static com.android.internal.notification.SystemNotificationChannels.ABUSIVE_BACKGROUND_APPS; @@ -157,6 +158,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; +import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; import java.util.function.Consumer; @@ -329,6 +331,8 @@ public final class AppRestrictionController { } } } + pw.print(" effectiveExemption="); + pw.print(reasonCodeToString(getBackgroundRestrictionExemptionReason(mUid))); } String getPackageName() { @@ -555,6 +559,12 @@ public final class AppRestrictionController { static final String KEY_BG_PROMPT_FGS_WITH_NOTIFICATION_TO_BG_RESTRICTED = DEVICE_CONFIG_SUBNAMESPACE_PREFIX + "prompt_fgs_with_noti_to_bg_restricted"; + /** + * The list of packages to be exempted from all these background restrictions. + */ + static final String KEY_BG_RESTRICTION_EXEMPTED_PACKAGES = + DEVICE_CONFIG_SUBNAMESPACE_PREFIX + "restriction_exempted_packages"; + static final boolean DEFAULT_BG_AUTO_RESTRICTED_BUCKET_ON_BG_RESTRICTION = false; static final long DEFAULT_BG_ABUSIVE_NOTIFICATION_MINIMAL_INTERVAL_MS = 24 * 60 * 60 * 1000; @@ -569,6 +579,13 @@ public final class AppRestrictionController { volatile long mBgNotificationMinIntervalMs; + /** + * @see #KEY_BG_RESTRICTION_EXEMPTED_PACKAGES. + * + *
Mutations on them would result in copy-on-write.
+ */ + volatile Set