Merge "Cleanup config_mobile_hotspot_provision_app usage" into rvc-dev am: ef24e2121d am: d02eb33e41

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11716092

Change-Id: Ide5449742dabf5a2c86238042cb64270fd445fb6
This commit is contained in:
Mark Chien
2020-06-11 15:45:35 +00:00
committed by Automerger Merge Worker

View File

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