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

Commit bb6f50ce authored by tim peng's avatar tim peng Committed by Android (Google) Code Review
Browse files

Merge "Add null object checking" into rvc-dev

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

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

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

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