summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorJinsuk Kim <jinsukkim@google.com>2015-01-23 06:51:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-01-23 06:51:58 +0000
commit76cf035513d843c66d2fafe85b6a37c4c19b9223 (patch)
tree4675ebbda7b1ccc66bb6f145ea2d902e51b89e05 /core/java
parent78d51c2292b5a3b56be1b1e92bc67b70f4eebce4 (diff)
parentcb8661c08f4a7b00eaa2ede06a30c32dd3cbc53b (diff)
downloadframeworks_base-76cf035513d843c66d2fafe85b6a37c4c19b9223.zip
frameworks_base-76cf035513d843c66d2fafe85b6a37c4c19b9223.tar.gz
frameworks_base-76cf035513d843c66d2fafe85b6a37c4c19b9223.tar.bz2
Merge "CEC: Add logic to return to internal source" into lmp-mr1-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/hardware/hdmi/HdmiDeviceInfo.java47
1 files changed, 46 insertions, 1 deletions
diff --git a/core/java/android/hardware/hdmi/HdmiDeviceInfo.java b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
index c4c7f2d..48ea9a6 100644
--- a/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
+++ b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
@@ -77,10 +77,19 @@ public class HdmiDeviceInfo implements Parcelable {
/** Invalid port ID */
public static final int PORT_INVALID = -1;
+ /** Invalid device ID */
+ public static final int ID_INVALID = 0xFFFF;
+
+ /** Device info used to indicate an inactivated device. */
+ public static final HdmiDeviceInfo INACTIVE_DEVICE = new HdmiDeviceInfo();
+
private static final int HDMI_DEVICE_TYPE_CEC = 0;
private static final int HDMI_DEVICE_TYPE_MHL = 1;
private static final int HDMI_DEVICE_TYPE_HARDWARE = 2;
+ // Type used to indicate the device that has relinquished its active source status.
+ private static final int HDMI_DEVICE_TYPE_INACTIVE = 100;
+
// Offset used for id value. MHL devices, for instance, will be assigned the value from
// ID_OFFSET_MHL.
private static final int ID_OFFSET_CEC = 0x0;
@@ -130,6 +139,8 @@ public class HdmiDeviceInfo implements Parcelable {
return new HdmiDeviceInfo(physicalAddress, portId, adopterId, deviceId);
case HDMI_DEVICE_TYPE_HARDWARE:
return new HdmiDeviceInfo(physicalAddress, portId);
+ case HDMI_DEVICE_TYPE_INACTIVE:
+ return HdmiDeviceInfo.INACTIVE_DEVICE;
default:
return null;
}
@@ -208,7 +219,6 @@ public class HdmiDeviceInfo implements Parcelable {
mDeviceId = -1;
mAdopterId = -1;
-
}
/**
@@ -237,6 +247,28 @@ public class HdmiDeviceInfo implements Parcelable {
}
/**
+ * Constructor. Used to initialize the instance representing an inactivated device.
+ * Can be passed input change listener to indicate the active source yielded
+ * its status, hence the listener should take an appropriate action such as
+ * switching to other input.
+ */
+ public HdmiDeviceInfo() {
+ mHdmiDeviceType = HDMI_DEVICE_TYPE_INACTIVE;
+ mPhysicalAddress = PATH_INVALID;
+ mId = ID_INVALID;
+
+ mLogicalAddress = -1;
+ mDeviceType = DEVICE_INACTIVE;
+ mPortId = PORT_INVALID;
+ mDevicePowerStatus = HdmiControlManager.POWER_STATUS_UNKNOWN;
+ mDisplayName = "Inactive";
+ mVendorId = 0;
+
+ mDeviceId = -1;
+ mAdopterId = -1;
+ }
+
+ /**
* Returns the id of the device.
*/
public int getId() {
@@ -364,6 +396,14 @@ public class HdmiDeviceInfo implements Parcelable {
}
/**
+ * Return {@code true} if the device represents an inactivated device that relinquishes
+ * its status as active source by &lt;Active Source&gt; (HDMI-CEC) or Content-off (MHL).
+ */
+ public boolean isInactivated() {
+ return mHdmiDeviceType == HDMI_DEVICE_TYPE_INACTIVE;
+ }
+
+ /**
* Returns display (OSD) name of the device.
*/
public String getDisplayName() {
@@ -411,6 +451,8 @@ public class HdmiDeviceInfo implements Parcelable {
dest.writeInt(mDeviceId);
dest.writeInt(mAdopterId);
break;
+ case HDMI_DEVICE_TYPE_INACTIVE:
+ // flow through
default:
// no-op
}
@@ -438,6 +480,9 @@ public class HdmiDeviceInfo implements Parcelable {
case HDMI_DEVICE_TYPE_HARDWARE:
s.append("Hardware: ");
break;
+ case HDMI_DEVICE_TYPE_INACTIVE:
+ s.append("Inactivated: ");
+ break;
default:
return "";
}