am 7640d989: CEC: Fix a regression bug

* commit '7640d9895cf8fae7a99a7db5bba0079ba6022621':
  CEC: Fix a regression bug
This commit is contained in:
Jinsuk Kim
2015-01-29 06:46:43 +00:00
committed by Android Git Automerger
2 changed files with 20 additions and 1 deletions

View File

@@ -1455,6 +1455,25 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
return null; return null;
} }
/**
* Returns the {@link HdmiDeviceInfo} instance whose physical address matches
* the given routing path. This is the version accessible safely from threads
* other than service thread.
*
* @param path routing path or physical address
* @return {@link HdmiDeviceInfo} if the matched info is found; otherwise null
*/
HdmiDeviceInfo getSafeDeviceInfoByPath(int path) {
synchronized (mLock) {
for (HdmiDeviceInfo info : mSafeAllDeviceInfos) {
if (info.getPhysicalAddress() == path) {
return info;
}
}
return null;
}
}
/** /**
* Whether a device of the specified physical address and logical address exists * Whether a device of the specified physical address and logical address exists
* in a device info list. However, both are minimal condition and it could * in a device info list. However, both are minimal condition and it could

View File

@@ -1196,7 +1196,7 @@ public final class HdmiControlService extends SystemService {
} }
int activePath = tv.getActivePath(); int activePath = tv.getActivePath();
if (activePath != HdmiDeviceInfo.PATH_INVALID) { if (activePath != HdmiDeviceInfo.PATH_INVALID) {
HdmiDeviceInfo info = tv.getDeviceInfoByPath(activePath); HdmiDeviceInfo info = tv.getSafeDeviceInfoByPath(activePath);
return (info != null) ? info : new HdmiDeviceInfo(activePath, tv.getActivePortId()); return (info != null) ? info : new HdmiDeviceInfo(activePath, tv.getActivePortId());
} }
return null; return null;