Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4458f587 authored by Atneya Nair's avatar Atneya Nair
Browse files

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
parent f6002bc0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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
+6 −1
Original line number Diff line number Diff line
@@ -3283,7 +3283,12 @@ public class OomAdjuster {
                baseCapabilities = PROCESS_CAPABILITY_ALL; // BFSL allowed
                break;
            case PROCESS_STATE_BOUND_TOP:
                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) {