Remove INTERNET permission requirement.

Bug: 280564348
Test: atest CtsJobSchedulerTestCases
Change-Id: I4fa917be0594c11ead64cfd98ab9e56045c159e9
This commit is contained in:
Kweku Adams
2023-05-10 14:59:29 +00:00
parent 22490466ca
commit 4239484c48
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
@@ -3995,12 +3995,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;
}