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

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

Merge "gtbs: Fix sending notification on CallControl point"

parents df658259 9aee7814
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -355,6 +355,10 @@ public class TbsGatt {
            return success;
        }

        public boolean setValueNoNotify(byte[] value) {
            return super.setValue(value);
        }

        public boolean clearValue(boolean notify) {
            boolean success = super.setValue(new byte[0]);
            if (success && notify && isNotifiable()) {
@@ -409,7 +413,7 @@ public class TbsGatt {
            value[1] = (byte) (callIndex);
            value[2] = (byte) (requestResult);

            super.setValue(value);
            super.setValueNoNotify(value);

            // to avoid sending control point notification before write response
            mContext.getMainThreadHandler().post(() -> mNotifier.notify(device, this));
+4 −3
Original line number Diff line number Diff line
@@ -465,8 +465,8 @@ public class TbsGattTest {
        Assert.assertTrue(Arrays.equals(characteristic.getValue(),
                new byte[] {(byte) (requestedOpcode & 0xff), (byte) (callIndex & 0xff),
                        (byte) (result & 0xff)}));
        verify(mMockGattServer).notifyCharacteristicChanged(eq(mCurrentDevice), eq(characteristic),
                eq(false));
        verify(mMockGattServer, after(2000)).notifyCharacteristicChanged(eq(mCurrentDevice),
                eq(characteristic), eq(false));
        reset(mMockGattServer);

        callIndex = 0x02;
@@ -477,7 +477,8 @@ public class TbsGattTest {
        Assert.assertTrue(Arrays.equals(characteristic.getValue(),
                new byte[] {(byte) (requestedOpcode & 0xff), (byte) (callIndex & 0xff),
                        (byte) (result & 0xff)}));
        verify(mMockGattServer, times(0)).notifyCharacteristicChanged(any(), any(), anyBoolean());
        verify(mMockGattServer, after(2000).times(0)).notifyCharacteristicChanged(any(), any(),
                anyBoolean());
    }

    @Test