Fix the hotplug behaviors in TV.

- Don't run the local address allocation in the case of TV and the removed event.
- Let isTvDevice() return the value based on mLocalDevices, since tv() is
  unstable during the intialization period.

Bug: 17601460
Change-Id: Ic5701f1f86f51171960033bd97e169270a0021bf
This commit is contained in:
Yuncheol Heo
2014-09-22 19:53:41 +09:00
parent 8ade9f9037
commit b8d62e70bf

View File

@@ -724,20 +724,18 @@ public final class HdmiControlService extends SystemService {
void onHotplug(int portId, boolean connected) {
assertRunOnServiceThread();
ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>();
for (int type : mLocalDevices) {
if (type == HdmiDeviceInfo.DEVICE_TV) {
// Skip the reallocation of the logical address on TV.
continue;
if (connected && !isTvDevice()) {
ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>();
for (int type : mLocalDevices) {
HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type);
if (localDevice == null) {
localDevice = HdmiCecLocalDevice.create(this, type);
localDevice.init();
}
localDevices.add(localDevice);
}
HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type);
if (localDevice == null) {
localDevice = HdmiCecLocalDevice.create(this, type);
localDevice.init();
}
localDevices.add(localDevice);
allocateLogicalAddress(localDevices, INITIATED_BY_HOTPLUG);
}
allocateLogicalAddress(localDevices, INITIATED_BY_HOTPLUG);
for (HdmiCecLocalDevice device : mCecController.getLocalDeviceList()) {
device.onHotplug(portId, connected);
@@ -1691,7 +1689,7 @@ public final class HdmiControlService extends SystemService {
}
boolean isTvDevice() {
return tv() != null;
return mLocalDevices.contains(HdmiDeviceInfo.DEVICE_TV);
}
private HdmiCecLocalDevicePlayback playback() {