Remove NOT_RESTRICTED from basic network requests.
JobScheduler only ever tells a job to run on the default network. If the connectivity stack says an app's default network is a restricted network, then the app has permission to use that restricted network. However, default NetworkRequests exclude restricted networks by default. Removing this exclusion for basic job NetworkRequests so that a job can run on a restricted network if the app is allowed to do so. Bug: 219788183 Test: atest CtsJobSchedulerTestCases:JobInfoTest Change-Id: I3c2b9f725c7e1254c7708f5b8df7bdf18163608e
This commit is contained in:
@@ -18,6 +18,7 @@ package android.app.job;
|
||||
|
||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
|
||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
|
||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED;
|
||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING;
|
||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VPN;
|
||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
|
||||
@@ -1332,6 +1333,7 @@ public class JobInfo implements Parcelable {
|
||||
builder.addCapability(NET_CAPABILITY_INTERNET);
|
||||
builder.addCapability(NET_CAPABILITY_VALIDATED);
|
||||
builder.removeCapability(NET_CAPABILITY_NOT_VPN);
|
||||
builder.removeCapability(NET_CAPABILITY_NOT_RESTRICTED);
|
||||
|
||||
if (networkType == NETWORK_TYPE_ANY) {
|
||||
// No other capabilities
|
||||
|
||||
Reference in New Issue
Block a user