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

Commit 2d57bcbf authored by Alex Johnston's avatar Alex Johnston Committed by Android (Google) Code Review
Browse files

Merge "Add exemption that prevents apps from being placed in hibernation"

parents 9c978b52 e0097f50
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -626,6 +626,7 @@ package android.app {
    field public static final String OPSTR_RUN_ANY_IN_BACKGROUND = "android:run_any_in_background";
    field public static final String OPSTR_RUN_IN_BACKGROUND = "android:run_in_background";
    field public static final String OPSTR_START_FOREGROUND = "android:start_foreground";
    field public static final String OPSTR_SYSTEM_EXEMPT_FROM_HIBERNATION = "android:system_exempt_from_hibernation";
    field public static final String OPSTR_TAKE_AUDIO_FOCUS = "android:take_audio_focus";
    field public static final String OPSTR_TAKE_MEDIA_BUTTONS = "android:take_media_buttons";
    field public static final String OPSTR_TOAST_WINDOW = "android:toast_window";
+22 −2
Original line number Diff line number Diff line
@@ -1462,9 +1462,17 @@ public class AppOpsManager {
     */
    public static final int OP_USE_FULL_SCREEN_INTENT = AppProtoEnums.APP_OP_USE_FULL_SCREEN_INTENT;

    /**
     * Prevent an app from being placed into hibernation.
     *
     * @hide
     */
    public static final int OP_SYSTEM_EXEMPT_FROM_HIBERNATION =
            AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_HIBERNATION;

    /** @hide */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int _NUM_OP = 134;
    public static final int _NUM_OP = 135;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -2058,6 +2066,15 @@ public class AppOpsManager {
     */
    public static final String OPSTR_USE_FULL_SCREEN_INTENT = "android:use_full_screen_intent";

    /**
     *  Prevent an app from being placed into hibernation.
     *
     * @hide
     */
    @SystemApi
    public static final String OPSTR_SYSTEM_EXEMPT_FROM_HIBERNATION =
            "android:system_exempt_from_hibernation";

    /** {@link #sAppOpsToNote} not initialized yet for this op */
    private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
    /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */
@@ -2580,7 +2597,10 @@ public class AppOpsManager {
                .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(),
        new AppOpInfo.Builder(OP_USE_FULL_SCREEN_INTENT, OPSTR_USE_FULL_SCREEN_INTENT,
                "USE_FULL_SCREEN_INTENT").setPermission(Manifest.permission.USE_FULL_SCREEN_INTENT)
                .build()
                .build(),
        new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_HIBERNATION,
                OPSTR_SYSTEM_EXEMPT_FROM_HIBERNATION,
                "SYSTEM_EXEMPT_FROM_HIBERNATION").build()
    };

    // The number of longs needed to form a full bitmask of app ops