diff options
| author | 2022-10-28 07:54:40 +0000 | |
|---|---|---|
| committer | 2022-10-28 07:54:40 +0000 | |
| commit | 9e283d5e374a0fd10f9c9a1f0ca6cb72cbac0481 (patch) | |
| tree | b1a88f683d63346d798edc25910ea50b4f81a7c4 | |
| parent | 97473dc3d986ade2ad1691501f86b51e9b73ef83 (diff) | |
| parent | 414f5c6c25bb49b3deeaef3bf0872d8c364020fd (diff) | |
Merge "Introduce a new permission for LRJ."
| -rw-r--r-- | core/api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/app/AppOpsManager.java | 21 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 9 |
3 files changed, 29 insertions, 2 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 3cc2b2f34e9e..218d7bd14ceb 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -172,6 +172,7 @@ package android { field public static final String REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE = "android.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE"; field public static final String REQUEST_PASSWORD_COMPLEXITY = "android.permission.REQUEST_PASSWORD_COMPLEXITY"; field @Deprecated public static final String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES"; + field public static final String RUN_LONG_JOBS = "android.permission.RUN_LONG_JOBS"; field public static final String SCHEDULE_EXACT_ALARM = "android.permission.SCHEDULE_EXACT_ALARM"; field public static final String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE"; field public static final String SEND_SMS = "android.permission.SEND_SMS"; diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index d1275f66383e..1b972e0cb81a 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -1353,9 +1353,16 @@ public class AppOpsManager { public static final int OP_RECEIVE_EXPLICIT_USER_INTERACTION_AUDIO = AppProtoEnums.APP_OP_RECEIVE_EXPLICIT_USER_INTERACTION_AUDIO; + /** + * App can schedule long running jobs. + * + * @hide + */ + public static final int OP_RUN_LONG_JOBS = AppProtoEnums.APP_OP_RUN_LONG_JOBS; + /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public static final int _NUM_OP = 122; + public static final int _NUM_OP = 123; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -1839,6 +1846,13 @@ public class AppOpsManager { public static final String OPSTR_RECEIVE_EXPLICIT_USER_INTERACTION_AUDIO = "android:receive_explicit_user_interaction_audio"; + /** + * App can schedule long running jobs. + * + * @hide + */ + public static final String OPSTR_RUN_LONG_JOBS = "android:run_long_jobs"; + /** {@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} */ @@ -1933,6 +1947,7 @@ public class AppOpsManager { OP_SCHEDULE_EXACT_ALARM, OP_MANAGE_MEDIA, OP_TURN_SCREEN_ON, + OP_RUN_LONG_JOBS, }; static final AppOpInfo[] sAppOpInfos = new AppOpInfo[]{ @@ -2312,7 +2327,9 @@ public class AppOpsManager { new AppOpInfo.Builder(OP_RECEIVE_EXPLICIT_USER_INTERACTION_AUDIO, OPSTR_RECEIVE_EXPLICIT_USER_INTERACTION_AUDIO, "RECEIVE_EXPLICIT_USER_INTERACTION_AUDIO").setDefaultMode( - AppOpsManager.MODE_ALLOWED).build() + AppOpsManager.MODE_ALLOWED).build(), + new AppOpInfo.Builder(OP_RUN_LONG_JOBS, OPSTR_RUN_LONG_JOBS, "RUN_LONG_JOBS") + .setPermission(Manifest.permission.RUN_LONG_JOBS).build() }; /** diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 554b15374943..62c584847c0f 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -6622,6 +6622,15 @@ <permission android:name="android.permission.MANAGE_DEVICE_LOCK_STATE" android:protectionLevel="internal|role" /> + <!-- Allows applications to use the long running jobs APIs. + <p>This is a special access permission that can be revoked by the system or the user. + <p>Apps need to target API {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE} or above + to be able to request this permission. + <p>Protection level: appop + --> + <permission android:name="android.permission.RUN_LONG_JOBS" + android:protectionLevel="normal|appop"/> + <!-- Attribution for Geofencing service. --> <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/> <!-- Attribution for Country Detector. --> |