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

Commit f5fb6c8c authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Enforce permission for changeApplicationState function.

The ADMIN permission is for use cases where we want to manage BT connection
at a deeper level. So just the Bluetooth permission is good enough here.

Change-Id: Iddd038fe9f9a26f155b4edc9484ba1fe27b178ba
parent 62c7b375
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1163,7 +1163,10 @@ public final class BluetoothAdapter {
     * <p> If this API returns true, it means the callback will be called.
     * The callback will be called with the current state of Bluetooth.
     * If the state is not what was requested, an internal error would be the
     * reason.
     * reason. If Bluetooth is already on and if this function is called to turn
     * it on, the api will return true and a callback will be called.
     *
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
     *
     * @param on True for on, false for off.
     * @param callback The callback to notify changes to the state.
+2 −0
Original line number Diff line number Diff line
@@ -1565,6 +1565,8 @@ public class BluetoothService extends IBluetooth.Stub {
    @Override
    public boolean changeApplicationBluetoothState(boolean on,
            IBluetoothStateChangeCallback callback, IBinder binder) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");

        int pid = Binder.getCallingPid();
        //mStateChangeTracker is a synchronized map
        if (!mStateChangeTracker.containsKey(pid)) {