1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.am; 18 19 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_POWER_QUICK; 20 21 import android.app.ActivityThread; 22 import android.content.ContentResolver; 23 import android.content.Context; 24 import android.database.ContentObserver; 25 import android.net.Uri; 26 import android.os.Build; 27 import android.os.Handler; 28 import android.provider.DeviceConfig; 29 import android.provider.DeviceConfig.OnPropertiesChangedListener; 30 import android.provider.DeviceConfig.Properties; 31 import android.provider.Settings; 32 import android.text.TextUtils; 33 import android.util.ArraySet; 34 import android.util.KeyValueListParser; 35 import android.util.Slog; 36 37 import java.io.PrintWriter; 38 import java.util.Arrays; 39 import java.util.List; 40 import java.util.stream.Collectors; 41 42 /** 43 * Settings constants that can modify the activity manager's behavior. 44 */ 45 final class ActivityManagerConstants extends ContentObserver { 46 private static final String TAG = "ActivityManagerConstants"; 47 48 // Key names stored in the settings value. 49 private static final String KEY_BACKGROUND_SETTLE_TIME = "background_settle_time"; 50 private static final String KEY_FGSERVICE_MIN_SHOWN_TIME 51 = "fgservice_min_shown_time"; 52 private static final String KEY_FGSERVICE_MIN_REPORT_TIME 53 = "fgservice_min_report_time"; 54 private static final String KEY_FGSERVICE_SCREEN_ON_BEFORE_TIME 55 = "fgservice_screen_on_before_time"; 56 private static final String KEY_FGSERVICE_SCREEN_ON_AFTER_TIME 57 = "fgservice_screen_on_after_time"; 58 private static final String KEY_CONTENT_PROVIDER_RETAIN_TIME = "content_provider_retain_time"; 59 private static final String KEY_GC_TIMEOUT = "gc_timeout"; 60 private static final String KEY_GC_MIN_INTERVAL = "gc_min_interval"; 61 private static final String KEY_FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS = 62 "force_bg_check_on_restricted"; 63 private static final String KEY_FULL_PSS_MIN_INTERVAL = "full_pss_min_interval"; 64 private static final String KEY_FULL_PSS_LOWERED_INTERVAL = "full_pss_lowered_interval"; 65 private static final String KEY_POWER_CHECK_INTERVAL = "power_check_interval"; 66 private static final String KEY_POWER_CHECK_MAX_CPU_1 = "power_check_max_cpu_1"; 67 private static final String KEY_POWER_CHECK_MAX_CPU_2 = "power_check_max_cpu_2"; 68 private static final String KEY_POWER_CHECK_MAX_CPU_3 = "power_check_max_cpu_3"; 69 private static final String KEY_POWER_CHECK_MAX_CPU_4 = "power_check_max_cpu_4"; 70 private static final String KEY_SERVICE_USAGE_INTERACTION_TIME 71 = "service_usage_interaction_time"; 72 private static final String KEY_USAGE_STATS_INTERACTION_INTERVAL 73 = "usage_stats_interaction_interval"; 74 private static final String KEY_IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES = 75 "imperceptible_kill_exempt_packages"; 76 private static final String KEY_IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES = 77 "imperceptible_kill_exempt_proc_states"; 78 static final String KEY_SERVICE_RESTART_DURATION = "service_restart_duration"; 79 static final String KEY_SERVICE_RESET_RUN_DURATION = "service_reset_run_duration"; 80 static final String KEY_SERVICE_RESTART_DURATION_FACTOR = "service_restart_duration_factor"; 81 static final String KEY_SERVICE_MIN_RESTART_TIME_BETWEEN = "service_min_restart_time_between"; 82 static final String KEY_MAX_SERVICE_INACTIVITY = "service_max_inactivity"; 83 static final String KEY_BG_START_TIMEOUT = "service_bg_start_timeout"; 84 static final String KEY_SERVICE_BG_ACTIVITY_START_TIMEOUT = "service_bg_activity_start_timeout"; 85 static final String KEY_BOUND_SERVICE_CRASH_RESTART_DURATION = "service_crash_restart_duration"; 86 static final String KEY_BOUND_SERVICE_CRASH_MAX_RETRY = "service_crash_max_retry"; 87 static final String KEY_PROCESS_START_ASYNC = "process_start_async"; 88 static final String KEY_MEMORY_INFO_THROTTLE_TIME = "memory_info_throttle_time"; 89 static final String KEY_TOP_TO_FGS_GRACE_DURATION = "top_to_fgs_grace_duration"; 90 static final String KEY_PENDINGINTENT_WARNING_THRESHOLD = "pendingintent_warning_threshold"; 91 92 private static final int DEFAULT_MAX_CACHED_PROCESSES = 32; 93 private static final long DEFAULT_BACKGROUND_SETTLE_TIME = 60*1000; 94 private static final long DEFAULT_FGSERVICE_MIN_SHOWN_TIME = 2*1000; 95 private static final long DEFAULT_FGSERVICE_MIN_REPORT_TIME = 3*1000; 96 private static final long DEFAULT_FGSERVICE_SCREEN_ON_BEFORE_TIME = 1*1000; 97 private static final long DEFAULT_FGSERVICE_SCREEN_ON_AFTER_TIME = 5*1000; 98 private static final long DEFAULT_CONTENT_PROVIDER_RETAIN_TIME = 20*1000; 99 private static final long DEFAULT_GC_TIMEOUT = 5*1000; 100 private static final long DEFAULT_GC_MIN_INTERVAL = 60*1000; 101 private static final long DEFAULT_FULL_PSS_MIN_INTERVAL = 20*60*1000; 102 private static final boolean DEFAULT_FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS = true; 103 private static final long DEFAULT_FULL_PSS_LOWERED_INTERVAL = 5*60*1000; 104 private static final long DEFAULT_POWER_CHECK_INTERVAL = (DEBUG_POWER_QUICK ? 1 : 5) * 60*1000; 105 private static final int DEFAULT_POWER_CHECK_MAX_CPU_1 = 25; 106 private static final int DEFAULT_POWER_CHECK_MAX_CPU_2 = 25; 107 private static final int DEFAULT_POWER_CHECK_MAX_CPU_3 = 10; 108 private static final int DEFAULT_POWER_CHECK_MAX_CPU_4 = 2; 109 private static final long DEFAULT_SERVICE_USAGE_INTERACTION_TIME = 30*60*1000; 110 private static final long DEFAULT_USAGE_STATS_INTERACTION_INTERVAL = 2*60*60*1000L; 111 private static final long DEFAULT_SERVICE_RESTART_DURATION = 1*1000; 112 private static final long DEFAULT_SERVICE_RESET_RUN_DURATION = 60*1000; 113 private static final int DEFAULT_SERVICE_RESTART_DURATION_FACTOR = 4; 114 private static final long DEFAULT_SERVICE_MIN_RESTART_TIME_BETWEEN = 10*1000; 115 private static final long DEFAULT_MAX_SERVICE_INACTIVITY = 30*60*1000; 116 private static final long DEFAULT_BG_START_TIMEOUT = 15*1000; 117 private static final long DEFAULT_SERVICE_BG_ACTIVITY_START_TIMEOUT = 10_000; 118 private static final long DEFAULT_BOUND_SERVICE_CRASH_RESTART_DURATION = 30*60_000; 119 private static final int DEFAULT_BOUND_SERVICE_CRASH_MAX_RETRY = 16; 120 private static final boolean DEFAULT_PROCESS_START_ASYNC = true; 121 private static final long DEFAULT_MEMORY_INFO_THROTTLE_TIME = 5*60*1000; 122 private static final long DEFAULT_TOP_TO_FGS_GRACE_DURATION = 15 * 1000; 123 private static final int DEFAULT_PENDINGINTENT_WARNING_THRESHOLD = 2000; 124 125 // Flag stored in the DeviceConfig API. 126 /** 127 * Maximum number of cached processes. 128 */ 129 private static final String KEY_MAX_CACHED_PROCESSES = "max_cached_processes"; 130 131 /** 132 * Default value for mFlagBackgroundActivityStartsEnabled if not explicitly set in 133 * Settings.Global. This allows it to be set experimentally unless it has been 134 * enabled/disabled in developer options. Defaults to false. 135 */ 136 private static final String KEY_DEFAULT_BACKGROUND_ACTIVITY_STARTS_ENABLED = 137 "default_background_activity_starts_enabled"; 138 139 /** 140 * Default value for mFlagBackgroundFgsStartRestrictionEnabled if not explicitly set in 141 * Settings.Global. 142 */ 143 private static final String KEY_DEFAULT_BACKGROUND_FGS_STARTS_RESTRICTION_ENABLED = 144 "default_background_fgs_starts_restriction_enabled"; 145 146 // Maximum number of cached processes we will allow. 147 public int MAX_CACHED_PROCESSES = DEFAULT_MAX_CACHED_PROCESSES; 148 149 // This is the amount of time we allow an app to settle after it goes into the background, 150 // before we start restricting what it can do. 151 public long BACKGROUND_SETTLE_TIME = DEFAULT_BACKGROUND_SETTLE_TIME; 152 153 // The minimum time we allow a foreground service to run with a notification and the 154 // screen on without otherwise telling the user about it. (If it runs for less than this, 155 // it will still be reported to the user as a running app for at least this amount of time.) 156 public long FGSERVICE_MIN_SHOWN_TIME = DEFAULT_FGSERVICE_MIN_SHOWN_TIME; 157 158 // If a foreground service is shown for less than FGSERVICE_MIN_SHOWN_TIME, we will display 159 // the background app running notification about it for at least this amount of time (if it 160 // is larger than the remaining shown time). 161 public long FGSERVICE_MIN_REPORT_TIME = DEFAULT_FGSERVICE_MIN_REPORT_TIME; 162 163 // The minimum amount of time the foreground service needs to have remain being shown 164 // before the screen goes on for us to consider it not worth showing to the user. That is 165 // if an app has a foreground service that stops itself this amount of time or more before 166 // the user turns on the screen, we will just let it go without the user being told about it. 167 public long FGSERVICE_SCREEN_ON_BEFORE_TIME = DEFAULT_FGSERVICE_SCREEN_ON_BEFORE_TIME; 168 169 // The minimum amount of time a foreground service should remain reported to the user if 170 // it is stopped when the screen turns on. This is the time from when the screen turns 171 // on until we will stop reporting it. 172 public long FGSERVICE_SCREEN_ON_AFTER_TIME = DEFAULT_FGSERVICE_SCREEN_ON_AFTER_TIME; 173 174 // How long we will retain processes hosting content providers in the "last activity" 175 // state before allowing them to drop down to the regular cached LRU list. This is 176 // to avoid thrashing of provider processes under low memory situations. 177 long CONTENT_PROVIDER_RETAIN_TIME = DEFAULT_CONTENT_PROVIDER_RETAIN_TIME; 178 179 // How long to wait after going idle before forcing apps to GC. 180 long GC_TIMEOUT = DEFAULT_GC_TIMEOUT; 181 182 // The minimum amount of time between successive GC requests for a process. 183 long GC_MIN_INTERVAL = DEFAULT_GC_MIN_INTERVAL; 184 185 /** 186 * Whether or not Background Check should be forced on any apps in the 187 * {@link android.app.usage.UsageStatsManager#STANDBY_BUCKET_RESTRICTED} bucket, 188 * regardless of target SDK version. 189 */ 190 boolean FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS = 191 DEFAULT_FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS; 192 193 // The minimum amount of time between successive PSS requests for a process. 194 long FULL_PSS_MIN_INTERVAL = DEFAULT_FULL_PSS_MIN_INTERVAL; 195 196 // The minimum amount of time between successive PSS requests for a process 197 // when the request is due to the memory state being lowered. 198 long FULL_PSS_LOWERED_INTERVAL = DEFAULT_FULL_PSS_LOWERED_INTERVAL; 199 200 // The minimum sample duration we will allow before deciding we have 201 // enough data on CPU usage to start killing things. 202 long POWER_CHECK_INTERVAL = DEFAULT_POWER_CHECK_INTERVAL; 203 204 // The maximum CPU (as a percentage) a process is allowed to use over the first 205 // power check interval that it is cached. 206 int POWER_CHECK_MAX_CPU_1 = DEFAULT_POWER_CHECK_MAX_CPU_1; 207 208 // The maximum CPU (as a percentage) a process is allowed to use over the second 209 // power check interval that it is cached. The home app will never check for less 210 // CPU than this (it will not test against the 3 or 4 levels). 211 int POWER_CHECK_MAX_CPU_2 = DEFAULT_POWER_CHECK_MAX_CPU_2; 212 213 // The maximum CPU (as a percentage) a process is allowed to use over the third 214 // power check interval that it is cached. 215 int POWER_CHECK_MAX_CPU_3 = DEFAULT_POWER_CHECK_MAX_CPU_3; 216 217 // The maximum CPU (as a percentage) a process is allowed to use over the fourth 218 // power check interval that it is cached. 219 int POWER_CHECK_MAX_CPU_4 = DEFAULT_POWER_CHECK_MAX_CPU_4; 220 221 // This is the amount of time an app needs to be running a foreground service before 222 // we will consider it to be doing interaction for usage stats. 223 long SERVICE_USAGE_INTERACTION_TIME = DEFAULT_SERVICE_USAGE_INTERACTION_TIME; 224 225 // Maximum amount of time we will allow to elapse before re-reporting usage stats 226 // interaction with foreground processes. 227 long USAGE_STATS_INTERACTION_INTERVAL = DEFAULT_USAGE_STATS_INTERACTION_INTERVAL; 228 229 // How long a service needs to be running until restarting its process 230 // is no longer considered to be a relaunch of the service. 231 public long SERVICE_RESTART_DURATION = DEFAULT_SERVICE_RESTART_DURATION; 232 233 // How long a service needs to be running until it will start back at 234 // SERVICE_RESTART_DURATION after being killed. 235 public long SERVICE_RESET_RUN_DURATION = DEFAULT_SERVICE_RESET_RUN_DURATION; 236 237 // Multiplying factor to increase restart duration time by, for each time 238 // a service is killed before it has run for SERVICE_RESET_RUN_DURATION. 239 public int SERVICE_RESTART_DURATION_FACTOR = DEFAULT_SERVICE_RESTART_DURATION_FACTOR; 240 241 // The minimum amount of time between restarting services that we allow. 242 // That is, when multiple services are restarting, we won't allow each 243 // to restart less than this amount of time from the last one. 244 public long SERVICE_MIN_RESTART_TIME_BETWEEN = DEFAULT_SERVICE_MIN_RESTART_TIME_BETWEEN; 245 246 // Maximum amount of time for there to be no activity on a service before 247 // we consider it non-essential and allow its process to go on the 248 // LRU background list. 249 public long MAX_SERVICE_INACTIVITY = DEFAULT_MAX_SERVICE_INACTIVITY; 250 251 // How long we wait for a background started service to stop itself before 252 // allowing the next pending start to run. 253 public long BG_START_TIMEOUT = DEFAULT_BG_START_TIMEOUT; 254 255 // For how long after a whitelisted service's start its process can start a background activity 256 public long SERVICE_BG_ACTIVITY_START_TIMEOUT = DEFAULT_SERVICE_BG_ACTIVITY_START_TIMEOUT; 257 258 // Initial backoff delay for retrying bound foreground services 259 public long BOUND_SERVICE_CRASH_RESTART_DURATION = DEFAULT_BOUND_SERVICE_CRASH_RESTART_DURATION; 260 261 // Maximum number of retries for bound foreground services that crash soon after start 262 public long BOUND_SERVICE_MAX_CRASH_RETRY = DEFAULT_BOUND_SERVICE_CRASH_MAX_RETRY; 263 264 // Indicates if the processes need to be started asynchronously. 265 public boolean FLAG_PROCESS_START_ASYNC = DEFAULT_PROCESS_START_ASYNC; 266 267 // The minimum time we allow between requests for the MemoryInfo of a process to 268 // throttle requests from apps. 269 public long MEMORY_INFO_THROTTLE_TIME = DEFAULT_MEMORY_INFO_THROTTLE_TIME; 270 271 // Allow app just moving from TOP to FOREGROUND_SERVICE to stay in a higher adj value for 272 // this long. 273 public long TOP_TO_FGS_GRACE_DURATION = DEFAULT_TOP_TO_FGS_GRACE_DURATION; 274 275 // Indicates whether the activity starts logging is enabled. 276 // Controlled by Settings.Global.ACTIVITY_STARTS_LOGGING_ENABLED 277 volatile boolean mFlagActivityStartsLoggingEnabled; 278 279 // Indicates whether the background activity starts is enabled. 280 // Controlled by Settings.Global.BACKGROUND_ACTIVITY_STARTS_ENABLED. 281 // If not set explicitly the default is controlled by DeviceConfig. 282 volatile boolean mFlagBackgroundActivityStartsEnabled; 283 284 // Indicates whether foreground service starts logging is enabled. 285 // Controlled by Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED 286 volatile boolean mFlagForegroundServiceStartsLoggingEnabled; 287 288 // Indicates whether the foreground service background start restriction is enabled. 289 // When the restriction is enabled, foreground service started from background will not have 290 // while-in-use permissions like location, camera and microphone. (The foreground service can be 291 // started, the restriction is on while-in-use permissions.) 292 volatile boolean mFlagBackgroundFgsStartRestrictionEnabled = true; 293 294 private final ActivityManagerService mService; 295 private ContentResolver mResolver; 296 private final KeyValueListParser mParser = new KeyValueListParser(','); 297 298 private int mOverrideMaxCachedProcesses = -1; 299 300 // The maximum number of cached processes we will keep around before killing them. 301 // NOTE: this constant is *only* a control to not let us go too crazy with 302 // keeping around processes on devices with large amounts of RAM. For devices that 303 // are tighter on RAM, the out of memory killer is responsible for killing background 304 // processes as RAM is needed, and we should *never* be relying on this limit to 305 // kill them. Also note that this limit only applies to cached background processes; 306 // we have no limit on the number of service, visible, foreground, or other such 307 // processes and the number of those processes does not count against the cached 308 // process limit. 309 public int CUR_MAX_CACHED_PROCESSES = DEFAULT_MAX_CACHED_PROCESSES; 310 311 // The maximum number of empty app processes we will let sit around. 312 public int CUR_MAX_EMPTY_PROCESSES = computeEmptyProcessLimit(CUR_MAX_CACHED_PROCESSES); 313 314 // The number of empty apps at which we don't consider it necessary to do 315 // memory trimming. 316 public int CUR_TRIM_EMPTY_PROCESSES = computeEmptyProcessLimit(MAX_CACHED_PROCESSES) / 2; 317 318 // The number of cached at which we don't consider it necessary to do 319 // memory trimming. 320 public int CUR_TRIM_CACHED_PROCESSES = 321 (MAX_CACHED_PROCESSES - computeEmptyProcessLimit(MAX_CACHED_PROCESSES)) / 3; 322 323 /** 324 * Packages that can't be killed even if it's requested to be killed on imperceptible. 325 */ 326 public ArraySet<String> IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES = new ArraySet<String>(); 327 328 /** 329 * Proc State that can't be killed even if it's requested to be killed on imperceptible. 330 */ 331 public ArraySet<Integer> IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES = new ArraySet<Integer>(); 332 333 /** 334 * The threshold for the amount of PendingIntent for each UID, there will be 335 * warning logs if the number goes beyond this threshold. 336 */ 337 public int PENDINGINTENT_WARNING_THRESHOLD = DEFAULT_PENDINGINTENT_WARNING_THRESHOLD; 338 339 private List<String> mDefaultImperceptibleKillExemptPackages; 340 private List<Integer> mDefaultImperceptibleKillExemptProcStates; 341 342 @SuppressWarnings("unused") 343 private static final int OOMADJ_UPDATE_POLICY_SLOW = 0; 344 private static final int OOMADJ_UPDATE_POLICY_QUICK = 1; 345 private static final int DEFAULT_OOMADJ_UPDATE_POLICY = OOMADJ_UPDATE_POLICY_QUICK; 346 347 private static final String KEY_OOMADJ_UPDATE_POLICY = "oomadj_update_policy"; 348 349 // Indicate if the oom adjuster should take the quick path to update the oom adj scores, 350 // in which no futher actions will be performed if there are no significant adj/proc state 351 // changes for the specific process; otherwise, use the traditonal slow path which would 352 // keep updating all processes in the LRU list. 353 public boolean OOMADJ_UPDATE_QUICK = DEFAULT_OOMADJ_UPDATE_POLICY == OOMADJ_UPDATE_POLICY_QUICK; 354 355 private static final long MIN_AUTOMATIC_HEAP_DUMP_PSS_THRESHOLD_BYTES = 100 * 1024; // 100 KB 356 357 private final boolean mSystemServerAutomaticHeapDumpEnabled; 358 359 /** Package to report to when the memory usage exceeds the limit. */ 360 private final String mSystemServerAutomaticHeapDumpPackageName; 361 362 /** Byte limit for dump heap monitoring. */ 363 private long mSystemServerAutomaticHeapDumpPssThresholdBytes; 364 365 private static final Uri ACTIVITY_MANAGER_CONSTANTS_URI = Settings.Global.getUriFor( 366 Settings.Global.ACTIVITY_MANAGER_CONSTANTS); 367 368 private static final Uri ACTIVITY_STARTS_LOGGING_ENABLED_URI = Settings.Global.getUriFor( 369 Settings.Global.ACTIVITY_STARTS_LOGGING_ENABLED); 370 371 private static final Uri FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED_URI = 372 Settings.Global.getUriFor( 373 Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED); 374 375 private static final Uri ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_URI = 376 Settings.Global.getUriFor(Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS); 377 378 /** 379 * The threshold to decide if a given association should be dumped into metrics. 380 */ 381 private static final long DEFAULT_MIN_ASSOC_LOG_DURATION = 5 * 60 * 1000; // 5 mins 382 383 private static final String KEY_MIN_ASSOC_LOG_DURATION = "min_assoc_log_duration"; 384 385 public static long MIN_ASSOC_LOG_DURATION = DEFAULT_MIN_ASSOC_LOG_DURATION; 386 387 private final OnPropertiesChangedListener mOnDeviceConfigChangedListener = 388 new OnPropertiesChangedListener() { 389 @Override 390 public void onPropertiesChanged(Properties properties) { 391 for (String name : properties.getKeyset()) { 392 if (name == null) { 393 return; 394 } 395 switch (name) { 396 case KEY_MAX_CACHED_PROCESSES: 397 updateMaxCachedProcesses(); 398 break; 399 case KEY_DEFAULT_BACKGROUND_ACTIVITY_STARTS_ENABLED: 400 updateBackgroundActivityStarts(); 401 break; 402 case KEY_DEFAULT_BACKGROUND_FGS_STARTS_RESTRICTION_ENABLED: 403 updateBackgroundFgsStartsRestriction(); 404 break; 405 case KEY_OOMADJ_UPDATE_POLICY: 406 updateOomAdjUpdatePolicy(); 407 break; 408 case KEY_IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES: 409 case KEY_IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES: 410 updateImperceptibleKillExemptions(); 411 break; 412 case KEY_FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS: 413 updateForceRestrictedBackgroundCheck(); 414 break; 415 case KEY_MIN_ASSOC_LOG_DURATION: 416 updateMinAssocLogDuration(); 417 break; 418 default: 419 break; 420 } 421 } 422 } 423 }; 424 ActivityManagerConstants(Context context, ActivityManagerService service, Handler handler)425 ActivityManagerConstants(Context context, ActivityManagerService service, Handler handler) { 426 super(handler); 427 mService = service; 428 mSystemServerAutomaticHeapDumpEnabled = Build.IS_DEBUGGABLE 429 && context.getResources().getBoolean( 430 com.android.internal.R.bool.config_debugEnableAutomaticSystemServerHeapDumps); 431 mSystemServerAutomaticHeapDumpPackageName = context.getPackageName(); 432 mSystemServerAutomaticHeapDumpPssThresholdBytes = Math.max( 433 MIN_AUTOMATIC_HEAP_DUMP_PSS_THRESHOLD_BYTES, 434 context.getResources().getInteger( 435 com.android.internal.R.integer.config_debugSystemServerPssThresholdBytes)); 436 mDefaultImperceptibleKillExemptPackages = Arrays.asList( 437 context.getResources().getStringArray( 438 com.android.internal.R.array.config_defaultImperceptibleKillingExemptionPkgs)); 439 mDefaultImperceptibleKillExemptProcStates = Arrays.stream( 440 context.getResources().getIntArray( 441 com.android.internal.R.array.config_defaultImperceptibleKillingExemptionProcStates)) 442 .boxed().collect(Collectors.toList()); 443 IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES.addAll(mDefaultImperceptibleKillExemptPackages); 444 IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES.addAll(mDefaultImperceptibleKillExemptProcStates); 445 } 446 start(ContentResolver resolver)447 public void start(ContentResolver resolver) { 448 mResolver = resolver; 449 mResolver.registerContentObserver(ACTIVITY_MANAGER_CONSTANTS_URI, false, this); 450 mResolver.registerContentObserver(ACTIVITY_STARTS_LOGGING_ENABLED_URI, false, this); 451 mResolver.registerContentObserver(FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED_URI, 452 false, this); 453 if (mSystemServerAutomaticHeapDumpEnabled) { 454 mResolver.registerContentObserver(ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_URI, 455 false, this); 456 } 457 updateConstants(); 458 if (mSystemServerAutomaticHeapDumpEnabled) { 459 updateEnableAutomaticSystemServerHeapDumps(); 460 } 461 DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, 462 ActivityThread.currentApplication().getMainExecutor(), 463 mOnDeviceConfigChangedListener); 464 loadDeviceConfigConstants(); 465 // The following read from Settings. 466 updateActivityStartsLoggingEnabled(); 467 updateForegroundServiceStartsLoggingEnabled(); 468 } 469 loadDeviceConfigConstants()470 private void loadDeviceConfigConstants() { 471 mOnDeviceConfigChangedListener.onPropertiesChanged( 472 DeviceConfig.getProperties(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER)); 473 } 474 setOverrideMaxCachedProcesses(int value)475 public void setOverrideMaxCachedProcesses(int value) { 476 mOverrideMaxCachedProcesses = value; 477 updateMaxCachedProcesses(); 478 } 479 getOverrideMaxCachedProcesses()480 public int getOverrideMaxCachedProcesses() { 481 return mOverrideMaxCachedProcesses; 482 } 483 computeEmptyProcessLimit(int totalProcessLimit)484 public static int computeEmptyProcessLimit(int totalProcessLimit) { 485 return totalProcessLimit/2; 486 } 487 488 @Override onChange(boolean selfChange, Uri uri)489 public void onChange(boolean selfChange, Uri uri) { 490 if (uri == null) return; 491 if (ACTIVITY_MANAGER_CONSTANTS_URI.equals(uri)) { 492 updateConstants(); 493 } else if (ACTIVITY_STARTS_LOGGING_ENABLED_URI.equals(uri)) { 494 updateActivityStartsLoggingEnabled(); 495 } else if (FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED_URI.equals(uri)) { 496 updateForegroundServiceStartsLoggingEnabled(); 497 } else if (ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_URI.equals(uri)) { 498 updateEnableAutomaticSystemServerHeapDumps(); 499 } 500 } 501 updateConstants()502 private void updateConstants() { 503 final String setting = Settings.Global.getString(mResolver, 504 Settings.Global.ACTIVITY_MANAGER_CONSTANTS); 505 synchronized (mService) { 506 try { 507 mParser.setString(setting); 508 } catch (IllegalArgumentException e) { 509 // Failed to parse the settings string, log this and move on 510 // with defaults. 511 Slog.e("ActivityManagerConstants", "Bad activity manager config settings", e); 512 } 513 BACKGROUND_SETTLE_TIME = mParser.getLong(KEY_BACKGROUND_SETTLE_TIME, 514 DEFAULT_BACKGROUND_SETTLE_TIME); 515 FGSERVICE_MIN_SHOWN_TIME = mParser.getLong(KEY_FGSERVICE_MIN_SHOWN_TIME, 516 DEFAULT_FGSERVICE_MIN_SHOWN_TIME); 517 FGSERVICE_MIN_REPORT_TIME = mParser.getLong(KEY_FGSERVICE_MIN_REPORT_TIME, 518 DEFAULT_FGSERVICE_MIN_REPORT_TIME); 519 FGSERVICE_SCREEN_ON_BEFORE_TIME = mParser.getLong(KEY_FGSERVICE_SCREEN_ON_BEFORE_TIME, 520 DEFAULT_FGSERVICE_SCREEN_ON_BEFORE_TIME); 521 FGSERVICE_SCREEN_ON_AFTER_TIME = mParser.getLong(KEY_FGSERVICE_SCREEN_ON_AFTER_TIME, 522 DEFAULT_FGSERVICE_SCREEN_ON_AFTER_TIME); 523 CONTENT_PROVIDER_RETAIN_TIME = mParser.getLong(KEY_CONTENT_PROVIDER_RETAIN_TIME, 524 DEFAULT_CONTENT_PROVIDER_RETAIN_TIME); 525 GC_TIMEOUT = mParser.getLong(KEY_GC_TIMEOUT, 526 DEFAULT_GC_TIMEOUT); 527 GC_MIN_INTERVAL = mParser.getLong(KEY_GC_MIN_INTERVAL, 528 DEFAULT_GC_MIN_INTERVAL); 529 FULL_PSS_MIN_INTERVAL = mParser.getLong(KEY_FULL_PSS_MIN_INTERVAL, 530 DEFAULT_FULL_PSS_MIN_INTERVAL); 531 FULL_PSS_LOWERED_INTERVAL = mParser.getLong(KEY_FULL_PSS_LOWERED_INTERVAL, 532 DEFAULT_FULL_PSS_LOWERED_INTERVAL); 533 POWER_CHECK_INTERVAL = mParser.getLong(KEY_POWER_CHECK_INTERVAL, 534 DEFAULT_POWER_CHECK_INTERVAL); 535 POWER_CHECK_MAX_CPU_1 = mParser.getInt(KEY_POWER_CHECK_MAX_CPU_1, 536 DEFAULT_POWER_CHECK_MAX_CPU_1); 537 POWER_CHECK_MAX_CPU_2 = mParser.getInt(KEY_POWER_CHECK_MAX_CPU_2, 538 DEFAULT_POWER_CHECK_MAX_CPU_2); 539 POWER_CHECK_MAX_CPU_3 = mParser.getInt(KEY_POWER_CHECK_MAX_CPU_3, 540 DEFAULT_POWER_CHECK_MAX_CPU_3); 541 POWER_CHECK_MAX_CPU_4 = mParser.getInt(KEY_POWER_CHECK_MAX_CPU_4, 542 DEFAULT_POWER_CHECK_MAX_CPU_4); 543 SERVICE_USAGE_INTERACTION_TIME = mParser.getLong(KEY_SERVICE_USAGE_INTERACTION_TIME, 544 DEFAULT_SERVICE_USAGE_INTERACTION_TIME); 545 USAGE_STATS_INTERACTION_INTERVAL = mParser.getLong(KEY_USAGE_STATS_INTERACTION_INTERVAL, 546 DEFAULT_USAGE_STATS_INTERACTION_INTERVAL); 547 SERVICE_RESTART_DURATION = mParser.getLong(KEY_SERVICE_RESTART_DURATION, 548 DEFAULT_SERVICE_RESTART_DURATION); 549 SERVICE_RESET_RUN_DURATION = mParser.getLong(KEY_SERVICE_RESET_RUN_DURATION, 550 DEFAULT_SERVICE_RESET_RUN_DURATION); 551 SERVICE_RESTART_DURATION_FACTOR = mParser.getInt(KEY_SERVICE_RESTART_DURATION_FACTOR, 552 DEFAULT_SERVICE_RESTART_DURATION_FACTOR); 553 SERVICE_MIN_RESTART_TIME_BETWEEN = mParser.getLong(KEY_SERVICE_MIN_RESTART_TIME_BETWEEN, 554 DEFAULT_SERVICE_MIN_RESTART_TIME_BETWEEN); 555 MAX_SERVICE_INACTIVITY = mParser.getLong(KEY_MAX_SERVICE_INACTIVITY, 556 DEFAULT_MAX_SERVICE_INACTIVITY); 557 BG_START_TIMEOUT = mParser.getLong(KEY_BG_START_TIMEOUT, 558 DEFAULT_BG_START_TIMEOUT); 559 SERVICE_BG_ACTIVITY_START_TIMEOUT = mParser.getLong( 560 KEY_SERVICE_BG_ACTIVITY_START_TIMEOUT, 561 DEFAULT_SERVICE_BG_ACTIVITY_START_TIMEOUT); 562 BOUND_SERVICE_CRASH_RESTART_DURATION = mParser.getLong( 563 KEY_BOUND_SERVICE_CRASH_RESTART_DURATION, 564 DEFAULT_BOUND_SERVICE_CRASH_RESTART_DURATION); 565 BOUND_SERVICE_MAX_CRASH_RETRY = mParser.getInt(KEY_BOUND_SERVICE_CRASH_MAX_RETRY, 566 DEFAULT_BOUND_SERVICE_CRASH_MAX_RETRY); 567 FLAG_PROCESS_START_ASYNC = mParser.getBoolean(KEY_PROCESS_START_ASYNC, 568 DEFAULT_PROCESS_START_ASYNC); 569 MEMORY_INFO_THROTTLE_TIME = mParser.getLong(KEY_MEMORY_INFO_THROTTLE_TIME, 570 DEFAULT_MEMORY_INFO_THROTTLE_TIME); 571 TOP_TO_FGS_GRACE_DURATION = mParser.getDurationMillis(KEY_TOP_TO_FGS_GRACE_DURATION, 572 DEFAULT_TOP_TO_FGS_GRACE_DURATION); 573 PENDINGINTENT_WARNING_THRESHOLD = mParser.getInt(KEY_PENDINGINTENT_WARNING_THRESHOLD, 574 DEFAULT_PENDINGINTENT_WARNING_THRESHOLD); 575 576 // For new flags that are intended for server-side experiments, please use the new 577 // DeviceConfig package. 578 } 579 } 580 updateActivityStartsLoggingEnabled()581 private void updateActivityStartsLoggingEnabled() { 582 mFlagActivityStartsLoggingEnabled = Settings.Global.getInt(mResolver, 583 Settings.Global.ACTIVITY_STARTS_LOGGING_ENABLED, 1) == 1; 584 } 585 updateBackgroundActivityStarts()586 private void updateBackgroundActivityStarts() { 587 mFlagBackgroundActivityStartsEnabled = DeviceConfig.getBoolean( 588 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, 589 KEY_DEFAULT_BACKGROUND_ACTIVITY_STARTS_ENABLED, 590 /*defaultValue*/ false); 591 } 592 updateForegroundServiceStartsLoggingEnabled()593 private void updateForegroundServiceStartsLoggingEnabled() { 594 mFlagForegroundServiceStartsLoggingEnabled = Settings.Global.getInt(mResolver, 595 Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED, 1) == 1; 596 } updateBackgroundFgsStartsRestriction()597 private void updateBackgroundFgsStartsRestriction() { 598 mFlagBackgroundFgsStartRestrictionEnabled = DeviceConfig.getBoolean( 599 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, 600 KEY_DEFAULT_BACKGROUND_FGS_STARTS_RESTRICTION_ENABLED, 601 /*defaultValue*/ true); 602 } 603 updateOomAdjUpdatePolicy()604 private void updateOomAdjUpdatePolicy() { 605 OOMADJ_UPDATE_QUICK = DeviceConfig.getInt( 606 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, 607 KEY_OOMADJ_UPDATE_POLICY, 608 /* defaultValue */ DEFAULT_OOMADJ_UPDATE_POLICY) 609 == OOMADJ_UPDATE_POLICY_QUICK; 610 } 611 updateForceRestrictedBackgroundCheck()612 private void updateForceRestrictedBackgroundCheck() { 613 FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS = DeviceConfig.getBoolean( 614 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, 615 KEY_FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS, 616 DEFAULT_FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS); 617 } 618 updateImperceptibleKillExemptions()619 private void updateImperceptibleKillExemptions() { 620 IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES.clear(); 621 IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES.addAll(mDefaultImperceptibleKillExemptPackages); 622 String val = DeviceConfig.getString(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, 623 KEY_IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES, null); 624 if (!TextUtils.isEmpty(val)) { 625 IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES.addAll(Arrays.asList(val.split(","))); 626 } 627 628 IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES.clear(); 629 IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES.addAll(mDefaultImperceptibleKillExemptProcStates); 630 val = DeviceConfig.getString(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, 631 KEY_IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES, null); 632 if (!TextUtils.isEmpty(val)) { 633 Arrays.asList(val.split(",")).stream().forEach((v) -> { 634 try { 635 IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES.add(Integer.parseInt(v)); 636 } catch (NumberFormatException e) { 637 } 638 }); 639 } 640 } 641 updateEnableAutomaticSystemServerHeapDumps()642 private void updateEnableAutomaticSystemServerHeapDumps() { 643 if (!mSystemServerAutomaticHeapDumpEnabled) { 644 Slog.wtf(TAG, 645 "updateEnableAutomaticSystemServerHeapDumps called when leak detection " 646 + "disabled"); 647 return; 648 } 649 // Monitoring is on by default, so if the setting hasn't been set by the user, 650 // monitoring should be on. 651 final boolean enabled = Settings.Global.getInt(mResolver, 652 Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, 1) == 1; 653 654 // Setting the threshold to 0 stops the checking. 655 final long threshold = enabled ? mSystemServerAutomaticHeapDumpPssThresholdBytes : 0; 656 mService.setDumpHeapDebugLimit(null, 0, threshold, 657 mSystemServerAutomaticHeapDumpPackageName); 658 } 659 updateMaxCachedProcesses()660 private void updateMaxCachedProcesses() { 661 String maxCachedProcessesFlag = DeviceConfig.getProperty( 662 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_MAX_CACHED_PROCESSES); 663 try { 664 CUR_MAX_CACHED_PROCESSES = mOverrideMaxCachedProcesses < 0 665 ? (TextUtils.isEmpty(maxCachedProcessesFlag) 666 ? DEFAULT_MAX_CACHED_PROCESSES : Integer.parseInt(maxCachedProcessesFlag)) 667 : mOverrideMaxCachedProcesses; 668 } catch (NumberFormatException e) { 669 // Bad flag value from Phenotype, revert to default. 670 Slog.e(TAG, 671 "Unable to parse flag for max_cached_processes: " + maxCachedProcessesFlag, e); 672 CUR_MAX_CACHED_PROCESSES = DEFAULT_MAX_CACHED_PROCESSES; 673 } 674 CUR_MAX_EMPTY_PROCESSES = computeEmptyProcessLimit(CUR_MAX_CACHED_PROCESSES); 675 676 // Note the trim levels do NOT depend on the override process limit, we want 677 // to consider the same level the point where we do trimming regardless of any 678 // additional enforced limit. 679 final int rawMaxEmptyProcesses = computeEmptyProcessLimit(MAX_CACHED_PROCESSES); 680 CUR_TRIM_EMPTY_PROCESSES = rawMaxEmptyProcesses/2; 681 CUR_TRIM_CACHED_PROCESSES = (MAX_CACHED_PROCESSES-rawMaxEmptyProcesses)/3; 682 } 683 684 private void updateMinAssocLogDuration() { 685 MIN_ASSOC_LOG_DURATION = DeviceConfig.getLong( 686 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_MIN_ASSOC_LOG_DURATION, 687 /* defaultValue */ DEFAULT_MIN_ASSOC_LOG_DURATION); 688 } 689 690 void dump(PrintWriter pw) { 691 pw.println("ACTIVITY MANAGER SETTINGS (dumpsys activity settings) " 692 + Settings.Global.ACTIVITY_MANAGER_CONSTANTS + ":"); 693 694 pw.print(" "); pw.print(KEY_MAX_CACHED_PROCESSES); pw.print("="); 695 pw.println(MAX_CACHED_PROCESSES); 696 pw.print(" "); pw.print(KEY_BACKGROUND_SETTLE_TIME); pw.print("="); 697 pw.println(BACKGROUND_SETTLE_TIME); 698 pw.print(" "); pw.print(KEY_FGSERVICE_MIN_SHOWN_TIME); pw.print("="); 699 pw.println(FGSERVICE_MIN_SHOWN_TIME); 700 pw.print(" "); pw.print(KEY_FGSERVICE_MIN_REPORT_TIME); pw.print("="); 701 pw.println(FGSERVICE_MIN_REPORT_TIME); 702 pw.print(" "); pw.print(KEY_FGSERVICE_SCREEN_ON_BEFORE_TIME); pw.print("="); 703 pw.println(FGSERVICE_SCREEN_ON_BEFORE_TIME); 704 pw.print(" "); pw.print(KEY_FGSERVICE_SCREEN_ON_AFTER_TIME); pw.print("="); 705 pw.println(FGSERVICE_SCREEN_ON_AFTER_TIME); 706 pw.print(" "); pw.print(KEY_CONTENT_PROVIDER_RETAIN_TIME); pw.print("="); 707 pw.println(CONTENT_PROVIDER_RETAIN_TIME); 708 pw.print(" "); pw.print(KEY_GC_TIMEOUT); pw.print("="); 709 pw.println(GC_TIMEOUT); 710 pw.print(" "); pw.print(KEY_GC_MIN_INTERVAL); pw.print("="); 711 pw.println(GC_MIN_INTERVAL); 712 pw.print(" "); pw.print(KEY_FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS); pw.print("="); 713 pw.println(FORCE_BACKGROUND_CHECK_ON_RESTRICTED_APPS); 714 pw.print(" "); pw.print(KEY_FULL_PSS_MIN_INTERVAL); pw.print("="); 715 pw.println(FULL_PSS_MIN_INTERVAL); 716 pw.print(" "); pw.print(KEY_FULL_PSS_LOWERED_INTERVAL); pw.print("="); 717 pw.println(FULL_PSS_LOWERED_INTERVAL); 718 pw.print(" "); pw.print(KEY_POWER_CHECK_INTERVAL); pw.print("="); 719 pw.println(POWER_CHECK_INTERVAL); 720 pw.print(" "); pw.print(KEY_POWER_CHECK_MAX_CPU_1); pw.print("="); 721 pw.println(POWER_CHECK_MAX_CPU_1); 722 pw.print(" "); pw.print(KEY_POWER_CHECK_MAX_CPU_2); pw.print("="); 723 pw.println(POWER_CHECK_MAX_CPU_2); 724 pw.print(" "); pw.print(KEY_POWER_CHECK_MAX_CPU_3); pw.print("="); 725 pw.println(POWER_CHECK_MAX_CPU_3); 726 pw.print(" "); pw.print(KEY_POWER_CHECK_MAX_CPU_4); pw.print("="); 727 pw.println(POWER_CHECK_MAX_CPU_4); 728 pw.print(" "); pw.print(KEY_SERVICE_USAGE_INTERACTION_TIME); pw.print("="); 729 pw.println(SERVICE_USAGE_INTERACTION_TIME); 730 pw.print(" "); pw.print(KEY_USAGE_STATS_INTERACTION_INTERVAL); pw.print("="); 731 pw.println(USAGE_STATS_INTERACTION_INTERVAL); 732 pw.print(" "); pw.print(KEY_SERVICE_RESTART_DURATION); pw.print("="); 733 pw.println(SERVICE_RESTART_DURATION); 734 pw.print(" "); pw.print(KEY_SERVICE_RESET_RUN_DURATION); pw.print("="); 735 pw.println(SERVICE_RESET_RUN_DURATION); 736 pw.print(" "); pw.print(KEY_SERVICE_RESTART_DURATION_FACTOR); pw.print("="); 737 pw.println(SERVICE_RESTART_DURATION_FACTOR); 738 pw.print(" "); pw.print(KEY_SERVICE_MIN_RESTART_TIME_BETWEEN); pw.print("="); 739 pw.println(SERVICE_MIN_RESTART_TIME_BETWEEN); 740 pw.print(" "); pw.print(KEY_MAX_SERVICE_INACTIVITY); pw.print("="); 741 pw.println(MAX_SERVICE_INACTIVITY); 742 pw.print(" "); pw.print(KEY_BG_START_TIMEOUT); pw.print("="); 743 pw.println(BG_START_TIMEOUT); 744 pw.print(" "); pw.print(KEY_SERVICE_BG_ACTIVITY_START_TIMEOUT); pw.print("="); 745 pw.println(SERVICE_BG_ACTIVITY_START_TIMEOUT); 746 pw.print(" "); pw.print(KEY_BOUND_SERVICE_CRASH_RESTART_DURATION); pw.print("="); 747 pw.println(BOUND_SERVICE_CRASH_RESTART_DURATION); 748 pw.print(" "); pw.print(KEY_BOUND_SERVICE_CRASH_MAX_RETRY); pw.print("="); 749 pw.println(BOUND_SERVICE_MAX_CRASH_RETRY); 750 pw.print(" "); pw.print(KEY_PROCESS_START_ASYNC); pw.print("="); 751 pw.println(FLAG_PROCESS_START_ASYNC); 752 pw.print(" "); pw.print(KEY_MEMORY_INFO_THROTTLE_TIME); pw.print("="); 753 pw.println(MEMORY_INFO_THROTTLE_TIME); 754 pw.print(" "); pw.print(KEY_TOP_TO_FGS_GRACE_DURATION); pw.print("="); 755 pw.println(TOP_TO_FGS_GRACE_DURATION); 756 pw.print(" "); pw.print(KEY_IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES); pw.print("="); 757 pw.println(Arrays.toString(IMPERCEPTIBLE_KILL_EXEMPT_PROC_STATES.toArray())); 758 pw.print(" "); pw.print(KEY_IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES); pw.print("="); 759 pw.println(Arrays.toString(IMPERCEPTIBLE_KILL_EXEMPT_PACKAGES.toArray())); 760 pw.print(" "); pw.print(KEY_MIN_ASSOC_LOG_DURATION); pw.print("="); 761 pw.println(MIN_ASSOC_LOG_DURATION); 762 763 pw.println(); 764 if (mOverrideMaxCachedProcesses >= 0) { 765 pw.print(" mOverrideMaxCachedProcesses="); pw.println(mOverrideMaxCachedProcesses); 766 } 767 pw.print(" CUR_MAX_CACHED_PROCESSES="); pw.println(CUR_MAX_CACHED_PROCESSES); 768 pw.print(" CUR_MAX_EMPTY_PROCESSES="); pw.println(CUR_MAX_EMPTY_PROCESSES); 769 pw.print(" CUR_TRIM_EMPTY_PROCESSES="); pw.println(CUR_TRIM_EMPTY_PROCESSES); 770 pw.print(" CUR_TRIM_CACHED_PROCESSES="); pw.println(CUR_TRIM_CACHED_PROCESSES); 771 pw.print(" OOMADJ_UPDATE_QUICK="); pw.println(OOMADJ_UPDATE_QUICK); 772 } 773 } 774