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

Commit a2cc2da1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove INTERNET permission requirement." into udc-dev am: ef6853a2

parents 3e873dba ef6853a2
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -1384,8 +1384,8 @@ public class JobInfo implements Parcelable {
         * want to call one of these methods.
         * want to call one of these methods.
         *
         *
         * Starting in Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
         * Starting in Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
         * an app must hold the {@link android.Manifest.permission#INTERNET} and
         * an app must hold the
         * {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permissions to
         * {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permission to
         * schedule a job that requires a network.
         * schedule a job that requires a network.
         *
         *
         * <p class="note">
         * <p class="note">
@@ -1445,8 +1445,8 @@ public class JobInfo implements Parcelable {
         * constraint.
         * constraint.
         *
         *
         * Starting in Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
         * Starting in Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
         * an app must hold the {@link android.Manifest.permission#INTERNET} and
         * an app must hold the
         * {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permissions to
         * {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permission to
         * schedule a job that requires a network.
         * schedule a job that requires a network.
         *
         *
         * @param networkRequest The detailed description of the kind of network
         * @param networkRequest The detailed description of the kind of network
+1 −7
Original line number Original line Diff line number Diff line
@@ -195,7 +195,7 @@ public class JobSchedulerService extends com.android.server.SystemService
    private static final long REQUIRE_NETWORK_CONSTRAINT_FOR_NETWORK_JOB_WORK_ITEMS = 241104082L;
    private static final long REQUIRE_NETWORK_CONSTRAINT_FOR_NETWORK_JOB_WORK_ITEMS = 241104082L;


    /**
    /**
     * Require the app to have the INTERNET and ACCESS_NETWORK_STATE permissions when scheduling
     * Require the app to have the ACCESS_NETWORK_STATE permissions when scheduling
     * a job with a connectivity constraint.
     * a job with a connectivity constraint.
     */
     */
    @ChangeId
    @ChangeId
@@ -4001,12 +4001,6 @@ public class JobSchedulerService extends com.android.server.SystemService
            if (job.getRequiredNetwork() != null
            if (job.getRequiredNetwork() != null
                    && CompatChanges.isChangeEnabled(
                    && CompatChanges.isChangeEnabled(
                            REQUIRE_NETWORK_PERMISSIONS_FOR_CONNECTIVITY_JOBS, uid)) {
                            REQUIRE_NETWORK_PERMISSIONS_FOR_CONNECTIVITY_JOBS, uid)) {
                // All networking, including with the local network and even local to the device,
                // requires the INTERNET permission.
                if (!hasPermission(uid, pid, Manifest.permission.INTERNET)) {
                    throw new SecurityException(Manifest.permission.INTERNET
                            + " required for jobs with a connectivity constraint");
                }
                if (!hasPermission(uid, pid, Manifest.permission.ACCESS_NETWORK_STATE)) {
                if (!hasPermission(uid, pid, Manifest.permission.ACCESS_NETWORK_STATE)) {
                    throw new SecurityException(Manifest.permission.ACCESS_NETWORK_STATE
                    throw new SecurityException(Manifest.permission.ACCESS_NETWORK_STATE
                            + " required for jobs with a connectivity constraint");
                            + " required for jobs with a connectivity constraint");
+0 −3
Original line number Original line Diff line number Diff line
@@ -551,9 +551,6 @@ public final class JobServiceContext implements ServiceConnection {
        if (CompatChanges.isChangeEnabled(
        if (CompatChanges.isChangeEnabled(
                JobSchedulerService.REQUIRE_NETWORK_PERMISSIONS_FOR_CONNECTIVITY_JOBS, uid)) {
                JobSchedulerService.REQUIRE_NETWORK_PERMISSIONS_FOR_CONNECTIVITY_JOBS, uid)) {
            final String pkgName = job.getServiceComponent().getPackageName();
            final String pkgName = job.getServiceComponent().getPackageName();
            if (!hasPermissionForDelivery(uid, pkgName, Manifest.permission.INTERNET)) {
                return false;
            }
            if (!hasPermissionForDelivery(uid, pkgName, Manifest.permission.ACCESS_NETWORK_STATE)) {
            if (!hasPermissionForDelivery(uid, pkgName, Manifest.permission.ACCESS_NETWORK_STATE)) {
                return false;
                return false;
            }
            }