diff options
| author | 2024-10-14 14:53:07 -0700 | |
|---|---|---|
| committer | 2024-10-14 14:53:07 -0700 | |
| commit | 4458f587dcd72eaf390d5ea3a08de07955cc9a83 (patch) | |
| tree | 35a7d9229544accc9c43fc8abf945673bf8ee56d | |
| parent | f6002bc0c0e5df8302fd695fc4c65f84434b3551 (diff) | |
Change default caps for BOUND_TOP to superset FGS
This prevents test issues where the proc state upgrades to BOUND_TOP,
and the test loses capabilities (possible during GTS).
The code in a few locations seems to assume that the default caps
strictly increase as PROC_STATE becomes more important, which is also
easier to reason about.
Fixes: 351860676
Test: Compiles, strict increase in caps, under instrumentation only
Flag: EXEMPT, only affects tests
Change-Id: I7c959931044604f7d3254ebeddcf6c9deb2ca75c
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 4 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/OomAdjuster.java | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 7273e64846c0..36fc65a76d53 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -1031,7 +1031,9 @@ public class ActivityManager { | PROCESS_CAPABILITY_FOREGROUND_AUDIO_CONTROL; /** - * All implicit capabilities. There are capabilities that process automatically have. + * All implicit capabilities. This capability set is currently only used for processes under + * active instrumentation. The intent is to allow CTS tests to always have these capabilities + * so that every test doesn't need to launch FGS. * @hide */ @TestApi diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java index e8f7b5f00152..e0521ef20700 100644 --- a/services/core/java/com/android/server/am/OomAdjuster.java +++ b/services/core/java/com/android/server/am/OomAdjuster.java @@ -3283,7 +3283,12 @@ public class OomAdjuster { baseCapabilities = PROCESS_CAPABILITY_ALL; // BFSL allowed break; case PROCESS_STATE_BOUND_TOP: - baseCapabilities = PROCESS_CAPABILITY_BFSL; + if (app.getActiveInstrumentation() != null) { + baseCapabilities = PROCESS_CAPABILITY_BFSL | + PROCESS_CAPABILITY_ALL_IMPLICIT; + } else { + baseCapabilities = PROCESS_CAPABILITY_BFSL; + } break; case PROCESS_STATE_FOREGROUND_SERVICE: if (app.getActiveInstrumentation() != null) { |