Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66bdf247 authored by Ji-Hwan Lee's avatar Ji-Hwan Lee
Browse files

TIF: Add TvInputInfo.getParentId

Bug: 16166859
Change-Id: I07130b6f974ca7b2527aba68b92dc31fb4b5a139
parent 2883ba69
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -16548,6 +16548,7 @@ package android.media.tv {
    method public java.lang.String getId();
    method public java.lang.String getId();
    method public android.content.Intent getIntentForSettingsActivity();
    method public android.content.Intent getIntentForSettingsActivity();
    method public android.content.Intent getIntentForSetupActivity();
    method public android.content.Intent getIntentForSetupActivity();
    method public java.lang.String getParentId();
    method public android.content.pm.ServiceInfo getServiceInfo();
    method public android.content.pm.ServiceInfo getServiceInfo();
    method public int getType();
    method public int getType();
    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+27 −5
Original line number Original line Diff line number Diff line
@@ -76,6 +76,7 @@ public final class TvInputInfo implements Parcelable {


    private final ResolveInfo mService;
    private final ResolveInfo mService;
    private final String mId;
    private final String mId;
    private final String mParentId;


    // Attributes from XML meta data.
    // Attributes from XML meta data.
    private String mSetupActivity;
    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);
                        "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,
            TypedArray sa = res.obtainAttributes(attrs,
                    com.android.internal.R.styleable.TvInputService);
                    com.android.internal.R.styleable.TvInputService);
            input.mSetupActivity = sa.getString(
            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.
     * @param service The ResolveInfo returned from the package manager about this TV input service.
     * @hide
     * @hide
     */
     */
    private TvInputInfo(Context context, ResolveInfo service) {
    private TvInputInfo(Context context, ResolveInfo service, String parentId) {
        mService = service;
        mService = service;
        ServiceInfo si = service.serviceInfo;
        ServiceInfo si = service.serviceInfo;
        mId = generateInputIdForComponentName(new ComponentName(si.packageName, si.name));
        mId = generateInputIdForComponentName(new ComponentName(si.packageName, si.name));
        mParentId = parentId;
    }
    }


    /**
    /**
@@ -168,6 +170,24 @@ public final class TvInputInfo implements Parcelable {
        return mId;
        return mId;
    }
    }


    /**
     * 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.
     * Returns the information of the service that implements this TV input.
     */
     */
@@ -260,9 +280,7 @@ public final class TvInputInfo implements Parcelable {
        }
        }


        TvInputInfo obj = (TvInputInfo) o;
        TvInputInfo obj = (TvInputInfo) o;
        return mId.equals(obj.mId)
        return mId.equals(obj.mId);
                && mService.serviceInfo.packageName.equals(obj.mService.serviceInfo.packageName)
                && mService.serviceInfo.name.equals(obj.mService.serviceInfo.name);
    }
    }


    @Override
    @Override
@@ -281,9 +299,11 @@ public final class TvInputInfo implements Parcelable {
    @Override
    @Override
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mId);
        dest.writeString(mId);
        dest.writeString(mParentId);
        mService.writeToParcel(dest, flags);
        mService.writeToParcel(dest, flags);
        dest.writeString(mSetupActivity);
        dest.writeString(mSetupActivity);
        dest.writeString(mSettingsActivity);
        dest.writeString(mSettingsActivity);
        dest.writeInt(mType);
    }
    }


    /**
    /**
@@ -317,8 +337,10 @@ public final class TvInputInfo implements Parcelable {


    private TvInputInfo(Parcel in) {
    private TvInputInfo(Parcel in) {
        mId = in.readString();
        mId = in.readString();
        mParentId = in.readString();
        mService = ResolveInfo.CREATOR.createFromParcel(in);
        mService = ResolveInfo.CREATOR.createFromParcel(in);
        mSetupActivity = in.readString();
        mSetupActivity = in.readString();
        mSettingsActivity = in.readString();
        mSettingsActivity = in.readString();
        mType = in.readInt();
    }
    }
}
}