Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 247e62c0 authored by Mark Chien's avatar Mark Chien Committed by Automerger Merge Worker
Browse files

Merge "Cleanup config_mobile_hotspot_provision_app usage" am: 443092b9 am:...

Merge "Cleanup config_mobile_hotspot_provision_app usage" am: 443092b9 am: e0f4e04f am: f8bca221 am: af17ba94

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

Change-Id: I8e0fc83e9a3ed7eeb01e7caf761a3b206dc026bd
parents 6da2bbe5 af17ba94
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -2270,27 +2270,6 @@ public class ConnectivityManager {
                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
     * happened.