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

Commit b9ad638c authored by Shunta Sato's avatar Shunta Sato
Browse files

Make tetherChangePermission to be secured for AppOps permission

Symptom:
AppOps verified the incorrect package of calling tether state
changing API.
It threw SecurityException by mistake.

Solution:
Pass the correct package name to enforceTetherChangePermission.

Bug: 32931147
Change-Id: I46fd0c8128d00a12fd693e08000aca85849baf33
parent 02944530
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -324,7 +324,9 @@ public class PanService extends ProfileService {


    void setBluetoothTethering(boolean value) {
    void setBluetoothTethering(boolean value) {
        if(DBG) Log.d(TAG, "setBluetoothTethering: " + value +", mTetherOn: " + mTetherOn);
        if(DBG) Log.d(TAG, "setBluetoothTethering: " + value +", mTetherOn: " + mTetherOn);
        ConnectivityManager.enforceTetherChangePermission(getBaseContext());
        final Context context = getBaseContext();
        String pkgName = context.getOpPackageName();
        ConnectivityManager.enforceTetherChangePermission(context, pkgName);
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission");
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission");
        UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
        UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
        if (um.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
        if (um.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {