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

Commit b389bdfb authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Android (Google) Code Review
Browse files

Merge "Enforce permission for changeApplicationState function."

parents e28cde62 f5fb6c8c
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)) {