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

Commit d8e00a72 authored by Varun Shah's avatar Varun Shah Committed by Android (Google) Code Review
Browse files

Merge "Remove the RUN_BACKUP_JOBS permission." into main

parents 2cbb1cb9 5b7664fd
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -76,12 +76,6 @@ public interface JobSchedulerInternal {
    boolean isNotificationChannelAssociatedWithAnyUserInitiatedJobs(
            @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
     */
+0 −26
Original line number Diff line number Diff line
@@ -4559,11 +4559,6 @@ public class JobSchedulerService extends com.android.server.SystemService
                    notificationChannel, userId, packageName);
        }

        @Override
        public boolean hasRunBackupJobsPermission(@NonNull String packageName, int packageUid) {
            return JobSchedulerService.this.hasRunBackupJobsPermission(packageName, packageUid);
        }

        @Override
        public JobStorePersistStats getPersistStats() {
            synchronized (mLock) {
@@ -4726,27 +4721,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
     */
+2 −7
Original line number Diff line number Diff line
@@ -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.
+6 −8
Original line number Diff line number Diff line
@@ -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(),
+0 −19
Original line number Diff line number Diff line
@@ -685,25 +685,6 @@ public final class Settings {
    public static final String ACTION_MANAGE_APP_LONG_RUNNING_JOBS =
            "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
     *
Loading