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

Commit 3eea4cdf authored by Ajay Panicker's avatar Ajay Panicker
Browse files

[DO NOT MERGE] Fix setPairingConfirmation permissions issue (1/2)

setPairingConfirmation was set to only require BLUETOOTH_ADMIN
permission which shouldn't be able to set the confirmation itself.

This is restricted to BLUETOOTH_PRIVILEGED permission.

Bug: 29043989
Change-Id: Iae8e31b25795989446265fdcc5eb27e6ffaf29aa
parent 4d9eaceb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1296,8 +1296,8 @@ public class AdapterService extends Service {
    }

     boolean setPairingConfirmation(BluetoothDevice device, boolean accept) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                       "Need BLUETOOTH ADMIN permission");
        enforceCallingOrSelfPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                                       "Need BLUETOOTH PRIVILEGED permission");
        DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device);
        if (deviceProp == null || deviceProp.getBondState() != BluetoothDevice.BOND_BONDING) {
            return false;