summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorJae Seo <jaeseo@google.com>2014-07-17 17:04:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-17 16:16:48 +0000
commit874f95ca73bc3cf594663886c67f09ead1e5e7a0 (patch)
tree3c1ef0fab6081d76a4a0a00d75ff1014ee4c69fb /media/java
parentf05b231485fdbf4deedd22aecc51d9b0a9550e47 (diff)
parent66bdf247df7b53130a01efe33419e0ce276e5f43 (diff)
downloadframeworks_base-874f95ca73bc3cf594663886c67f09ead1e5e7a0.zip
frameworks_base-874f95ca73bc3cf594663886c67f09ead1e5e7a0.tar.gz
frameworks_base-874f95ca73bc3cf594663886c67f09ead1e5e7a0.tar.bz2
Merge "TIF: Add TvInputInfo.getParentId" into lmp-dev
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/tv/TvInputInfo.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java
index 3dc9ffb..37f166b 100644
--- a/media/java/android/media/tv/TvInputInfo.java
+++ b/media/java/android/media/tv/TvInputInfo.java
@@ -76,6 +76,7 @@ public final class TvInputInfo implements Parcelable {
private final ResolveInfo mService;
private final String mId;
+ private final String mParentId;
// Attributes from XML meta data.
private String mSetupActivity;
@@ -114,7 +115,7 @@ public final class TvInputInfo implements Parcelable {
"Meta-data does not start with tv-input-service tag in " + si.name);
}
- TvInputInfo input = new TvInputInfo(context, service);
+ TvInputInfo input = new TvInputInfo(context, service, null);
TypedArray sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.TvInputService);
input.mSetupActivity = sa.getString(
@@ -154,10 +155,11 @@ public final class TvInputInfo implements Parcelable {
* @param service The ResolveInfo returned from the package manager about this TV input service.
* @hide
*/
- private TvInputInfo(Context context, ResolveInfo service) {
+ private TvInputInfo(Context context, ResolveInfo service, String parentId) {
mService = service;
ServiceInfo si = service.serviceInfo;
mId = generateInputIdForComponentName(new ComponentName(si.packageName, si.name));
+ mParentId = parentId;
}
/**
@@ -169,6 +171,24 @@ public final class TvInputInfo implements Parcelable {
}
/**
+ * Returns the parent input ID.
+ * <p>
+ * When a part of the functionalities of a TV input is actually provided by another TV input,
+ * we can describe this relationship as the depending input having a "parent". It is primarily
+ * used for controlling underlying hardware when the current input itself does not have direct
+ * access to it. Examples include a TV input for a specific HDMI CEC logical device having a
+ * generic HDMI input as its parent and a HDMI-paired virtual input whose video stream comes
+ * from an external settop box. Applications may group inputs by parent ID to provide an easier
+ * access to similar inputs.
+ *
+ * @return the ID of the parent input, if exists. Returns {@code null} if the parent input is
+ * not specified.
+ */
+ public String getParentId() {
+ return mParentId;
+ }
+
+ /**
* Returns the information of the service that implements this TV input.
*/
public ServiceInfo getServiceInfo() {
@@ -260,9 +280,7 @@ public final class TvInputInfo implements Parcelable {
}
TvInputInfo obj = (TvInputInfo) o;
- return mId.equals(obj.mId)
- && mService.serviceInfo.packageName.equals(obj.mService.serviceInfo.packageName)
- && mService.serviceInfo.name.equals(obj.mService.serviceInfo.name);
+ return mId.equals(obj.mId);
}
@Override
@@ -281,9 +299,11 @@ public final class TvInputInfo implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mId);
+ dest.writeString(mParentId);
mService.writeToParcel(dest, flags);
dest.writeString(mSetupActivity);
dest.writeString(mSettingsActivity);
+ dest.writeInt(mType);
}
/**
@@ -317,8 +337,10 @@ public final class TvInputInfo implements Parcelable {
private TvInputInfo(Parcel in) {
mId = in.readString();
+ mParentId = in.readString();
mService = ResolveInfo.CREATOR.createFromParcel(in);
mSetupActivity = in.readString();
mSettingsActivity = in.readString();
+ mType = in.readInt();
}
}