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

Commit d09372ad authored by Dongwon Kang's avatar Dongwon Kang
Browse files

TIF: Add setLabel(CharSequence) in TvInputInfo.Builder

Bug: 25726241
Change-Id: I8b7cf157dffd0df2b04af0386e448b23409be1e5
parent 6c4af8c9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -24629,6 +24629,7 @@ package android.media.tv {
    method public android.media.tv.TvInputInfo.Builder setHdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo);
    method public android.media.tv.TvInputInfo.Builder setHdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo);
    method public android.media.tv.TvInputInfo.Builder setIcon(android.graphics.drawable.Icon);
    method public android.media.tv.TvInputInfo.Builder setIcon(android.graphics.drawable.Icon);
    method public android.media.tv.TvInputInfo.Builder setIcon(android.graphics.drawable.Icon, int);
    method public android.media.tv.TvInputInfo.Builder setIcon(android.graphics.drawable.Icon, int);
    method public android.media.tv.TvInputInfo.Builder setLabel(java.lang.CharSequence);
    method public android.media.tv.TvInputInfo.Builder setLabel(int);
    method public android.media.tv.TvInputInfo.Builder setLabel(int);
    method public android.media.tv.TvInputInfo.Builder setParentId(java.lang.String);
    method public android.media.tv.TvInputInfo.Builder setParentId(java.lang.String);
    method public android.media.tv.TvInputInfo.Builder setTunerCount(int);
    method public android.media.tv.TvInputInfo.Builder setTunerCount(int);
+30 −9
Original line number Original line Diff line number Diff line
@@ -116,10 +116,10 @@ public final class TvInputInfo implements Parcelable {
    private final int mType;
    private final int mType;
    private final boolean mIsHardwareInput;
    private final boolean mIsHardwareInput;


    // TODO: Remove mLabel and mIconUri when createTvInputInfo() is removed.
    // TODO: Remove mIconUri when createTvInputInfo() is removed.
    private String mLabel;
    private Uri mIconUri;
    private Uri mIconUri;


    private final CharSequence mLabel;
    private final int mLabelResId;
    private final int mLabelResId;
    private final Icon mIcon;
    private final Icon mIcon;
    private final Icon mIconStandby;
    private final Icon mIconStandby;
@@ -161,8 +161,8 @@ public final class TvInputInfo implements Parcelable {
        TvInputInfo info = new TvInputInfo.Builder(context, service)
        TvInputInfo info = new TvInputInfo.Builder(context, service)
                .setHdmiDeviceInfo(hdmiDeviceInfo)
                .setHdmiDeviceInfo(hdmiDeviceInfo)
                .setParentId(parentId)
                .setParentId(parentId)
                .setLabel(label)
                .build();
                .build();
        info.mLabel = label;
        info.mIconUri = iconUri;
        info.mIconUri = iconUri;
        return info;
        return info;
    }
    }
