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

Commit 84516ab2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "HIDD: Add caller permission check" into pi-dev

parents ab20f0c1 4b70987d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -480,6 +480,7 @@ public class HidDeviceService extends ProfileService {
    synchronized boolean registerApp(BluetoothHidDeviceAppSdpSettings sdp,
            BluetoothHidDeviceAppQosSettings inQos, BluetoothHidDeviceAppQosSettings outQos,
            IBluetoothHidDeviceCallback callback) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (mUserUid != 0) {
            Log.w(TAG, "registerApp(): failed because another app is registered");
            return false;
@@ -526,6 +527,7 @@ public class HidDeviceService extends ProfileService {
    }

    synchronized boolean unregisterApp() {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            Log.d(TAG, "unregisterApp()");
        }
@@ -550,6 +552,7 @@ public class HidDeviceService extends ProfileService {
    }

    synchronized boolean sendReport(BluetoothDevice device, int id, byte[] data) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            Log.d(TAG, "sendReport(): device=" + device + " id=" + id);
        }
@@ -559,6 +562,7 @@ public class HidDeviceService extends ProfileService {
    }

    synchronized boolean replyReport(BluetoothDevice device, byte type, byte id, byte[] data) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            Log.d(TAG, "replyReport(): device=" + device + " type=" + type + " id=" + id);
        }
@@ -568,6 +572,7 @@ public class HidDeviceService extends ProfileService {
    }

    synchronized boolean unplug(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            Log.d(TAG, "unplug(): device=" + device);
        }
@@ -577,6 +582,7 @@ public class HidDeviceService extends ProfileService {
    }

    synchronized boolean connect(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            Log.d(TAG, "connect(): device=" + device);
        }
@@ -585,6 +591,7 @@ public class HidDeviceService extends ProfileService {
    }

    synchronized boolean disconnect(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            Log.d(TAG, "disconnect(): device=" + device);
        }
@@ -598,6 +605,7 @@ public class HidDeviceService extends ProfileService {
    }

    synchronized boolean reportError(BluetoothDevice device, byte error) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            Log.d(TAG, "reportError(): device=" + device + " error=" + error);
        }
@@ -669,6 +677,7 @@ public class HidDeviceService extends ProfileService {
    }

    int getConnectionState(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (mHidDevice != null && mHidDevice.equals(device)) {
            return mHidDeviceState;
        }