UUID.fromString("00002A4D-0000-1000-8000-00805F9B34FB")
};
+ private static final UUID[] FIDO_UUIDS = {
+ UUID.fromString("0000FFFD-0000-1000-8000-00805F9B34FB") // U2F
+ };
+
/**
* Search queue to serialize remote onbject inspection.
*/
+ ", charUuid=" + charUuid + ", length=" + data.length);
- if (isHidUuid(charUuid) &&
+ if (isRestrictedCharUuid(charUuid) || isRestrictedSrvcUuid(srvcUuid) &&
(0 != checkCallingOrSelfPermission(BLUETOOTH_PRIVILEGED))) {
return;
}
int srvcInstanceId, UUID srvcUuid,
int charInstanceId, UUID charUuid, int authReq) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
- if (isHidUuid(charUuid)) enforcePrivilegedPermission();
+ if (isRestrictedCharUuid(charUuid) || isRestrictedSrvcUuid(srvcUuid)) {
+ enforcePrivilegedPermission();
+ }
if (VDBG) Log.d(TAG, "readCharacteristic() - address=" + address);
int charInstanceId, UUID charUuid, int writeType,
int authReq, byte[] value) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
- if (isHidUuid(charUuid)) enforcePrivilegedPermission();
+ if (isRestrictedCharUuid(charUuid) || isRestrictedSrvcUuid(srvcUuid)) {
+ enforcePrivilegedPermission();
+ }
if (VDBG) Log.d(TAG, "writeCharacteristic() - address=" + address);
int descrInstanceId, UUID descrUuid,
int authReq) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
- if (isHidUuid(charUuid)) enforcePrivilegedPermission();
+ if (isRestrictedCharUuid(charUuid) || isRestrictedSrvcUuid(srvcUuid)) {
+ enforcePrivilegedPermission();
+ }
if (VDBG) Log.d(TAG, "readDescriptor() - address=" + address);
int descrInstanceId, UUID descrUuid,
int writeType, int authReq, byte[] value) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
- if (isHidUuid(charUuid)) enforcePrivilegedPermission();
+ if (isRestrictedCharUuid(charUuid) || isRestrictedSrvcUuid(srvcUuid)) {
+ enforcePrivilegedPermission();
+ }
if (VDBG) Log.d(TAG, "writeDescriptor() - address=" + address);
int charInstanceId, UUID charUuid,
boolean enable) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
- if (isHidUuid(charUuid)) enforcePrivilegedPermission();
+ if (isRestrictedCharUuid(charUuid) || isRestrictedSrvcUuid(srvcUuid)) {
+ enforcePrivilegedPermission();
+ }
if (DBG) Log.d(TAG, "registerForNotification() - address=" + address + " enable: " + enable);
* Private functions
*************************************************************************/
+ private boolean isRestrictedCharUuid(final UUID charUuid) {
+ return isHidUuid(charUuid);
+ }
+
+ private boolean isRestrictedSrvcUuid(final UUID srvcUuid) {
+ return isFidoUUID(srvcUuid);
+ }
+
private boolean isHidUuid(final UUID uuid) {
for (UUID hid_uuid : HID_UUIDS) {
if (hid_uuid.equals(uuid)) return true;
return false;
}
+ private boolean isFidoUUID(final UUID uuid) {
+ for (UUID fido_uuid : FIDO_UUIDS) {
+ if (fido_uuid.equals(uuid)) return true;
+ }
+ return false;
+ }
+
private int getDeviceType(BluetoothDevice device) {
int type = gattClientGetDeviceTypeNative(device.getAddress());
if (DBG) Log.d(TAG, "getDeviceType() - device=" + device