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

Commit 6012c684 authored by vnori's avatar vnori Committed by android-build-merger
Browse files

Merge "port this change to aosp/ I3fb908c43f869e8816f6e46c6b271ef0bbd15be0"...

Merge "port this change to aosp/ I3fb908c43f869e8816f6e46c6b271ef0bbd15be0" am: b4146bc1 am: 7ed577d0
am: ddcc5cb5

Change-Id: I1b501666ac6296e3ff852123fb4609e8409c8ed2
parents 65e9a512 ddcc5cb5
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -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
@@ -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;
        }
    }
}