Adds necessary permissions to system apis
adds privileged permission for getCaptivePortalServerUrl
adds tether privileged permission for
startTethering,isTetheringSupported
bug:62348162
Test: make and manual testing
Change-Id: I8eb8e3c9dcd7201abe9ea303ee57fe99073d67eb
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 224845c..98389a6 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -2973,12 +2973,16 @@
return mTethering.getTetheredDhcpRanges();
}
+ @Override
+ public boolean isTetheringSupported(String callerPkg) {
+ ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
+ return isTetheringSupported();
+ }
+
// if ro.tether.denied = true we default to no tethering
// gservices could set the secure setting to 1 though to enable it on a build where it
// had previously been turned off.
- @Override
- public boolean isTetheringSupported() {
- enforceTetherAccessPermission();
+ private boolean isTetheringSupported() {
int defaultVal = encodeBool(!mSystemProperties.get("ro.tether.denied").equals("true"));
boolean tetherSupported = toBool(Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.TETHER_SUPPORTED, defaultVal));
@@ -5380,6 +5384,7 @@
@Override
public String getCaptivePortalServerUrl() {
+ enforceConnectivityInternalPermission();
return NetworkMonitor.getCaptivePortalServerHttpUrl(mContext);
}