Merge "Remove INTERNET permission requirement." into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ef6853a2a4
@@ -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
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user