summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorJinsuk Kim <jinsukkim@google.com>2015-01-19 12:39:06 +0900
committerJinsuk Kim <jinsukkim@google.com>2015-01-22 16:58:26 +0900
commitcb8661c08f4a7b00eaa2ede06a30c32dd3cbc53b (patch)
tree1a2d299342ee1e8ad3101ba9e544f447d956ff7b /core/java/android
parentb74155cf01f959fc9b7909de5a22806ad519f7c9 (diff)
CEC: Add logic to return to internal source
This CL introduces a logic that, upon receiving <Inactive Source> from the active source or a corresponding MHL subcommand, lets the service return to one of internal inputs. Introduced to handle it is a new type for HdmiDevice (INACTIVE) that will be passed to input change listeners. The callback is expected to transform to other mechanism such as intent, to let TV app to decide which input to switch to, which will be one of non-HDMI input that was viewed previously. Bug: 19008579 Change-Id: I1922f4cd20e9220411061bb9d9fbe5fbc5676d48
Diffstat (limited to 'core/java/android')
-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 c4c7f2d77a8a..48ea9a63e2d6 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 "";
}