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

Commit 511de429 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Tbs: Fix restoring CCC values when not initialised" into main

parents db9cc6ad 1a763454
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -249,9 +249,6 @@ public class TbsGatt {
                        AdapterService.getAdapterService(),
                        "AdapterService shouldn't be null when creating TbsGatt");

        mAdapterService.registerBluetoothStateCallback(
                mContext.getMainExecutor(), mBluetoothStateChangeCallback);

        mBearerProviderNameCharacteristic =
                new GattCharacteristic(
                        UUID_BEARER_PROVIDER_NAME,
@@ -377,9 +374,15 @@ public class TbsGatt {
        mEventLogger =
                new BluetoothEventLogger(
                        LOG_NB_EVENTS, TAG + " instance (CCID= " + ccid + ") event log");
        mEventLogger.add("Initializing");
        if (!mBluetoothGattServer.addService(gattService)) {
            mEventLogger.add("Initialization failed");
            return false;
        }

        return mBluetoothGattServer.addService(gattService);
        mEventLogger.add("Initialized");
        mAdapterService.registerBluetoothStateCallback(
                mContext.getMainExecutor(), mBluetoothStateChangeCallback);
        return true;
    }

    public void cleanup() {
+1 −0
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ public class TbsGattTest {
                        mMockTbsGattCallback));
        Assert.assertNotNull(mMockGattServer);

        verify(mAdapterService, times(1)).registerBluetoothStateCallback(any(), any());
        verify(mMockGattServer).addService(mGattServiceCaptor.capture());
        doReturn(mGattServiceCaptor.getValue()).when(mMockGattServer).getService(any(UUID.class));
        Assert.assertNotNull(mMockGattServer);