am 010b4b12: am dbbe65ee: am 50d23752: Merge "Use unified Tethering Permission Check" into lmp-dev
* commit '010b4b1292385876d1c3794bc41853172ecb789f': Use unified Tethering Permission Check
This commit is contained in:
@@ -1402,6 +1402,20 @@ public class ConnectivityManager {
|
||||
return (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
}
|
||||
|
||||
/** {@hide */
|
||||
public static final void enforceTetherChangePermission(Context context) {
|
||||
if (context.getResources().getStringArray(
|
||||
com.android.internal.R.array.config_mobile_hotspot_provision_app).length == 2) {
|
||||
// Have a provisioning app - must only let system apps (which check this app)
|
||||
// turn on tethering
|
||||
context.enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.CONNECTIVITY_INTERNAL, "ConnectivityService");
|
||||
} else {
|
||||
context.enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.CHANGE_NETWORK_STATE, "ConnectivityService");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set of tetherable, available interfaces. This list is limited by
|
||||
* device configuration and current interface existence.
|
||||
|
||||
Reference in New Issue
Block a user