Loading services/core/java/com/android/server/am/ActivityManagerConstants.java +109 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,12 @@ final class ActivityManagerConstants extends ContentObserver { private static final String KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL = "deferred_fgs_notification_interval"; /** * Same as {@link #KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL} but for "short FGS". */ private static final String KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT = "deferred_fgs_notification_interval_for_short"; /** * Time in milliseconds; once an FGS notification for a given uid has been * deferred, no subsequent FGS notification from that uid will be deferred Loading @@ -326,6 +332,12 @@ final class ActivityManagerConstants extends ContentObserver { private static final String KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME = "deferred_fgs_notification_exclusion_time"; /** * Same as {@link #KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME} but for "short FGS". */ private static final String KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT = "deferred_fgs_notification_exclusion_time_for_short"; /** * Default value for mPushMessagingOverQuotaBehavior if not explicitly set in * Settings.Global. Loading Loading @@ -583,10 +595,21 @@ final class ActivityManagerConstants extends ContentObserver { // the foreground state. volatile long mFgsNotificationDeferralInterval = 10_000; /** * Same as {@link #mFgsNotificationDeferralInterval} but used for "short FGS". */ volatile long mFgsNotificationDeferralIntervalForShort = mFgsNotificationDeferralInterval; // Rate limit: minimum time after an app's FGS notification is deferred // before another FGS notification from that app can be deferred. volatile long mFgsNotificationDeferralExclusionTime = 2 * 60 * 1000L; /** * Same as {@link #mFgsNotificationDeferralExclusionTime} but used for "short FGS". */ volatile long mFgsNotificationDeferralExclusionTimeForShort = mFgsNotificationDeferralExclusionTime; /** * When server pushing message is over the quote, select one of the temp allow list type as * defined in {@link PowerExemptionManager.TempAllowListType} Loading Loading @@ -923,6 +946,32 @@ final class ActivityManagerConstants extends ContentObserver { public static boolean PROACTIVE_KILLS_ENABLED = DEFAULT_PROACTIVE_KILLS_ENABLED; public static float LOW_SWAP_THRESHOLD_PERCENT = DEFAULT_LOW_SWAP_THRESHOLD_PERCENT; /** Timeout for a "short service" FGS, in milliseconds. */ private static final String KEY_SHORT_FGS_TIMEOUT_DURATION = "short_fgs_timeout_duration"; /** @see #KEY_SHORT_FGS_TIMEOUT_DURATION */ static final long DEFAULT_SHORT_FGS_TIMEOUT_DURATION = 60_000; /** @see #KEY_SHORT_FGS_TIMEOUT_DURATION */ public static volatile long mShortFgsTimeoutDuration = DEFAULT_SHORT_FGS_TIMEOUT_DURATION; /** * If a "short service" doesn't finish within this after the timeout ( * {@link #KEY_SHORT_FGS_TIMEOUT_DURATION}), then we'll declare an ANR. * i.e. if the timeout is 60 seconds, and this ANR extra duration is 5 seconds, then * the app will be ANR'ed in 65 seconds after a short service starts and it's not stopped. */ private static final String KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION = "short_fgs_anr_extra_wait_duration"; /** @see #KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION */ static final long DEFAULT_SHORT_FGS_ANR_EXTRA_WAIT_DURATION = 5_000; /** @see #KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION */ public static volatile long mShortFgsAnrExtraWaitDuration = DEFAULT_SHORT_FGS_ANR_EXTRA_WAIT_DURATION; private final OnPropertiesChangedListener mOnDeviceConfigChangedListener = new OnPropertiesChangedListener() { @Override Loading Loading @@ -962,6 +1011,12 @@ final class ActivityManagerConstants extends ContentObserver { case KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME: updateFgsNotificationDeferralExclusionTime(); break; case KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT: updateFgsNotificationDeferralIntervalForShort(); break; case KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT: updateFgsNotificationDeferralExclusionTimeForShort(); break; case KEY_PUSH_MESSAGING_OVER_QUOTA_BEHAVIOR: updatePushMessagingOverQuotaBehavior(); break; Loading Loading @@ -1058,6 +1113,12 @@ final class ActivityManagerConstants extends ContentObserver { case KEY_MAX_SERVICE_CONNECTIONS_PER_PROCESS: updateMaxServiceConnectionsPerProcess(); break; case KEY_SHORT_FGS_TIMEOUT_DURATION: updateShortFgsTimeoutDuration(); break; case KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION: updateShortFgsAnrExtraWaitDuration(); break; case KEY_PROACTIVE_KILLS_ENABLED: updateProactiveKillsEnabled(); break; Loading Loading @@ -1374,6 +1435,13 @@ final class ActivityManagerConstants extends ContentObserver { /*default value*/ 10_000L); } private void updateFgsNotificationDeferralIntervalForShort() { mFgsNotificationDeferralIntervalForShort = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT, /*default value*/ 10_000L); } private void updateFgsNotificationDeferralExclusionTime() { mFgsNotificationDeferralExclusionTime = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, Loading @@ -1381,6 +1449,13 @@ final class ActivityManagerConstants extends ContentObserver { /*default value*/ 2 * 60 * 1000L); } private void updateFgsNotificationDeferralExclusionTimeForShort() { mFgsNotificationDeferralExclusionTimeForShort = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT, /*default value*/ 2 * 60 * 1000L); } private void updatePushMessagingOverQuotaBehavior() { mPushMessagingOverQuotaBehavior = DeviceConfig.getInt( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, Loading Loading @@ -1746,6 +1821,20 @@ final class ActivityManagerConstants extends ContentObserver { DEFAULT_MAX_SERVICE_CONNECTIONS_PER_PROCESS); } private void updateShortFgsTimeoutDuration() { mShortFgsTimeoutDuration = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_SHORT_FGS_TIMEOUT_DURATION, DEFAULT_SHORT_FGS_TIMEOUT_DURATION); } private void updateShortFgsAnrExtraWaitDuration() { mShortFgsAnrExtraWaitDuration = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION, DEFAULT_SHORT_FGS_ANR_EXTRA_WAIT_DURATION); } @NeverCompile // Avoid size overhead of debugging code. void dump(PrintWriter pw) { pw.println("ACTIVITY MANAGER SETTINGS (dumpsys activity settings) " Loading Loading @@ -1903,6 +1992,26 @@ final class ActivityManagerConstants extends ContentObserver { pw.print(" "); pw.print(KEY_LOW_SWAP_THRESHOLD_PERCENT); pw.print("="); pw.println(LOW_SWAP_THRESHOLD_PERCENT); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATIONS_ENABLED); pw.print("="); pw.println(mFlagFgsNotificationDeferralEnabled); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATIONS_API_GATED); pw.print("="); pw.println(mFlagFgsNotificationDeferralApiGated); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL); pw.print("="); pw.println(mFgsNotificationDeferralInterval); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT); pw.print("="); pw.println(mFgsNotificationDeferralIntervalForShort); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME); pw.print("="); pw.println(mFgsNotificationDeferralExclusionTime); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT); pw.print("="); pw.println(mFgsNotificationDeferralExclusionTimeForShort); pw.print(" "); pw.print(KEY_SHORT_FGS_TIMEOUT_DURATION); pw.print("="); pw.println(mShortFgsTimeoutDuration); pw.print(" "); pw.print(KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION); pw.print("="); pw.println(mShortFgsAnrExtraWaitDuration); pw.println(); if (mOverrideMaxCachedProcesses >= 0) { pw.print(" mOverrideMaxCachedProcesses="); pw.println(mOverrideMaxCachedProcesses); Loading Loading
services/core/java/com/android/server/am/ActivityManagerConstants.java +109 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,12 @@ final class ActivityManagerConstants extends ContentObserver { private static final String KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL = "deferred_fgs_notification_interval"; /** * Same as {@link #KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL} but for "short FGS". */ private static final String KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT = "deferred_fgs_notification_interval_for_short"; /** * Time in milliseconds; once an FGS notification for a given uid has been * deferred, no subsequent FGS notification from that uid will be deferred Loading @@ -326,6 +332,12 @@ final class ActivityManagerConstants extends ContentObserver { private static final String KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME = "deferred_fgs_notification_exclusion_time"; /** * Same as {@link #KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME} but for "short FGS". */ private static final String KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT = "deferred_fgs_notification_exclusion_time_for_short"; /** * Default value for mPushMessagingOverQuotaBehavior if not explicitly set in * Settings.Global. Loading Loading @@ -583,10 +595,21 @@ final class ActivityManagerConstants extends ContentObserver { // the foreground state. volatile long mFgsNotificationDeferralInterval = 10_000; /** * Same as {@link #mFgsNotificationDeferralInterval} but used for "short FGS". */ volatile long mFgsNotificationDeferralIntervalForShort = mFgsNotificationDeferralInterval; // Rate limit: minimum time after an app's FGS notification is deferred // before another FGS notification from that app can be deferred. volatile long mFgsNotificationDeferralExclusionTime = 2 * 60 * 1000L; /** * Same as {@link #mFgsNotificationDeferralExclusionTime} but used for "short FGS". */ volatile long mFgsNotificationDeferralExclusionTimeForShort = mFgsNotificationDeferralExclusionTime; /** * When server pushing message is over the quote, select one of the temp allow list type as * defined in {@link PowerExemptionManager.TempAllowListType} Loading Loading @@ -923,6 +946,32 @@ final class ActivityManagerConstants extends ContentObserver { public static boolean PROACTIVE_KILLS_ENABLED = DEFAULT_PROACTIVE_KILLS_ENABLED; public static float LOW_SWAP_THRESHOLD_PERCENT = DEFAULT_LOW_SWAP_THRESHOLD_PERCENT; /** Timeout for a "short service" FGS, in milliseconds. */ private static final String KEY_SHORT_FGS_TIMEOUT_DURATION = "short_fgs_timeout_duration"; /** @see #KEY_SHORT_FGS_TIMEOUT_DURATION */ static final long DEFAULT_SHORT_FGS_TIMEOUT_DURATION = 60_000; /** @see #KEY_SHORT_FGS_TIMEOUT_DURATION */ public static volatile long mShortFgsTimeoutDuration = DEFAULT_SHORT_FGS_TIMEOUT_DURATION; /** * If a "short service" doesn't finish within this after the timeout ( * {@link #KEY_SHORT_FGS_TIMEOUT_DURATION}), then we'll declare an ANR. * i.e. if the timeout is 60 seconds, and this ANR extra duration is 5 seconds, then * the app will be ANR'ed in 65 seconds after a short service starts and it's not stopped. */ private static final String KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION = "short_fgs_anr_extra_wait_duration"; /** @see #KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION */ static final long DEFAULT_SHORT_FGS_ANR_EXTRA_WAIT_DURATION = 5_000; /** @see #KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION */ public static volatile long mShortFgsAnrExtraWaitDuration = DEFAULT_SHORT_FGS_ANR_EXTRA_WAIT_DURATION; private final OnPropertiesChangedListener mOnDeviceConfigChangedListener = new OnPropertiesChangedListener() { @Override Loading Loading @@ -962,6 +1011,12 @@ final class ActivityManagerConstants extends ContentObserver { case KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME: updateFgsNotificationDeferralExclusionTime(); break; case KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT: updateFgsNotificationDeferralIntervalForShort(); break; case KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT: updateFgsNotificationDeferralExclusionTimeForShort(); break; case KEY_PUSH_MESSAGING_OVER_QUOTA_BEHAVIOR: updatePushMessagingOverQuotaBehavior(); break; Loading Loading @@ -1058,6 +1113,12 @@ final class ActivityManagerConstants extends ContentObserver { case KEY_MAX_SERVICE_CONNECTIONS_PER_PROCESS: updateMaxServiceConnectionsPerProcess(); break; case KEY_SHORT_FGS_TIMEOUT_DURATION: updateShortFgsTimeoutDuration(); break; case KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION: updateShortFgsAnrExtraWaitDuration(); break; case KEY_PROACTIVE_KILLS_ENABLED: updateProactiveKillsEnabled(); break; Loading Loading @@ -1374,6 +1435,13 @@ final class ActivityManagerConstants extends ContentObserver { /*default value*/ 10_000L); } private void updateFgsNotificationDeferralIntervalForShort() { mFgsNotificationDeferralIntervalForShort = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT, /*default value*/ 10_000L); } private void updateFgsNotificationDeferralExclusionTime() { mFgsNotificationDeferralExclusionTime = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, Loading @@ -1381,6 +1449,13 @@ final class ActivityManagerConstants extends ContentObserver { /*default value*/ 2 * 60 * 1000L); } private void updateFgsNotificationDeferralExclusionTimeForShort() { mFgsNotificationDeferralExclusionTimeForShort = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT, /*default value*/ 2 * 60 * 1000L); } private void updatePushMessagingOverQuotaBehavior() { mPushMessagingOverQuotaBehavior = DeviceConfig.getInt( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, Loading Loading @@ -1746,6 +1821,20 @@ final class ActivityManagerConstants extends ContentObserver { DEFAULT_MAX_SERVICE_CONNECTIONS_PER_PROCESS); } private void updateShortFgsTimeoutDuration() { mShortFgsTimeoutDuration = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_SHORT_FGS_TIMEOUT_DURATION, DEFAULT_SHORT_FGS_TIMEOUT_DURATION); } private void updateShortFgsAnrExtraWaitDuration() { mShortFgsAnrExtraWaitDuration = DeviceConfig.getLong( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION, DEFAULT_SHORT_FGS_ANR_EXTRA_WAIT_DURATION); } @NeverCompile // Avoid size overhead of debugging code. void dump(PrintWriter pw) { pw.println("ACTIVITY MANAGER SETTINGS (dumpsys activity settings) " Loading Loading @@ -1903,6 +1992,26 @@ final class ActivityManagerConstants extends ContentObserver { pw.print(" "); pw.print(KEY_LOW_SWAP_THRESHOLD_PERCENT); pw.print("="); pw.println(LOW_SWAP_THRESHOLD_PERCENT); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATIONS_ENABLED); pw.print("="); pw.println(mFlagFgsNotificationDeferralEnabled); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATIONS_API_GATED); pw.print("="); pw.println(mFlagFgsNotificationDeferralApiGated); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL); pw.print("="); pw.println(mFgsNotificationDeferralInterval); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_INTERVAL_FOR_SHORT); pw.print("="); pw.println(mFgsNotificationDeferralIntervalForShort); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME); pw.print("="); pw.println(mFgsNotificationDeferralExclusionTime); pw.print(" "); pw.print(KEY_DEFERRED_FGS_NOTIFICATION_EXCLUSION_TIME_FOR_SHORT); pw.print("="); pw.println(mFgsNotificationDeferralExclusionTimeForShort); pw.print(" "); pw.print(KEY_SHORT_FGS_TIMEOUT_DURATION); pw.print("="); pw.println(mShortFgsTimeoutDuration); pw.print(" "); pw.print(KEY_SHORT_FGS_ANR_EXTRA_WAIT_DURATION); pw.print("="); pw.println(mShortFgsAnrExtraWaitDuration); pw.println(); if (mOverrideMaxCachedProcesses >= 0) { pw.print(" mOverrideMaxCachedProcesses="); pw.println(mOverrideMaxCachedProcesses); Loading