Rename HdmiCecDeviceInfo into HdmiDeviceInfo.
In order to include mhl device info to device info,
rename HdmiCecDeviceInfo into HdmiDeviceInfo.
BUG: 16215362
Change-Id: I30fb0216061fbbdd6fdc1b82c63af83f1b678597
diff --git a/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java b/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java
deleted file mode 100644
index 6e1844a..0000000
--- a/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.hdmi;
-
-import android.annotation.SystemApi;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * A class to encapsulate device information for HDMI-CEC. This container
- * include basic information such as logical address, physical address and
- * device type, and additional information like vendor id and osd name.
- * Also used to keep the information of non-CEC devices for which only
- * port ID, physical address are meaningful.
- *
- * @hide
- */
-@SystemApi
-public final class HdmiCecDeviceInfo implements Parcelable {
-
- /** TV device type. */
- public static final int DEVICE_TV = 0;
-
- /** Recording device type. */
- public static final int DEVICE_RECORDER = 1;
-
- /** Device type reserved for future usage. */
- public static final int DEVICE_RESERVED = 2;
-
- /** Tuner device type. */
- public static final int DEVICE_TUNER = 3;
-
- /** Playback device type. */
- public static final int DEVICE_PLAYBACK = 4;
-
- /** Audio system device type. */
- public static final int DEVICE_AUDIO_SYSTEM = 5;
-
- /** @hide Pure CEC switch device type. */
- public static final int DEVICE_PURE_CEC_SWITCH = 6;
-
- /** @hide Video processor device type. */
- public static final int DEVICE_VIDEO_PROCESSOR = 7;
-
- // Value indicating the device is not an active source.
- public static final int DEVICE_INACTIVE = -1;
-
- /**
- * Logical address used to indicate the source comes from internal device.
- * The logical address of TV(0) is used.
- */
- public static final int ADDR_INTERNAL = 0;
-
- /**
- * Physical address used to indicate the source comes from internal device.
- * The physical address of TV(0) is used.
- */
- public static final int PATH_INTERNAL = 0x0000;
-
- /** Invalid physical address (routing path) */
- public static final int PATH_INVALID = 0xFFFF;
-
- /** Invalid port ID */
- public static final int PORT_INVALID = -1;
-
- // Logical address, physical address, device type, vendor id and display name
- // are immutable value.
- private final int mLogicalAddress;
- private final int mPhysicalAddress;
- private final int mPortId;
- private final int mDeviceType;
- private final int mVendorId;
- private final String mDisplayName;
- private final boolean mIsCecDevice;
-
- /**
- * A helper class to deserialize {@link HdmiCecDeviceInfo} for a parcel.
- */
- public static final Parcelable.Creator<HdmiCecDeviceInfo> CREATOR =
- new Parcelable.Creator<HdmiCecDeviceInfo>() {
- @Override
- public HdmiCecDeviceInfo createFromParcel(Parcel source) {
- int logicalAddress = source.readInt();
- int physicalAddress = source.readInt();
- int portId = source.readInt();
- int deviceType = source.readInt();
- int vendorId = source.readInt();
- String displayName = source.readString();
- return new HdmiCecDeviceInfo(logicalAddress, physicalAddress, portId,
- deviceType, vendorId, displayName);
- }
-
- @Override
- public HdmiCecDeviceInfo[] newArray(int size) {
- return new HdmiCecDeviceInfo[size];
- }
- };
-
- /**
- * Constructor. Used to initialize the instance for CEC device.
- *
- * @param logicalAddress logical address of HDMI-CEC device
- * @param physicalAddress physical address of HDMI-CEC device
- * @param portId HDMI port ID (1 for HDMI1)
- * @param deviceType type of device
- * @param vendorId vendor id of device. Used for vendor specific command.
- * @param displayName name of device
- * @hide
- */
- public HdmiCecDeviceInfo(int logicalAddress, int physicalAddress, int portId, int deviceType,
- int vendorId, String displayName) {
- mLogicalAddress = logicalAddress;
- mPhysicalAddress = physicalAddress;
- mPortId = portId;
- mDeviceType = deviceType;
- mDisplayName = displayName;
- mVendorId = vendorId;
- mIsCecDevice = true;
- }
-
- /**
- * Constructor. Used to initialize the instance for non-CEC device.
- *
- * @param physicalAddress physical address of HDMI device
- * @param portId HDMI port ID (1 for HDMI1)
- * @hide
- */
- public HdmiCecDeviceInfo(int physicalAddress, int portId) {
- mLogicalAddress = -1;
- mPhysicalAddress = physicalAddress;
- mPortId = portId;
- mDeviceType = DEVICE_RESERVED;
- mDisplayName = null;
- mVendorId = 0;
- mIsCecDevice = false;
- }
-
- /**
- * Return the logical address of the device.
- */
- public int getLogicalAddress() {
- return mLogicalAddress;
- }
-
- /**
- * Return the physical address of the device.
- */
- public int getPhysicalAddress() {
- return mPhysicalAddress;
- }
-
- /**
- * Return the port ID.
- */
- public int getPortId() {
- return mPortId;
- }
-
- /**
- * Return type of the device. For more details, refer constants between
- * {@link DEVICE_TV} and {@link DEVICE_INACTIVE}.
- */
- public int getDeviceType() {
- return mDeviceType;
- }
-
- /**
- * Return {@code true} if the device is of a type that can be an input source.
- */
- public boolean isSourceType() {
- return mDeviceType == DEVICE_PLAYBACK
- || mDeviceType == DEVICE_RECORDER
- || mDeviceType == DEVICE_TUNER;
- }
-
- /**
- * Return {@code true} if the device represents an HDMI-CEC device. {@code false}
- * if the device is either MHL or non-CEC device.
- */
- public boolean isCecDevice() {
- return mIsCecDevice;
- }
-
- /**
- * Return display (OSD) name of the device.
- */
- public String getDisplayName() {
- return mDisplayName;
- }
-
- /**
- * Return vendor id of the device. Vendor id is used to distinguish devices
- * built by other manufactures. This is required for vendor-specific command
- * on CEC standard.
- */
- public int getVendorId() {
- return mVendorId;
- }
-
- /**
- * Describe the kinds of special objects contained in this Parcelable's
- * marshalled representation.
- */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * Serialize this object into a {@link Parcel}.
- *
- * @param dest The Parcel in which the object should be written.
- * @param flags Additional flags about how the object should be written.
- * May be 0 or {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE}.
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mLogicalAddress);
- dest.writeInt(mPhysicalAddress);
- dest.writeInt(mPortId);
- dest.writeInt(mDeviceType);
- dest.writeInt(mVendorId);
- dest.writeString(mDisplayName);
- }
-
- @Override
- public String toString() {
- StringBuffer s = new StringBuffer();
- if (isCecDevice()) {
- s.append("CEC: ");
- s.append("logical_address: ").append(mLogicalAddress).append(", ");
- s.append("physical_address: ").append(mPhysicalAddress).append(", ");
- s.append("port_id: ").append(mPortId).append(", ");
- s.append("device_type: ").append(mDeviceType).append(", ");
- s.append("vendor_id: ").append(mVendorId).append(", ");
- s.append("display_name: ").append(mDisplayName);
- } else {
- s.append("Non-CEC: ");
- s.append("physical_address: ").append(mPhysicalAddress).append(", ");
- s.append("port_id: ").append(mPortId).append(", ");
- }
- return s.toString();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof HdmiCecDeviceInfo)) {
- return false;
- }
-
- HdmiCecDeviceInfo other = (HdmiCecDeviceInfo) obj;
- return mLogicalAddress == other.mLogicalAddress
- && mPhysicalAddress == other.mPhysicalAddress
- && mPortId == other.mPortId
- && mDeviceType == other.mDeviceType
- && mVendorId == other.mVendorId
- && mDisplayName.equals(other.mDisplayName);
- }
-}
diff --git a/core/java/android/hardware/hdmi/HdmiClient.java b/core/java/android/hardware/hdmi/HdmiClient.java
index 5d26a57..f95ed0f 100644
--- a/core/java/android/hardware/hdmi/HdmiClient.java
+++ b/core/java/android/hardware/hdmi/HdmiClient.java
@@ -28,10 +28,10 @@
/**
* Returns the active source information.
*
- * @return {@link HdmiCecDeviceInfo} object that describes the active source
+ * @return {@link HdmiDeviceInfo} object that describes the active source
* or active routing path
*/
- public HdmiCecDeviceInfo getActiveSource() {
+ public HdmiDeviceInfo getActiveSource() {
try {
return mService.getActiveSource();
} catch (RemoteException e) {
diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java
index e7bd3e4..7cfa211 100644
--- a/core/java/android/hardware/hdmi/HdmiControlManager.java
+++ b/core/java/android/hardware/hdmi/HdmiControlManager.java
@@ -228,8 +228,8 @@
// Do nothing.
}
}
- mHasTvDevice = hasDeviceType(types, HdmiCecDeviceInfo.DEVICE_TV);
- mHasPlaybackDevice = hasDeviceType(types, HdmiCecDeviceInfo.DEVICE_PLAYBACK);
+ mHasTvDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_TV);
+ mHasPlaybackDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PLAYBACK);
}
private static boolean hasDeviceType(int[] types, int type) {
@@ -249,8 +249,8 @@
*
* @param type CEC device type
* @return {@link HdmiClient} instance. {@code null} on failure.
- * @see {@link HdmiCecDeviceInfo#DEVICE_PLAYBACK}
- * @see {@link HdmiCecDeviceInfo#DEVICE_TV}
+ * See {@link HdmiDeviceInfo#DEVICE_PLAYBACK}
+ * See {@link HdmiDeviceInfo#DEVICE_TV}
*/
@Nullable
public HdmiClient getClient(int type) {
@@ -258,9 +258,9 @@
return null;
}
switch (type) {
- case HdmiCecDeviceInfo.DEVICE_TV:
+ case HdmiDeviceInfo.DEVICE_TV:
return mHasTvDevice ? new HdmiTvClient(mService) : null;
- case HdmiCecDeviceInfo.DEVICE_PLAYBACK:
+ case HdmiDeviceInfo.DEVICE_PLAYBACK:
return mHasPlaybackDevice ? new HdmiPlaybackClient(mService) : null;
default:
return null;
@@ -278,7 +278,7 @@
*/
@Nullable
public HdmiPlaybackClient getPlaybackClient() {
- return (HdmiPlaybackClient) getClient(HdmiCecDeviceInfo.DEVICE_PLAYBACK);
+ return (HdmiPlaybackClient) getClient(HdmiDeviceInfo.DEVICE_PLAYBACK);
}
/**
@@ -292,7 +292,7 @@
*/
@Nullable
public HdmiTvClient getTvClient() {
- return (HdmiTvClient) getClient(HdmiCecDeviceInfo.DEVICE_TV);
+ return (HdmiTvClient) getClient(HdmiDeviceInfo.DEVICE_TV);
}
/**
diff --git a/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.aidl b/core/java/android/hardware/hdmi/HdmiDeviceInfo.aidl
similarity index 95%
rename from core/java/android/hardware/hdmi/HdmiCecDeviceInfo.aidl
rename to core/java/android/hardware/hdmi/HdmiDeviceInfo.aidl
index 1615910..cb76dc8 100644
--- a/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.aidl
+++ b/core/java/android/hardware/hdmi/HdmiDeviceInfo.aidl
@@ -16,4 +16,4 @@
package android.hardware.hdmi;
-parcelable HdmiCecDeviceInfo;
+parcelable HdmiDeviceInfo;
diff --git a/core/java/android/hardware/hdmi/HdmiDeviceInfo.java b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
new file mode 100644
index 0000000..2391d3a
--- /dev/null
+++ b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
@@ -0,0 +1,411 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.hdmi;
+
+import android.annotation.SystemApi;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A class to encapsulate device information for HDMI devices including CEC and MHL. In terms of
+ * CEC, this container includes basic information such as logical address, physical address and
+ * device type, and additional information like vendor id and osd name. In terms of MHL device, this
+ * container includes adopter id and device type. Otherwise, it keeps the information of other type
+ * devices for which only port ID, physical address are meaningful.
+ *
+ * @hide
+ */
+@SystemApi
+public class HdmiDeviceInfo implements Parcelable {
+
+ /** TV device type. */
+ public static final int DEVICE_TV = 0;
+
+ /** Recording device type. */
+ public static final int DEVICE_RECORDER = 1;
+
+ /** Device type reserved for future usage. */
+ public static final int DEVICE_RESERVED = 2;
+
+ /** Tuner device type. */
+ public static final int DEVICE_TUNER = 3;
+
+ /** Playback device type. */
+ public static final int DEVICE_PLAYBACK = 4;
+
+ /** Audio system device type. */
+ public static final int DEVICE_AUDIO_SYSTEM = 5;
+
+ /** @hide Pure CEC switch device type. */
+ public static final int DEVICE_PURE_CEC_SWITCH = 6;
+
+ /** @hide Video processor device type. */
+ public static final int DEVICE_VIDEO_PROCESSOR = 7;
+
+ // Value indicating the device is not an active source.
+ public static final int DEVICE_INACTIVE = -1;
+
+ /**
+ * Logical address used to indicate the source comes from internal device. The logical address
+ * of TV(0) is used.
+ */
+ public static final int ADDR_INTERNAL = 0;
+
+ /**
+ * Physical address used to indicate the source comes from internal device. The physical address
+ * of TV(0) is used.
+ */
+ public static final int PATH_INTERNAL = 0x0000;
+
+ /** Invalid physical address (routing path) */
+ public static final int PATH_INVALID = 0xFFFF;
+
+ /** Invalid port ID */
+ public static final int PORT_INVALID = -1;
+
+ private static final int HDMI_DEVICE_TYPE_OTHER = 0;
+ private static final int HDMI_DEVICE_TYPE_CEC = 1;
+ private static final int HDMI_DEVICE_TYPE_MHL = 2;
+
+ // Common parameters for all device.
+ private final int mHdmiDeviceType;
+ private final int mPhysicalAddress;
+ private final int mPortId;
+
+ // CEC only parameters.
+ private final int mLogicalAddress;
+ private final int mDeviceType;
+ private final int mVendorId;
+ private final String mDisplayName;
+ private final int mDevicePowerStatus;
+
+ // MHL only parameters.
+ private final int mDeviceId;
+ private final int mAdopterId;
+
+ /**
+ * A helper class to deserialize {@link HdmiDeviceInfo} for a parcel.
+ */
+ public static final Parcelable.Creator<HdmiDeviceInfo> CREATOR =
+ new Parcelable.Creator<HdmiDeviceInfo>() {
+ @Override
+ public HdmiDeviceInfo createFromParcel(Parcel source) {
+ int hdmiDeviceType = source.readInt();
+ int physicalAddress = source.readInt();
+ int portId = source.readInt();
+
+ switch (hdmiDeviceType) {
+ case HDMI_DEVICE_TYPE_CEC:
+ int logicalAddress = source.readInt();
+ int deviceType = source.readInt();
+ int vendorId = source.readInt();
+ int powerStatus = source.readInt();
+ String displayName = source.readString();
+ return new HdmiDeviceInfo(logicalAddress, physicalAddress, portId,
+ deviceType, vendorId, displayName, powerStatus);
+ case HDMI_DEVICE_TYPE_MHL:
+ int deviceId = source.readInt();
+ int adopterId = source.readInt();
+ return new HdmiDeviceInfo(physicalAddress, portId, adopterId, deviceId);
+ case HDMI_DEVICE_TYPE_OTHER:
+ return new HdmiDeviceInfo(physicalAddress, portId);
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public HdmiDeviceInfo[] newArray(int size) {
+ return new HdmiDeviceInfo[size];
+ }
+ };
+
+ /**
+ * Constructor. Used to initialize the instance for CEC device.
+ *
+ * @param logicalAddress logical address of HDMI-CEC device
+ * @param physicalAddress physical address of HDMI-CEC device
+ * @param portId HDMI port ID (1 for HDMI1)
+ * @param deviceType type of device
+ * @param vendorId vendor id of device. Used for vendor specific command.
+ * @param displayName name of device
+ * @param powerStatus device power status
+ * @hide
+ */
+ public HdmiDeviceInfo(int logicalAddress, int physicalAddress, int portId, int deviceType,
+ int vendorId, String displayName, int powerStatus) {
+ mHdmiDeviceType = HDMI_DEVICE_TYPE_CEC;
+ mPhysicalAddress = physicalAddress;
+ mPortId = portId;
+
+ mLogicalAddress = logicalAddress;
+ mDeviceType = deviceType;
+ mVendorId = vendorId;
+ mDevicePowerStatus = powerStatus;
+ mDisplayName = displayName;
+
+ mDeviceId = -1;
+ mAdopterId = -1;
+ }
+
+ /**
+ * Constructor. Used to initialize the instance for CEC device.
+ *
+ * @param logicalAddress logical address of HDMI-CEC device
+ * @param physicalAddress physical address of HDMI-CEC device
+ * @param portId HDMI port ID (1 for HDMI1)
+ * @param deviceType type of device
+ * @param vendorId vendor id of device. Used for vendor specific command.
+ * @param displayName name of device
+ * @hide
+ */
+ public HdmiDeviceInfo(int logicalAddress, int physicalAddress, int portId, int deviceType,
+ int vendorId, String displayName) {
+ this(logicalAddress, physicalAddress, portId, deviceType,
+ vendorId, displayName, HdmiControlManager.POWER_STATUS_UNKNOWN);
+ }
+
+ /**
+ * Constructor. Used to initialize the instance for other device.
+ *
+ * @param physicalAddress physical address of HDMI device
+ * @param portId HDMI port ID (1 for HDMI1)
+ * @hide
+ */
+ public HdmiDeviceInfo(int physicalAddress, int portId) {
+ mHdmiDeviceType = HDMI_DEVICE_TYPE_OTHER;
+ mPhysicalAddress = physicalAddress;
+ mPortId = portId;
+
+ mLogicalAddress = -1;
+ mDeviceType = DEVICE_RESERVED;
+ mVendorId = 0;
+ mDevicePowerStatus = HdmiControlManager.POWER_STATUS_UNKNOWN;
+ mDisplayName = "HDMI" + portId;
+
+ mDeviceId = -1;
+ mAdopterId = -1;
+
+ }
+
+ /**
+ * Constructor. Used to initialize the instance for MHL device.
+ *
+ * @param physicalAddress physical address of HDMI device
+ * @param portId portId HDMI port ID (1 for HDMI1)
+ * @param adopterId adopter id of MHL
+ * @param deviceId device id of MHL
+ * @hide
+ */
+ public HdmiDeviceInfo(int physicalAddress, int portId, int adopterId, int deviceId) {
+ mHdmiDeviceType = HDMI_DEVICE_TYPE_MHL;
+ mPhysicalAddress = physicalAddress;
+ mPortId = portId;
+
+ mLogicalAddress = -1;
+ mDeviceType = DEVICE_RESERVED;
+ mVendorId = 0;
+ mDevicePowerStatus = HdmiControlManager.POWER_STATUS_UNKNOWN;
+ mDisplayName = "MHL";
+
+ mDeviceId = adopterId;
+ mAdopterId = deviceId;
+ }
+
+ /**
+ * Return the CEC logical address of the device.
+ */
+ public int getLogicalAddress() {
+ return mLogicalAddress;
+ }
+
+ /**
+ * Return the physical address of the device.
+ */
+ public int getPhysicalAddress() {
+ return mPhysicalAddress;
+ }
+
+ /**
+ * Return the port ID.
+ */
+ public int getPortId() {
+ return mPortId;
+ }
+
+ /**
+ * Return CEC type of the device. For more details, refer constants between {@link #DEVICE_TV}
+ * and {@link #DEVICE_INACTIVE}.
+ */
+ public int getDeviceType() {
+ return mDeviceType;
+ }
+
+ /**
+ * Return device's power status. It should be one of the following values.
+ * <ul>
+ * <li>{@link HdmiControlManager#POWER_STATUS_ON}
+ * <li>{@link HdmiControlManager#POWER_STATUS_STANDBY}
+ * <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_ON}
+ * <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_STANDBY}
+ * <li>{@link HdmiControlManager#POWER_STATUS_UNKNOWN}
+ * </ul>
+ */
+ public int getDevicePowerStatus() {
+ return mDevicePowerStatus;
+ }
+
+ /**
+ * Return MHL device id. Return -1 for non-MHL device.
+ */
+ public int getDeviceId() {
+ return mDeviceId;
+ }
+
+ /**
+ * Return MHL adopter id. Return -1 for non-MHL device.
+ */
+ public int getAdopterId() {
+ return mAdopterId;
+ }
+
+ /**
+ * Return {@code true} if the device is of a type that can be an input source.
+ */
+ public boolean isSourceType() {
+ return mDeviceType == DEVICE_PLAYBACK
+ || mDeviceType == DEVICE_RECORDER
+ || mDeviceType == DEVICE_TUNER;
+ }
+
+ /**
+ * Return {@code true} if the device represents an HDMI-CEC device. {@code false} if the device
+ * is either MHL or other device.
+ */
+ public boolean isCecDevice() {
+ return mHdmiDeviceType == HDMI_DEVICE_TYPE_CEC;
+ }
+
+ /**
+ * Return {@code true} if the device represents an MHL device. {@code false} if the device is
+ * either CEC or other device.
+ */
+ public boolean isMhlDevice() {
+ return mHdmiDeviceType == HDMI_DEVICE_TYPE_MHL;
+ }
+
+ /**
+ * Return display (OSD) name of the device.
+ */
+ public String getDisplayName() {
+ return mDisplayName;
+ }
+
+ /**
+ * Return vendor id of the device. Vendor id is used to distinguish devices built by other
+ * manufactures. This is required for vendor-specific command on CEC standard.
+ */
+ public int getVendorId() {
+ return mVendorId;
+ }
+
+ /**
+ * Describe the kinds of special objects contained in this Parcelable's marshalled
+ * representation.
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Serialize this object into a {@link Parcel}.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written. May be 0 or
+ * {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE}.
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mHdmiDeviceType);
+ dest.writeInt(mPhysicalAddress);
+ dest.writeInt(mPortId);
+ switch (mHdmiDeviceType) {
+ case HDMI_DEVICE_TYPE_CEC:
+ dest.writeInt(mLogicalAddress);
+ dest.writeInt(mDeviceType);
+ dest.writeInt(mVendorId);
+ dest.writeInt(mDevicePowerStatus);
+ dest.writeString(mDisplayName);
+ break;
+ case HDMI_DEVICE_TYPE_MHL:
+ dest.writeInt(mDeviceId);
+ dest.writeInt(mAdopterId);
+ break;
+ default:
+ // no-op
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer s = new StringBuffer();
+ switch (mHdmiDeviceType) {
+ case HDMI_DEVICE_TYPE_CEC:
+ s.append("CEC: ");
+ s.append("logical_address: ").append(mLogicalAddress).append(", ");
+ s.append("device_type: ").append(mDeviceType).append(", ");
+ s.append("vendor_id: ").append(mVendorId).append(", ");
+ s.append("display_name: ").append(mDisplayName).append(", ");
+ s.append("power_status: ").append(mDevicePowerStatus).append(", ");
+ break;
+ case HDMI_DEVICE_TYPE_MHL:
+ s.append("MHL: ");
+ break;
+
+ case HDMI_DEVICE_TYPE_OTHER:
+ s.append("Other: ");
+ s.append("device_id: ").append(mDeviceId).append(", ");
+ s.append("adopter_id: ").append(mAdopterId).append(", ");
+ break;
+ default:
+ return "";
+ }
+ s.append("physical_address: ").append(mPhysicalAddress).append(", ");
+ s.append("port_id: ").append(mPortId);
+ return s.toString();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof HdmiDeviceInfo)) {
+ return false;
+ }
+
+ HdmiDeviceInfo other = (HdmiDeviceInfo) obj;
+ return mHdmiDeviceType == other.mHdmiDeviceType
+ && mPhysicalAddress == other.mPhysicalAddress
+ && mPortId == other.mPortId
+ && mLogicalAddress == other.mLogicalAddress
+ && mDeviceType == other.mDeviceType
+ && mVendorId == other.mVendorId
+ && mDevicePowerStatus == other.mDevicePowerStatus
+ && mDisplayName.equals(other.mDisplayName)
+ && mDeviceId == other.mDeviceId
+ && mAdopterId == other.mAdopterId;
+ }
+}
diff --git a/core/java/android/hardware/hdmi/HdmiPlaybackClient.java b/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
index fbf1430..85ccb74 100644
--- a/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
+++ b/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
@@ -52,12 +52,14 @@
/**
* Called when display device status is reported.
*
- * @param status display device status
- * @see {@link HdmiControlManager#POWER_STATUS_ON}
- * @see {@link HdmiControlManager#POWER_STATUS_STANDBY}
- * @see {@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_ON}
- * @see {@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_STANDBY}
- * @see {@link HdmiControlManager#POWER_STATUS_UNKNOWN}
+ * @param status display device status. It should be one of the following values.
+ * <ul>
+ * <li>{@link HdmiControlManager#POWER_STATUS_ON}
+ * <li>{@link HdmiControlManager#POWER_STATUS_STANDBY}
+ * <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_ON}
+ * <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_STANDBY}
+ * <li>{@link HdmiControlManager#POWER_STATUS_UNKNOWN}
+ * </ul>
*/
public void onComplete(int status);
}
@@ -84,7 +86,7 @@
@Override
public int getDeviceType() {
- return HdmiCecDeviceInfo.DEVICE_PLAYBACK;
+ return HdmiDeviceInfo.DEVICE_PLAYBACK;
}
/**
diff --git a/core/java/android/hardware/hdmi/HdmiTvClient.java b/core/java/android/hardware/hdmi/HdmiTvClient.java
index 077a17e..a9040cf 100644
--- a/core/java/android/hardware/hdmi/HdmiTvClient.java
+++ b/core/java/android/hardware/hdmi/HdmiTvClient.java
@@ -96,7 +96,7 @@
@Override
public int getDeviceType() {
- return HdmiCecDeviceInfo.DEVICE_TV;
+ return HdmiDeviceInfo.DEVICE_TV;
}
/**
diff --git a/core/java/android/hardware/hdmi/IHdmiControlService.aidl b/core/java/android/hardware/hdmi/IHdmiControlService.aidl
index 920a1f4..d6cb492 100644
--- a/core/java/android/hardware/hdmi/IHdmiControlService.aidl
+++ b/core/java/android/hardware/hdmi/IHdmiControlService.aidl
@@ -16,7 +16,7 @@
package android.hardware.hdmi;
-import android.hardware.hdmi.HdmiCecDeviceInfo;
+import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.HdmiPortInfo;
import android.hardware.hdmi.IHdmiControlCallback;
import android.hardware.hdmi.IHdmiDeviceEventListener;
@@ -37,7 +37,7 @@
*/
interface IHdmiControlService {
int[] getSupportedTypes();
- HdmiCecDeviceInfo getActiveSource();
+ HdmiDeviceInfo getActiveSource();
void oneTouchPlay(IHdmiControlCallback callback);
void queryDisplayStatus(IHdmiControlCallback callback);
void addHotplugEventListener(IHdmiHotplugEventListener listener);
@@ -59,7 +59,7 @@
void setSystemAudioVolume(int oldIndex, int newIndex, int maxIndex);
void setSystemAudioMute(boolean mute);
void setInputChangeListener(IHdmiInputChangeListener listener);
- List<HdmiCecDeviceInfo> getInputDevices();
+ List<HdmiDeviceInfo> getInputDevices();
void sendVendorCommand(int deviceType, int targetAddress, in byte[] params,
boolean hasVendorId);
void addVendorCommandListener(IHdmiVendorCommandListener listener, int deviceType);
diff --git a/core/java/android/hardware/hdmi/IHdmiDeviceEventListener.aidl b/core/java/android/hardware/hdmi/IHdmiDeviceEventListener.aidl
index c4e5989..94fd14f 100644
--- a/core/java/android/hardware/hdmi/IHdmiDeviceEventListener.aidl
+++ b/core/java/android/hardware/hdmi/IHdmiDeviceEventListener.aidl
@@ -16,7 +16,7 @@
package android.hardware.hdmi;
-import android.hardware.hdmi.HdmiCecDeviceInfo;
+import android.hardware.hdmi.HdmiDeviceInfo;
/**
* Callback interface definition for HDMI client to get informed of
@@ -27,9 +27,9 @@
oneway interface IHdmiDeviceEventListener {
/**
- * @param deviceInfo {@link HdmiCecDeviceInfo} of the logical device whose
+ * @param deviceInfo {@link HdmiDeviceInfo} of the logical device whose
* status has changed
* @param activated true if the device gets activated
*/
- void onStatusChanged(in HdmiCecDeviceInfo deviceInfo, in boolean activated);
+ void onStatusChanged(in HdmiDeviceInfo deviceInfo, in boolean activated);
}
diff --git a/core/java/android/hardware/hdmi/IHdmiInputChangeListener.aidl b/core/java/android/hardware/hdmi/IHdmiInputChangeListener.aidl
index 98ad300..46a20c746 100644
--- a/core/java/android/hardware/hdmi/IHdmiInputChangeListener.aidl
+++ b/core/java/android/hardware/hdmi/IHdmiInputChangeListener.aidl
@@ -16,7 +16,7 @@
package android.hardware.hdmi;
-import android.hardware.hdmi.HdmiCecDeviceInfo;
+import android.hardware.hdmi.HdmiDeviceInfo;
/**
* Callback interface definition for TV to get informed of
@@ -25,5 +25,5 @@
* @hide
*/
oneway interface IHdmiInputChangeListener {
- void onChanged(in HdmiCecDeviceInfo device);
+ void onChanged(in HdmiDeviceInfo device);
}