Fix ConnectivityManager permissions check.
bug: 2160462
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 78215b0..a91635e 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -572,6 +572,8 @@
// javadoc from interface
public int stopUsingNetworkFeature(int networkType, String feature) {
+ enforceChangePermission();
+
int pid = getCallingPid();
int uid = getCallingUid();
@@ -611,7 +613,7 @@
Log.d(TAG, "stopUsingNetworkFeature for net " + networkType +
": " + feature);
}
- enforceChangePermission();
+
if (!ConnectivityManager.isNetworkTypeValid(networkType)) {
return -1;
}