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

Commit df543d2d authored by tim peng's avatar tim peng Committed by Automerger Merge Worker
Browse files

Merge "Add null object checking" into rvc-dev am: bb6f50ce

Change-Id: I533c5e13a3f896c7e5cbe52f4bb8dd66db33df0b
parents b4e064f6 bb6f50ce
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -440,8 +440,9 @@ public class LocalMediaManager implements BluetoothCallback {
            MediaDevice connectDevice = getMediaDeviceById(mMediaDevices, id);
            MediaDevice connectDevice = getMediaDeviceById(mMediaDevices, id);
            connectDevice = connectDevice != null
            connectDevice = connectDevice != null
                    ? connectDevice : updateCurrentConnectedDevice();
                    ? connectDevice : updateCurrentConnectedDevice();
            if (connectDevice != null) {
                connectDevice.setState(MediaDeviceState.STATE_CONNECTED);
                connectDevice.setState(MediaDeviceState.STATE_CONNECTED);

            }
            if (connectDevice == mCurrentConnectedDevice) {
            if (connectDevice == mCurrentConnectedDevice) {
                Log.d(TAG, "onConnectedDeviceChanged() this device all ready connected!");
                Log.d(TAG, "onConnectedDeviceChanged() this device all ready connected!");
                return;
                return;
+6 −0
Original line number Original line Diff line number Diff line
@@ -449,6 +449,12 @@ public class LocalMediaManagerTest {
                .STATE_CONNECTED);
                .STATE_CONNECTED);
    }
    }


    @Test
    public void onConnectedDeviceChanged_nullConnectedDevice_noException() {
        mLocalMediaManager.registerCallback(mCallback);
        mLocalMediaManager.mMediaDeviceCallback.onConnectedDeviceChanged(TEST_DEVICE_ID_2);
    }

    @Test
    @Test
    public void onDeviceAttributesChanged_shouldDispatchDeviceListUpdate() {
    public void onDeviceAttributesChanged_shouldDispatchDeviceListUpdate() {
        mLocalMediaManager.registerCallback(mCallback);
        mLocalMediaManager.registerCallback(mCallback);