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

Commit 30cb30e5 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

TMAP: Fix characteristic permissions

TMAP role should be readable without the authentication.

Bug: 288058596
Test: atest BluetoothInstrumentationTests
Change-Id: I2bdc42a2ea1ca2981013a450807c364e2b03e28b
parent e40fa791
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -84,10 +84,11 @@ public class LeAudioTmapGattServer {
                new BluetoothGattService(BluetoothUuid.TMAP.getUuid(),
                BluetoothGattService.SERVICE_TYPE_PRIMARY);

        BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(
        BluetoothGattCharacteristic characteristic =
                new BluetoothGattCharacteristic(
                        UUID_TMAP_ROLE,
                        BluetoothGattCharacteristic.PROPERTY_READ,
                BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED);
                        BluetoothGattCharacteristic.PERMISSION_READ);

        characteristic.setValue(roleMask, BluetoothGattCharacteristic.FORMAT_UINT16, 0);
        service.addCharacteristic(characteristic);
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.bluetooth.le_audio;

import static android.bluetooth.BluetoothGattCharacteristic.FORMAT_UINT16;
import static android.bluetooth.BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED;
import static android.bluetooth.BluetoothGattCharacteristic.PERMISSION_READ;
import static android.bluetooth.BluetoothGattCharacteristic.PROPERTY_READ;

import static com.google.common.truth.Truth.assertThat;
@@ -86,7 +86,7 @@ public class LeAudioTmapGattServerTest {
                service.getCharacteristic(LeAudioTmapGattServer.UUID_TMAP_ROLE);
        assertThat(characteristic).isNotNull();
        assertThat(characteristic.getProperties()).isEqualTo(PROPERTY_READ);
        assertThat(characteristic.getPermissions()).isEqualTo(PERMISSION_READ_ENCRYPTED);
        assertThat(characteristic.getPermissions()).isEqualTo(PERMISSION_READ);

        // verify characteristic value
        int value = characteristic.getIntValue(FORMAT_UINT16, 0);