<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
- <uses-permission android:name="android.permission.NETWORK_STACK" />
+ <uses-permission android:name="android.permission.NETWORK_SETTINGS" />
<application android:label="@string/app_name"
android:usesCleartextTraffic="true">
NetworkCapabilities nc, int callerPid, int callerUid) {
final NetworkCapabilities newNc = new NetworkCapabilities(nc);
if (!checkSettingsPermission(callerPid, callerUid)) newNc.setUids(null);
- if (!checkNetworkStackPermission(callerPid, callerUid)) newNc.setSSID(null);
+ if (!checkSettingsPermission(callerPid, callerUid)) newNc.setSSID(null);
return newNc;
}
android.Manifest.permission.NETWORK_SETTINGS, pid, uid);
}
- private boolean checkNetworkStackPermission(int pid, int uid) {
- return PERMISSION_GRANTED == mContext.checkPermission(
- android.Manifest.permission.NETWORK_STACK, pid, uid);
- }
-
private void enforceTetherAccessPermission() {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.ACCESS_NETWORK_STATE,
// calling app has permission to do so.
private void ensureSufficientPermissionsForRequest(NetworkCapabilities nc,
int callerPid, int callerUid) {
- if (null != nc.getSSID() && !checkNetworkStackPermission(callerPid, callerUid)) {
+ if (null != nc.getSSID() && !checkSettingsPermission(callerPid, callerUid)) {
throw new SecurityException("Insufficient permissions to request a specific SSID");
}
}