Merge "Allow USE_RESTRICTED_NETWORKS for registerSystemDefaultNetworkCallback"
This commit is contained in:
commit
31ee1c1121
1 changed files with 29 additions and 4 deletions
|
|
@ -2810,6 +2810,13 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK);
|
||||
}
|
||||
|
||||
private void enforceSettingsOrUseRestrictedNetworksPermission() {
|
||||
enforceAnyPermissionOf(mContext,
|
||||
android.Manifest.permission.NETWORK_SETTINGS,
|
||||
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
|
||||
Manifest.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS);
|
||||
}
|
||||
|
||||
private void enforceNetworkFactoryPermission() {
|
||||
// TODO: Check for the BLUETOOTH_STACK permission once that is in the API surface.
|
||||
if (UserHandle.getAppId(getCallingUid()) == Process.BLUETOOTH_UID) return;
|
||||
|
|
@ -6656,7 +6663,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
enforceAccessPermission();
|
||||
break;
|
||||
case TRACK_SYSTEM_DEFAULT:
|
||||
enforceSettingsPermission();
|
||||
enforceSettingsOrUseRestrictedNetworksPermission();
|
||||
networkCapabilities = new NetworkCapabilities(defaultNc);
|
||||
break;
|
||||
case BACKGROUND_REQUEST:
|
||||
|
|
|
|||
Loading…
Reference in a new issue