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:
Robert Greenwalt
2014-09-18 00:40:03 +00:00
committed by Android Git Automerger
2 changed files with 17 additions and 11 deletions

View File

@@ -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.