summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/AppOpsManager.java54
1 files changed, 52 insertions, 2 deletions
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 267e5b699241..dc325ff96de1 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -1368,9 +1368,31 @@ public class AppOpsManager {
public static final int OP_READ_MEDIA_VISUAL_USER_SELECTED =
AppProtoEnums.APP_OP_READ_MEDIA_VISUAL_USER_SELECTED;
+ /**
+ * Prevent an app from being placed into app standby buckets.
+ *
+ * Only to be used by the system.
+ *
+ * @hide
+ */
+ public static final int OP_SYSTEM_EXEMPT_FROM_APP_STANDBY =
+ AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_APP_STANDBY;
+
+ /**
+ * Prevent an app from being placed into forced app standby.
+ * {@link ActivityManager#isBackgroundRestricted()}
+ * {@link #OP_RUN_ANY_IN_BACKGROUND}
+ *
+ * Only to be used by the system.
+ *
+ * @hide
+ */
+ public static final int OP_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY =
+ AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY;
+
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static final int _NUM_OP = 124;
+ public static final int _NUM_OP = 126;
/** Access to coarse location information. */
public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1869,6 +1891,28 @@ public class AppOpsManager {
*/
public static final String OPSTR_RUN_LONG_JOBS = "android:run_long_jobs";
+ /**
+ * Prevent an app from being placed into app standby buckets.
+ *
+ * Only to be used by the system.
+ *
+ * @hide
+ */
+ public static final String OPSTR_SYSTEM_EXEMPT_FROM_APP_STANDBY =
+ "android:system_exempt_from_app_standby";
+
+ /**
+ * Prevent an app from being placed into forced app standby.
+ * {@link ActivityManager#isBackgroundRestricted()}
+ * {@link #OP_RUN_ANY_IN_BACKGROUND}
+ *
+ * Only to be used by the system.
+ *
+ * @hide
+ */
+ public static final String OPSTR_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY =
+ "android:system_exempt_from_forced_app_standby";
+
/** {@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} */
@@ -2350,7 +2394,13 @@ public class AppOpsManager {
new AppOpInfo.Builder(OP_READ_MEDIA_VISUAL_USER_SELECTED,
OPSTR_READ_MEDIA_VISUAL_USER_SELECTED, "READ_MEDIA_VISUAL_USER_SELECTED")
.setPermission(Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED)
- .setDefaultMode(AppOpsManager.MODE_ALLOWED).build()
+ .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(),
+ new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_APP_STANDBY,
+ OPSTR_SYSTEM_EXEMPT_FROM_APP_STANDBY,
+ "SYSTEM_EXEMPT_FROM_APP_STANDBY").build(),
+ new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY,
+ OPSTR_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY,
+ "SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY").build()
};
/**