diff options
| author | 2024-04-19 23:09:15 +0000 | |
|---|---|---|
| committer | 2024-04-19 23:09:15 +0000 | |
| commit | d8e00a72b56a8389c86aba89df1d2e5a780c0a37 (patch) | |
| tree | aa72e22deae73e677a7af3e226440ef44dbafe66 | |
| parent | 2cbb1cb9084aeaefa04a8566af3914d698555fb1 (diff) | |
| parent | 5b7664fda74ccdc9053c8048f03bd45b93fb1759 (diff) | |
Merge "Remove the RUN_BACKUP_JOBS permission." into main
6 files changed, 8 insertions, 77 deletions
diff --git a/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java b/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java index ae98fe14fbe6..6c8af39015f5 100644 --- a/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java +++ b/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java @@ -77,12 +77,6 @@ public interface JobSchedulerInternal { @NonNull String notificationChannel, int userId, @NonNull String packageName); /** - * @return {@code true} if the given package holds the - * {@link android.Manifest.permission.RUN_BACKUP_JOBS} permission. - */ - boolean hasRunBackupJobsPermission(@NonNull String packageName, int packageUid); - - /** * Report a snapshot of sync-related jobs back to the sync manager */ JobStorePersistStats getPersistStats(); diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java index 10162fd070bb..5d1433c815d6 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -4560,11 +4560,6 @@ public class JobSchedulerService extends com.android.server.SystemService } @Override - public boolean hasRunBackupJobsPermission(@NonNull String packageName, int packageUid) { - return JobSchedulerService.this.hasRunBackupJobsPermission(packageName, packageUid); - } - - @Override public JobStorePersistStats getPersistStats() { synchronized (mLock) { return new JobStorePersistStats(mJobs.getPersistStats()); @@ -4727,27 +4722,6 @@ public class JobSchedulerService extends com.android.server.SystemService } /** - * Returns whether the app holds the {@link Manifest.permission.RUN_BACKUP_JOBS} permission. - */ - private boolean hasRunBackupJobsPermission(@NonNull String packageName, int packageUid) { - // This permission is currently hidden so always return false for now (see b/331272951) - return false; - - /** - if (packageName == null) { - Slog.wtfStack(TAG, - "Expected a non-null package name when calling hasRunBackupJobsPermission"); - return false; - } - - return PermissionChecker.checkPermissionForPreflight(getTestableContext(), - android.Manifest.permission.RUN_BACKUP_JOBS, - PermissionChecker.PID_UNKNOWN, packageUid, packageName) - == PermissionChecker.PERMISSION_GRANTED; - */ - } - - /** * Binder stub trampoline implementation */ final class JobSchedulerStub extends IJobScheduler.Stub { diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java index 998554324da1..7fca867356af 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java +++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java @@ -1203,14 +1203,9 @@ public final class JobStatus { return ACTIVE_INDEX; } - final boolean isEligibleAsBackupJob = false // this exemption is being disabled for now. - && job.getTriggerContentUris() != null - && job.getRequiredNetwork() != null - && !job.hasLateConstraint() - && mJobSchedulerInternal.hasRunBackupJobsPermission(sourcePackageName, sourceUid); - final boolean isBackupExempt = mHasMediaBackupExemption || isEligibleAsBackupJob; final int bucketWithBackupExemption; - if (actualBucket != RESTRICTED_INDEX && actualBucket != NEVER_INDEX && isBackupExempt) { + if (actualBucket != RESTRICTED_INDEX && actualBucket != NEVER_INDEX + && mHasMediaBackupExemption) { // Treat it as if it's at most WORKING_INDEX (lower index grants higher quota) since // media backup jobs are important to the user, and the source package may not have // been used directly in a while. diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 7ae514ac2491..f4d1304c7f25 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -1554,11 +1554,11 @@ public class AppOpsManager { AppProtoEnums.APP_OP_READ_SYSTEM_GRAMMATICAL_GENDER; /** - * Allows an app with a major use case of backing-up or syncing content to run longer jobs. + * This app has been removed.. * * @hide */ - public static final int OP_RUN_BACKUP_JOBS = AppProtoEnums.APP_OP_RUN_BACKUP_JOBS; + private static final int OP_DEPRECATED_4 = AppProtoEnums.APP_OP_RUN_BACKUP_JOBS; /** * Whether the app has enabled to receive the icon overlay for fetching archived apps. @@ -1738,7 +1738,6 @@ public class AppOpsManager { OPSTR_ENABLE_MOBILE_DATA_BY_USER, OPSTR_RESERVED_FOR_TESTING, OPSTR_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER, - OPSTR_RUN_BACKUP_JOBS, OPSTR_ARCHIVE_ICON_OVERLAY, OPSTR_UNARCHIVAL_CONFIRMATION, OPSTR_EMERGENCY_LOCATION, @@ -2447,11 +2446,11 @@ public class AppOpsManager { "android:read_system_grammatical_gender"; /** - * Allows an app whose primary use case is to backup or sync content to run longer jobs. + * App op has been removed. * * @hide */ - public static final String OPSTR_RUN_BACKUP_JOBS = "android:run_backup_jobs"; + public static final String OPSTR_DEPRECATED_4 = "android:deprecated_4"; /** * Allows an app to access location without the traditional location permissions and while the @@ -2578,7 +2577,6 @@ public class AppOpsManager { OP_RECEIVE_SANDBOX_TRIGGER_AUDIO, OP_MEDIA_ROUTING_CONTROL, OP_READ_SYSTEM_GRAMMATICAL_GENDER, - OP_RUN_BACKUP_JOBS, OP_ARCHIVE_ICON_OVERLAY, OP_UNARCHIVAL_CONFIRMATION, }; @@ -3036,8 +3034,8 @@ public class AppOpsManager { // will make it an app-op permission in the future. // .setPermission(Manifest.permission.READ_SYSTEM_GRAMMATICAL_GENDER) .build(), - new AppOpInfo.Builder(OP_RUN_BACKUP_JOBS, OPSTR_RUN_BACKUP_JOBS, "RUN_BACKUP_JOBS") - .setPermission(Manifest.permission.RUN_BACKUP_JOBS).build(), + new AppOpInfo.Builder(OP_DEPRECATED_4, OPSTR_DEPRECATED_4, "DEPRECATED_4") + .setDefaultMode(AppOpsManager.MODE_IGNORED).build(), new AppOpInfo.Builder(OP_ARCHIVE_ICON_OVERLAY, OPSTR_ARCHIVE_ICON_OVERLAY, "ARCHIVE_ICON_OVERLAY") .setDefaultMode(MODE_ALLOWED).build(), diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 6ad7422cfff0..16649e852c4a 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -686,25 +686,6 @@ public final class Settings { "android.settings.MANAGE_APP_LONG_RUNNING_JOBS"; /** - * Activity Action: Show settings to allow configuration of - * {@link Manifest.permission#RUN_BACKUP_JOBS} permission. - * - * Input: Optionally, the Intent's data URI can specify the application package name to - * directly invoke the management GUI specific to the package name. For example - * "package:com.my.app". - * <p> - * Output: When a package data uri is passed as input, the activity result is set to - * {@link android.app.Activity#RESULT_OK} if the permission was granted to the app. Otherwise, - * the result is set to {@link android.app.Activity#RESULT_CANCELED}. - * - * @hide - */ - @FlaggedApi(Flags.FLAG_BACKUP_TASKS_SETTINGS_SCREEN) - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) - public static final String ACTION_REQUEST_RUN_BACKUP_JOBS = - "android.settings.REQUEST_RUN_BACKUP_JOBS"; - - /** * Activity Action: Show settings to allow configuration of cross-profile access for apps * * Input: Optionally, the Intent's data URI can specify the application package name to diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 76d7a4166d09..657cc187089c 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -7985,17 +7985,6 @@ <permission android:name="android.permission.RUN_USER_INITIATED_JOBS" android:protectionLevel="normal"/> - <!-- @FlaggedApi("android.app.job.backup_jobs_exemption") - Gives applications with a <b>major use case</b> of backing-up or syncing content increased - job execution allowance in order to complete the related work. The jobs must have a valid - content URI trigger and network constraint set. - <p>This is a special access permission that can be revoked by the system or the user. - <p>Protection level: signature|privileged|appop - @hide - --> - <permission android:name="android.permission.RUN_BACKUP_JOBS" - android:protectionLevel="signature|privileged|appop"/> - <!-- Allows an app access to the installer provided app metadata. @SystemApi @hide |