Merge "Adds necessary permissions to system apis"
am: efb7b861d3
Change-Id: Ifa5d94cdd883c3e1b983c985c0c17fe61e864352
This commit is contained in:
@@ -1125,6 +1125,7 @@ public class ConnectivityManager {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
|
@RequiresPermission(android.Manifest.permission.LOCAL_MAC_ADDRESS)
|
||||||
public String getCaptivePortalServerUrl() {
|
public String getCaptivePortalServerUrl() {
|
||||||
try {
|
try {
|
||||||
return mService.getCaptivePortalServerUrl();
|
return mService.getCaptivePortalServerUrl();
|
||||||
@@ -2088,10 +2089,11 @@ public class ConnectivityManager {
|
|||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
|
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
|
||||||
public boolean isTetheringSupported() {
|
public boolean isTetheringSupported() {
|
||||||
try {
|
try {
|
||||||
return mService.isTetheringSupported();
|
String pkgName = mContext.getOpPackageName();
|
||||||
|
return mService.isTetheringSupported(pkgName);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2121,6 +2123,7 @@ public class ConnectivityManager {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
|
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
|
||||||
public void startTethering(int type, boolean showProvisioningUi,
|
public void startTethering(int type, boolean showProvisioningUi,
|
||||||
final OnStartTetheringCallback callback) {
|
final OnStartTetheringCallback callback) {
|
||||||
startTethering(type, showProvisioningUi, callback, null);
|
startTethering(type, showProvisioningUi, callback, null);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ interface IConnectivityManager
|
|||||||
|
|
||||||
int getLastTetherError(String iface);
|
int getLastTetherError(String iface);
|
||||||
|
|
||||||
boolean isTetheringSupported();
|
boolean isTetheringSupported(String callerPkg);
|
||||||
|
|
||||||
void startTethering(int type, in ResultReceiver receiver, boolean showProvisioningUi,
|
void startTethering(int type, in ResultReceiver receiver, boolean showProvisioningUi,
|
||||||
String callerPkg);
|
String callerPkg);
|
||||||
|
|||||||
@@ -2988,12 +2988,16 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
return mTethering.getTetheredDhcpRanges();
|
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
|
// 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
|
// gservices could set the secure setting to 1 though to enable it on a build where it
|
||||||
// had previously been turned off.
|
// had previously been turned off.
|
||||||
@Override
|
private boolean isTetheringSupported() {
|
||||||
public boolean isTetheringSupported() {
|
|
||||||
enforceTetherAccessPermission();
|
|
||||||
int defaultVal = encodeBool(!mSystemProperties.get("ro.tether.denied").equals("true"));
|
int defaultVal = encodeBool(!mSystemProperties.get("ro.tether.denied").equals("true"));
|
||||||
boolean tetherSupported = toBool(Settings.Global.getInt(mContext.getContentResolver(),
|
boolean tetherSupported = toBool(Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.TETHER_SUPPORTED, defaultVal));
|
Settings.Global.TETHER_SUPPORTED, defaultVal));
|
||||||
@@ -5464,6 +5468,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCaptivePortalServerUrl() {
|
public String getCaptivePortalServerUrl() {
|
||||||
|
enforceConnectivityInternalPermission();
|
||||||
return NetworkMonitor.getCaptivePortalServerHttpUrl(mContext);
|
return NetworkMonitor.getCaptivePortalServerHttpUrl(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user