From f949ec251f017886afc2595a5e3a544a3bb59940 Mon Sep 17 00:00:00 2001 From: markchien Date: Wed, 3 Jun 2020 22:55:27 +0800 Subject: [PATCH] Cleanup config_mobile_hotspot_provision_app usage config_mobile_hotspot_provision_app would be move out of framework and only private for tethering only. enforceTetherChangePermission is no longer needed because its only caller PanService already gate by other privileged permission (BLUETOOTH_PRIVILEGED). Bug: 146918263 Test: m Change-Id: I030871c2bc46bc09c4e52970b4995f98d31bb90e Merged-In: I030871c2bc46bc09c4e52970b4995f98d31bb90e --- .../java/android/net/ConnectivityManager.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 36ffe50ef8..ba348993e2 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -2246,26 +2246,6 @@ public class ConnectivityManager { .getPackageNameForUid(context, uid), true /* throwException */); } - /** {@hide} */ - public static final void enforceTetherChangePermission(Context context, String callingPkg) { - Preconditions.checkNotNull(context, "Context cannot be null"); - Preconditions.checkNotNull(callingPkg, "callingPkg cannot be null"); - - 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.TETHER_PRIVILEGED, "ConnectivityService"); - } else { - int uid = Binder.getCallingUid(); - // If callingPkg's uid is not same as Binder.getCallingUid(), - // AppOpsService throws SecurityException. - Settings.checkAndNoteWriteSettingsOperation(context, uid, callingPkg, - true /* throwException */); - } - } - /** * @deprecated - use getSystemService. This is a kludge to support static access in certain * situations where a Context pointer is unavailable.