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

Commit a74bca86 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Gerrit Code Review
Browse files

Merge "Tbs: Fix for possible IllegalArgumentException"

parents 30287c0e 34a06ab1
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ public class TbsGatt {
        }

        public void notify(BluetoothDevice device) {
            if (isNotifiable()) {
            if (isNotifiable() && super.getValue() != null) {
                mNotifier.notify(device, this);
            }
        }
@@ -1363,6 +1363,10 @@ public class TbsGatt {
                        : (auth == BluetoothDevice.ACCESS_REJECTED ? "REJECTED" : "UNKNOWN")));
        processPendingGattOperations(device);

        if (auth != BluetoothDevice.ACCESS_ALLOWED) {
            return;
        }

        BluetoothGattService gattService = mBluetoothGattServer.getService(UUID_GTBS);
        if (gattService != null) {
            List<BluetoothGattCharacteristic> characteristics = gattService.getCharacteristics();
@@ -1370,11 +1374,20 @@ public class TbsGatt {
                GattCharacteristic wrapper =
                        getLocalCharacteristicWrapper(characteristic.getUuid());
                if (wrapper != null) {
                    /* Value of status flags is not keep in the characteristic but in the
                     * mStatusFlagValue
                     */
                    if (characteristic.getUuid().equals(UUID_STATUS_FLAGS)) {
                        if (mStatusFlagValue.containsKey(device)) {
                            updateStatusFlags(device, mStatusFlagValue.get(device));
                        }
                    } else {
                        wrapper.notify(device);
                    }
                }
            }
        }
    }

    private void clearUnauthorizedGattOperationss(BluetoothDevice device) {
        if (DBG) {
+1 −1
Original line number Diff line number Diff line
@@ -866,7 +866,7 @@ public class TbsGattTest {
        verify(mMockGattServer, times(0))
                .notifyCharacteristicChanged(any(), eq(characteristic2), eq(false));
        verify(mMockGattServer, times(1))
                .notifyCharacteristicChanged(any(), eq(characteristic), eq(false));
                .notifyCharacteristicChanged(any(), eq(characteristic), eq(false), eq(valueBytes));
    }

    @Test