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

Commit 5c0457c9 authored by Himanshu Rawat's avatar Himanshu Rawat Committed by Gerrit Code Review
Browse files

Merge "Check against null device" into main

parents 4e2a7ca2 b2add9e8
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -236,6 +236,10 @@ public class RemoteDevices {
    }
    }


    DeviceProperties getDeviceProperties(BluetoothDevice device) {
    DeviceProperties getDeviceProperties(BluetoothDevice device) {
        if (device == null) {
            return null;
        }

        synchronized (mDevices) {
        synchronized (mDevices) {
            String address = mDualDevicesMap.get(device.getAddress());
            String address = mDualDevicesMap.get(device.getAddress());
            // If the device is not in the dual map, use its original address
            // If the device is not in the dual map, use its original address
+6 −0
Original line number Original line Diff line number Diff line
@@ -742,6 +742,12 @@ public class RemoteDevicesTest {
        Assert.assertFalse(deviceProp.isCoordinatedSetMember());
        Assert.assertFalse(deviceProp.isCoordinatedSetMember());
    }
    }


    @Test
    public void testIsDeviceNull() {
        Assert.assertNull(mRemoteDevices.getDeviceProperties(null));
    }


    private static void verifyBatteryLevelChangedIntent(BluetoothDevice device, int batteryLevel,
    private static void verifyBatteryLevelChangedIntent(BluetoothDevice device, int batteryLevel,
            ArgumentCaptor<Intent> intentArgument) {
            ArgumentCaptor<Intent> intentArgument) {
        verifyBatteryLevelChangedIntent(device, batteryLevel, intentArgument.getValue());
        verifyBatteryLevelChangedIntent(device, batteryLevel, intentArgument.getValue());