diff options
| author | Kweku Adams <kwekua@google.com> | 2022-04-18 17:50:35 +0000 |
|---|---|---|
| committer | Kweku Adams <kwekua@google.com> | 2022-04-18 17:50:35 +0000 |
| commit | d8ff97bf8d33d71a098733b0e241290c2fbe53eb (patch) | |
| tree | d0118ec9d6b44989108a81169cb0b1e46e81d3a4 | |
| parent | 715b58c274822535cdc6528e104b2cbc16295e65 (diff) | |
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
| -rw-r--r-- | apex/jobscheduler/framework/java/android/app/job/JobInfo.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java index b9673f25d680..18665e7f4d22 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java @@ -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 |
