diff options
author | Jinsuk Kim <jinsukkim@google.com> | 2015-01-28 16:44:07 +0900 |
---|---|---|
committer | Jinsuk Kim <jinsukkim@google.com> | 2015-01-29 06:41:49 +0000 |
commit | 7640d9895cf8fae7a99a7db5bba0079ba6022621 (patch) | |
tree | f0e5f2f145a7da2571ac60eff473ca5674443591 /services/core/java/com/android/server/hdmi | |
parent | 43b2746bcdfb49aed255ac0f6dd6fb95909dcfc1 (diff) | |
download | frameworks_base-7640d9895cf8fae7a99a7db5bba0079ba6022621.zip frameworks_base-7640d9895cf8fae7a99a7db5bba0079ba6022621.tar.gz frameworks_base-7640d9895cf8fae7a99a7db5bba0079ba6022621.tar.bz2 |
CEC: Fix a regression bug
The HdmiControlService.getActiveSource() has a regression (exception)
when calling getDeviceInfoByPath since method should be called on
a service thread. Introduced a method that can be invoked safely
from the main thread.
Bug: 19170884
Change-Id: I393161e08c916270faf46147a97076bc573b808f
Diffstat (limited to 'services/core/java/com/android/server/hdmi')
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java | 19 | ||||
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiControlService.java | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index 43ef457..9373e43 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -1456,6 +1456,25 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { } /** + * 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 * in a device info list. However, both are minimal condition and it could * be different device from the original one. diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 9f78c61..49a96d8 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -1196,7 +1196,7 @@ public final class HdmiControlService extends SystemService { } int activePath = tv.getActivePath(); 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 null; |