Loading android/app/src/com/android/bluetooth/tbs/TbsGatt.java +5 −1 Original line number Diff line number Diff line Loading @@ -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()) { Loading Loading @@ -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)); Loading android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGattTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading Loading
android/app/src/com/android/bluetooth/tbs/TbsGatt.java +5 −1 Original line number Diff line number Diff line Loading @@ -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()) { Loading Loading @@ -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)); Loading
android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGattTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading