Merge "Remove INTERNET permission requirement." into udc-dev

This commit is contained in:
Treehugger Robot
2023-05-11 16:48:01 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 14 deletions

View File

@@ -1384,8 +1384,8 @@ public class JobInfo implements Parcelable {
* want to call one of these methods.
*
* Starting in Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
* an app must hold the {@link android.Manifest.permission#INTERNET} and
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permissions to
* an app must hold the
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permission to
* schedule a job that requires a network.
*
* <p class="note">
@@ -1445,8 +1445,8 @@ public class JobInfo implements Parcelable {
* constraint.
*
* Starting in Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
* an app must hold the {@link android.Manifest.permission#INTERNET} and
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permissions to
* an app must hold the
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE} permission to
* schedule a job that requires a network.
*
* @param networkRequest The detailed description of the kind of network

View File

@@ -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;
/**
* 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.
*/
@ChangeId
@@ -4001,12 +4001,6 @@ public class JobSchedulerService extends com.android.server.SystemService
if (job.getRequiredNetwork() != null
&& CompatChanges.isChangeEnabled(
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)) {
throw new SecurityException(Manifest.permission.ACCESS_NETWORK_STATE
+ " required for jobs with a connectivity constraint");

View File

@@ -551,9 +551,6 @@ public final class JobServiceContext implements ServiceConnection {
if (CompatChanges.isChangeEnabled(
JobSchedulerService.REQUIRE_NETWORK_PERMISSIONS_FOR_CONNECTIVITY_JOBS, uid)) {
final String pkgName = job.getServiceComponent().getPackageName();
if (!hasPermissionForDelivery(uid, pkgName, Manifest.permission.INTERNET)) {
return false;
}
if (!hasPermissionForDelivery(uid, pkgName, Manifest.permission.ACCESS_NETWORK_STATE)) {
return false;
}