@@ -215,8 +215,8 @@ public final class TvInputInfo implements Parcelable {
                    throws XmlPullParserException, IOException {
                    throws XmlPullParserException, IOException {
        TvInputInfo info = new TvInputInfo.Builder(context, service)
        TvInputInfo info = new TvInputInfo.Builder(context, service)
                .setTvInputHardwareInfo(hardwareInfo)
                .setTvInputHardwareInfo(hardwareInfo)
                .setLabel(label)
                .build();
                .build();
        info.mLabel = label;
        info.mIconUri = iconUri;
        info.mIconUri = iconUri;
        return info;
        return info;
    }
    }
@@ -247,7 +247,7 @@ public final class TvInputInfo implements Parcelable {
    }
    }


    private TvInputInfo(ResolveInfo service, String id, int type, boolean isHardwareInput,
    private TvInputInfo(ResolveInfo service, String id, int type, boolean isHardwareInput,
            int labelResId, Icon icon, Icon iconStandby, Icon iconDisconnected,
            CharSequence label, int labelResId, Icon icon, Icon iconStandby, Icon iconDisconnected,
            String setupActivity, String settingsActivity, boolean canRecord, int tunerCount,
            String setupActivity, String settingsActivity, boolean canRecord, int tunerCount,
            HdmiDeviceInfo hdmiDeviceInfo, boolean isConnectedToHdmiSwitch, String parentId,
            HdmiDeviceInfo hdmiDeviceInfo, boolean isConnectedToHdmiSwitch, String parentId,
            Bundle extras) {
            Bundle extras) {
@@ -255,6 +255,7 @@ public final class TvInputInfo implements Parcelable {
        mId = id;
        mId = id;
        mType = type;
        mType = type;
        mIsHardwareInput = isHardwareInput;
        mIsHardwareInput = isHardwareInput;
        mLabel = label;
        mLabelResId = labelResId;
        mLabelResId = labelResId;
        mIcon = icon;
        mIcon = icon;
        mIconStandby = iconStandby;
        mIconStandby = iconStandby;
@@ -570,7 +571,7 @@ public final class TvInputInfo implements Parcelable {
        dest.writeString(mId);
        dest.writeString(mId);
        dest.writeInt(mType);
        dest.writeInt(mType);
        dest.writeByte(mIsHardwareInput ? (byte) 1 : 0);
        dest.writeByte(mIsHardwareInput ? (byte) 1 : 0);
        dest.writeString(mLabel);
        TextUtils.writeToParcel(mLabel, dest, flags);
        dest.writeParcelable(mIconUri, flags);
        dest.writeParcelable(mIconUri, flags);
        dest.writeInt(mLabelResId);
        dest.writeInt(mLabelResId);
        dest.writeParcelable(mIcon, flags);
        dest.writeParcelable(mIcon, flags);
@@ -612,7 +613,7 @@ public final class TvInputInfo implements Parcelable {
        mId = in.readString();
        mId = in.readString();
        mType = in.readInt();
        mType = in.readInt();
        mIsHardwareInput = in.readByte() == 1;
        mIsHardwareInput = in.readByte() == 1;
        mLabel = in.readString();
        mLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mIconUri = in.readParcelable(null);
        mIconUri = in.readParcelable(null);
        mLabelResId = in.readInt();
        mLabelResId = in.readInt();
        mIcon = in.readParcelable(null);
        mIcon = in.readParcelable(null);
@@ -660,6 +661,7 @@ public final class TvInputInfo implements Parcelable {


        private final Context mContext;
        private final Context mContext;
        private final ResolveInfo mResolveInfo;
        private final ResolveInfo mResolveInfo;
        private CharSequence mLabel;
        private int mLabelResId;
        private int mLabelResId;
        private Icon mIcon;
        private Icon mIcon;
        private Icon mIconStandby;
        private Icon mIconStandby;
@@ -743,6 +745,22 @@ public final class TvInputInfo implements Parcelable {
            return this;
            return this;
        }
        }


        /**
         * Sets the label.
         *
         * @param label The text to be used as label.
         * @return This Builder object to allow for chaining of calls to builder methods.
         * @hide
         */
        @SystemApi
        public Builder setLabel(CharSequence label) {
            if (mLabelResId != 0) {
                throw new IllegalStateException("Resource ID for label is already set.");
            }
            this.mLabel = label;
            return this;
        }

        /**
        /**
         * Sets the label.
         * Sets the label.
         *
         *
@@ -752,6 +770,9 @@ public final class TvInputInfo implements Parcelable {
         */
         */
        @SystemApi
        @SystemApi
        public Builder setLabel(int resId) {
        public Builder setLabel(int resId) {
            if (mLabel != null) {
                throw new IllegalStateException("Label text is already set.");
            }
            this.mLabelResId = resId;
            this.mLabelResId = resId;
            return this;
            return this;
        }
        }
@@ -868,8 +889,8 @@ public final class TvInputInfo implements Parcelable {
                type = TYPE_TUNER;
                type = TYPE_TUNER;
            }
            }
            parseServiceMetadata(type);
            parseServiceMetadata(type);
            return new TvInputInfo(mResolveInfo, id, type, isHardwareInput, mLabelResId, mIcon,
            return new TvInputInfo(mResolveInfo, id, type, isHardwareInput, mLabel, mLabelResId,
                    mIconStandby, mIconDisconnected, mSetupActivity, mSettingsActivity,
                    mIcon, mIconStandby, mIconDisconnected, mSetupActivity, mSettingsActivity,
                    mCanRecord == null ? false : mCanRecord, mTunerCount == null ? 0 : mTunerCount,
                    mCanRecord == null ? false : mCanRecord, mTunerCount == null ? 0 : mTunerCount,
                    mHdmiDeviceInfo, isConnectedToHdmiSwitch, mParentId, mExtras);
                    mHdmiDeviceInfo, isConnectedToHdmiSwitch, mParentId, mExtras);
        }
        }