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

Commit 5cbca17d authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Gerrit Code Review
Browse files

Merge "TMAP: Fix characteristic permissions" into main

parents 0cfacee8 30cb30e5
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -84,10 +84,11 @@ public class LeAudioTmapGattServer {
                new BluetoothGattService(BluetoothUuid.TMAP.getUuid(),
                new BluetoothGattService(BluetoothUuid.TMAP.getUuid(),
                BluetoothGattService.SERVICE_TYPE_PRIMARY);
                BluetoothGattService.SERVICE_TYPE_PRIMARY);


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


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


import static android.bluetooth.BluetoothGattCharacteristic.FORMAT_UINT16;
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 android.bluetooth.BluetoothGattCharacteristic.PROPERTY_READ;


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


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