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

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

Merge "Introduce the RUN_BACKUP_JOBS permission." into main

parents 6a633c9d 53e84fae
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -13,3 +13,10 @@ flag {
    description: "Add APIs to let apps attach debug information to jobs"
    bug: "293491637"
}

flag {
    name: "backup_jobs_exemption"
    namespace: "backstage_power"
    description: "Introduce a new RUN_BACKUP_JOBS permission and exemption logic allowing for longer running jobs for apps whose primary purpose is to backup or sync content."
    bug: "318731461"
}
+3 −0
Original line number Diff line number Diff line
@@ -5448,6 +5448,9 @@ public class JobSchedulerService extends com.android.server.SystemService
            pw.print(Flags.FLAG_THROW_ON_UNSUPPORTED_BIAS_USAGE,
                    Flags.throwOnUnsupportedBiasUsage());
            pw.println();
            pw.print(android.app.job.Flags.FLAG_BACKUP_JOBS_EXEMPTION,
                    android.app.job.Flags.backupJobsExemption());
            pw.println();
            pw.decreaseIndent();
            pw.println();

+3 −0
Original line number Diff line number Diff line
@@ -356,6 +356,9 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler {
            case com.android.server.job.Flags.FLAG_THROW_ON_UNSUPPORTED_BIAS_USAGE:
                pw.println(com.android.server.job.Flags.throwOnUnsupportedBiasUsage());
                break;
            case android.app.job.Flags.FLAG_BACKUP_JOBS_EXEMPTION:
                pw.println(android.app.job.Flags.backupJobsExemption());
                break;
            default:
                pw.println("Unknown flag: " + flagName);
                break;
+1 −0
Original line number Diff line number Diff line
@@ -277,6 +277,7 @@ package android {
    field @FlaggedApi("android.companion.flags.device_presence") public static final String REQUEST_OBSERVE_DEVICE_UUID_PRESENCE = "android.permission.REQUEST_OBSERVE_DEVICE_UUID_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 @FlaggedApi("android.app.job.backup_jobs_exemption") public static final String RUN_BACKUP_JOBS = "android.permission.RUN_BACKUP_JOBS";
    field public static final String RUN_USER_INITIATED_JOBS = "android.permission.RUN_USER_INITIATED_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";
+19 −1
Original line number Diff line number Diff line
@@ -1548,9 +1548,16 @@ public class AppOpsManager {
    public static final int OP_READ_SYSTEM_GRAMMATICAL_GENDER =
            AppProtoEnums.APP_OP_READ_SYSTEM_GRAMMATICAL_GENDER;

    /**
     * Allows an app whose primary use case is to backup or sync content to run longer jobs.
     *
     * @hide
     */
    public static final int OP_RUN_BACKUP_JOBS = AppProtoEnums.APP_OP_RUN_BACKUP_JOBS;

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

    /**
     * All app ops represented as strings.
@@ -1700,6 +1707,7 @@ public class AppOpsManager {
            OPSTR_ENABLE_MOBILE_DATA_BY_USER,
            OPSTR_RESERVED_FOR_TESTING,
            OPSTR_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER,
            OPSTR_RUN_BACKUP_JOBS,
    })
    public @interface AppOpString {}

@@ -2392,6 +2400,13 @@ public class AppOpsManager {
    public static final String OPSTR_READ_SYSTEM_GRAMMATICAL_GENDER =
            "android:read_system_grammatical_gender";

    /**
     * Allows an app whose primary use case is to backup or sync content to run longer jobs.
     *
     * @hide
     */
    public static final String OPSTR_RUN_BACKUP_JOBS = "android:run_backup_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} */
@@ -2504,6 +2519,7 @@ public class AppOpsManager {
            OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA,
            OP_MEDIA_ROUTING_CONTROL,
            OP_READ_SYSTEM_GRAMMATICAL_GENDER,
            OP_RUN_BACKUP_JOBS,
    };

    static final AppOpInfo[] sAppOpInfos = new AppOpInfo[]{
@@ -2961,6 +2977,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(),
    };

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