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

Commit 7c5d31ea authored by Yuncheol Heo's avatar Yuncheol Heo
Browse files

Invoke the callback only when DeviceInfo is available.

- There is possibility that DeviceInfo can be null when unplugging MHL cable,
  if the capability register event is missed. and we should not invoke
  the callback in this case.
- In addition, we'd better use the portId of HdmiMhlLocalDevice directly,
  not one of DeviceInfo.

Bug: 17366541
Change-Id: I40d71e27d82c5f3a4c7aabda32119856c0bde83d
parent c0f394e8
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -825,8 +825,11 @@ public final class HdmiControlService extends SystemService {
                device.onDeviceRemoved();
                // There is no explicit event for device removal unlike capability register event
                // used for device addition . Hence we remove the device on hotplug event.
                invokeDeviceEventListeners(device.getInfo(), DEVICE_EVENT_REMOVE_DEVICE);
                HdmiDeviceInfo deviceInfo = device.getInfo();
                if (deviceInfo != null) {
                    invokeDeviceEventListeners(deviceInfo, DEVICE_EVENT_REMOVE_DEVICE);
                    updateSafeMhlInput();
                }
            } else {
                Slog.w(TAG, "No device to remove:[portId=" + portId);
            }
@@ -1051,7 +1054,7 @@ public final class HdmiControlService extends SystemService {
                        // the connected mobile device, start routing control to switch ports.
                        // callback is handled by MHL action.
                        device.turnOn(callback);
                        tv.doManualPortSwitching(device.getInfo().getPortId(), null);
                        tv.doManualPortSwitching(device.getPortId(), null);
                        return;
                    }
                    tv.deviceSelect(deviceId, callback);