summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJungshik Jang <jayjang@google.com>2014-05-26 11:02:36 +0900
committerJungshik Jang <jayjang@google.com>2014-06-02 10:50:37 +0900
commit562ef5c513a859b3d2b0f54c15f25e4ec3ec9f7a (patch)
tree4696a4ea38bb9e07dff4e4551cb9cc8fa1920187 /services
parent9d499bfe4a52068fd0c25b3cce34bd5e445e0f96 (diff)
downloadframeworks_base-562ef5c513a859b3d2b0f54c15f25e4ec3ec9f7a.zip
frameworks_base-562ef5c513a859b3d2b0f54c15f25e4ec3ec9f7a.tar.gz
frameworks_base-562ef5c513a859b3d2b0f54c15f25e4ec3ec9f7a.tar.bz2
DO NOT MERGE: Add HdmiCecDeviceInfo to HdmiCecLocalDevice
As HdmiCecLoclaDevice is a wrapper for local devices it should include cec device info. Change-Id: I479665b2aa6bd56470b79dbbb7fb1015f6356090
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecController.java5
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java25
2 files changed, 27 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index 36e0ed7..8d0696b 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -76,8 +76,8 @@ final class HdmiCecController {
private HdmiControlService mService;
- // Map-like container of all cec devices. A logical address of device is
- // used as key of container.
+ // Map-like container of all cec devices including local ones.
+ // A logical address of device is used as key of container.
private final SparseArray<HdmiCecDeviceInfo> mDeviceInfos = new SparseArray<>();
// Stores the local CEC devices in the system.
@@ -265,7 +265,6 @@ final class HdmiCecController {
*
* <p>Declared as package-private. accessed by {@link HdmiControlService} only.
*/
- // TODO: put local devices to this list.
List<HdmiCecDeviceInfo> getDeviceInfoList() {
assertRunOnServiceThread();
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
index 789a551..e65e5fa 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
@@ -19,6 +19,7 @@ package com.android.server.hdmi;
import com.android.server.hdmi.HdmiCecController.AllocateLogicalAddressCallback;
import android.hardware.hdmi.HdmiCec;
+import android.hardware.hdmi.HdmiCecDeviceInfo;
/**
* Class that models a logical CEC device hosted in this system. Handles initialization,
@@ -30,6 +31,7 @@ abstract class HdmiCecLocalDevice {
protected final int mDeviceType;
protected int mAddress;
protected int mPreferredAddress;
+ protected HdmiCecDeviceInfo mDeviceInfo;
protected HdmiCecLocalDevice(HdmiCecController controller, int deviceType) {
mController = controller;
@@ -57,11 +59,34 @@ abstract class HdmiCecLocalDevice {
@Override
public void onAllocated(int deviceType, int logicalAddress) {
mAddress = mPreferredAddress = logicalAddress;
+
+ // Create and set device info.
+ HdmiCecDeviceInfo deviceInfo = createDeviceInfo(mAddress, deviceType);
+ setDeviceInfo(deviceInfo);
+ mController.addDeviceInfo(deviceInfo);
+
mController.addLogicalAddress(logicalAddress);
}
});
}
+ private final HdmiCecDeviceInfo createDeviceInfo(int logicalAddress, int deviceType) {
+ int vendorId = mController.getVendorId();
+ int physicalAddress = mController.getPhysicalAddress();
+ // TODO: get device name read from system configuration.
+ String displayName = HdmiCec.getDefaultDeviceName(logicalAddress);
+ return new HdmiCecDeviceInfo(logicalAddress,
+ physicalAddress, deviceType, vendorId, displayName);
+ }
+
+ HdmiCecDeviceInfo getDeviceInfo() {
+ return mDeviceInfo;
+ }
+
+ void setDeviceInfo(HdmiCecDeviceInfo info) {
+ mDeviceInfo = info;
+ }
+
// Returns true if the logical address is same as the argument.
boolean isAddressOf(int addr) {
return addr == mAddress;