Merge "Cleanup config_mobile_hotspot_provision_app usage" am: 443092b9a8

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

Change-Id: I3d265ab9806605e18384fa6321452f7c96f3f48b
This commit is contained in:
Mark Chien
2020-06-11 07:40:27 +00:00
committed by Automerger Merge Worker

View File

@@ -2271,27 +2271,6 @@ public class ConnectivityManager {
throwException); throwException);
} }
/** {@hide} */
public static final void enforceTetherChangePermission(Context context, String callingPkg,
String callingAttributionTag) {
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.
checkAndNoteWriteSettingsOperation(context, uid, callingPkg,
callingAttributionTag, true /* throwException */);
}
}
/** /**
* Check if the package is a allowed to write settings. This also accounts that such an access * Check if the package is a allowed to write settings. This also accounts that such an access
* happened. * happened.