diff options
author | Jungshik Jang <jayjang@google.com> | 2014-06-02 04:34:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-02 04:34:36 +0000 |
commit | f7ecc88b81ba727d03bcda2ec610a47e17a6304e (patch) | |
tree | ddb8b1e4cdef9a83ba844c5a699631f792e002c4 | |
parent | a8b57081f877dfee95fa93149d87ee15a539c5b0 (diff) | |
parent | 562ef5c513a859b3d2b0f54c15f25e4ec3ec9f7a (diff) | |
download | frameworks_base-f7ecc88b81ba727d03bcda2ec610a47e17a6304e.zip frameworks_base-f7ecc88b81ba727d03bcda2ec610a47e17a6304e.tar.gz frameworks_base-f7ecc88b81ba727d03bcda2ec610a47e17a6304e.tar.bz2 |
Merge "DO NOT MERGE: Add HdmiCecDeviceInfo to HdmiCecLocalDevice" into lmp-preview-dev
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecController.java | 5 | ||||
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java | 25 |
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; |