Loading android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java +6 −3 Original line number Diff line number Diff line Loading @@ -3224,7 +3224,7 @@ public class BluetoothMapContentObserver { } if (msgInfo.partsSent == msgInfo.parts) { actionMessageSent(context, intent, msgInfo); actionMessageSent(context, intent, msgInfo, handle); } } else if (action.equals(ACTION_MESSAGE_DELIVERY)) { long timestamp = intent.getLongExtra(EXTRA_MESSAGE_SENT_TIMESTAMP, 0); Loading @@ -3237,7 +3237,8 @@ public class BluetoothMapContentObserver { } } private void actionMessageSent(Context context, Intent intent, PushMsgInfo msgInfo) { private void actionMessageSent( Context context, Intent intent, PushMsgInfo msgInfo, long handle) { /* As the MESSAGE_SENT intent is forwarded from the MAP service, we use the intent * to carry the result, as getResult() will not return the correct value. */ Loading Loading @@ -3297,7 +3298,9 @@ public class BluetoothMapContentObserver { } /* Delete from DB */ mResolver.delete(msgInfo.uri, null, null); Uri msgUri = ContentUris.withAppendedId(Sms.CONTENT_URI, handle); int nRows = mResolver.delete(msgUri, null, null); if (V && nRows > 0) Log.v(TAG, "Deleted message with Uri = " + msgUri); } } Loading android/app/tests/src/com/android/bluetooth/btservice/RemoteDevicesTest.java +18 −7 Original line number Diff line number Diff line Loading @@ -49,14 +49,11 @@ public class RemoteDevicesTest { @Test public void testSendUuidIntent() { mRemoteDevices.updateUuids(mDevice1); if (Looper.myLooper() != null) { Looper.myLooper().quitSafely(); } MyAdapterSvc m = new MyAdapterSvc(); RemoteDevices instance = new RemoteDevices(m); instance.updateUuids(mDevice1); Looper.loop(); verify(mAdapterService).sendBroadcast(any(), anyString()); verifyNoMoreInteractions(mAdapterService); Assert.assertTrue(m.isRecvd()); } @Test Loading Loading @@ -465,4 +462,18 @@ public class RemoteDevicesTest { list.add(0); return list.toArray(); } public class MyAdapterSvc extends AdapterService { private boolean recvd = false; @Override public void sendBroadcast(Intent intent, String receiverPermission) { recvd = (intent.getAction() == BluetoothDevice.ACTION_UUID); if (recvd || Looper.myQueue().isIdle()) Looper.myLooper().quitSafely(); } boolean isRecvd() { return recvd; } } } Loading
android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java +6 −3 Original line number Diff line number Diff line Loading @@ -3224,7 +3224,7 @@ public class BluetoothMapContentObserver { } if (msgInfo.partsSent == msgInfo.parts) { actionMessageSent(context, intent, msgInfo); actionMessageSent(context, intent, msgInfo, handle); } } else if (action.equals(ACTION_MESSAGE_DELIVERY)) { long timestamp = intent.getLongExtra(EXTRA_MESSAGE_SENT_TIMESTAMP, 0); Loading @@ -3237,7 +3237,8 @@ public class BluetoothMapContentObserver { } } private void actionMessageSent(Context context, Intent intent, PushMsgInfo msgInfo) { private void actionMessageSent( Context context, Intent intent, PushMsgInfo msgInfo, long handle) { /* As the MESSAGE_SENT intent is forwarded from the MAP service, we use the intent * to carry the result, as getResult() will not return the correct value. */ Loading Loading @@ -3297,7 +3298,9 @@ public class BluetoothMapContentObserver { } /* Delete from DB */ mResolver.delete(msgInfo.uri, null, null); Uri msgUri = ContentUris.withAppendedId(Sms.CONTENT_URI, handle); int nRows = mResolver.delete(msgUri, null, null); if (V && nRows > 0) Log.v(TAG, "Deleted message with Uri = " + msgUri); } } Loading
android/app/tests/src/com/android/bluetooth/btservice/RemoteDevicesTest.java +18 −7 Original line number Diff line number Diff line Loading @@ -49,14 +49,11 @@ public class RemoteDevicesTest { @Test public void testSendUuidIntent() { mRemoteDevices.updateUuids(mDevice1); if (Looper.myLooper() != null) { Looper.myLooper().quitSafely(); } MyAdapterSvc m = new MyAdapterSvc(); RemoteDevices instance = new RemoteDevices(m); instance.updateUuids(mDevice1); Looper.loop(); verify(mAdapterService).sendBroadcast(any(), anyString()); verifyNoMoreInteractions(mAdapterService); Assert.assertTrue(m.isRecvd()); } @Test Loading Loading @@ -465,4 +462,18 @@ public class RemoteDevicesTest { list.add(0); return list.toArray(); } public class MyAdapterSvc extends AdapterService { private boolean recvd = false; @Override public void sendBroadcast(Intent intent, String receiverPermission) { recvd = (intent.getAction() == BluetoothDevice.ACTION_UUID); if (recvd || Looper.myQueue().isIdle()) Looper.myLooper().quitSafely(); } boolean isRecvd() { return recvd; } } }