Loading services/core/java/com/android/server/hdmi/HdmiCecController.java +2 −3 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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(); Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +25 −0 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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; Loading Loading @@ -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; Loading Loading
services/core/java/com/android/server/hdmi/HdmiCecController.java +2 −3 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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(); Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +25 −0 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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; Loading Loading @@ -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; Loading