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

Commit a46ba4ea authored by markchien's avatar markchien Committed by Mark Chien
Browse files

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
parent e1f84e00
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -2271,27 +2271,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.