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

Commit 11732d78 authored by shubang's avatar shubang
Browse files

Rename TvChannelInfo to TunedInfo

Bug: 163350497
Test: atest mmm
Change-Id: I1365a393547049fd17647f99a00d93987ea6f96b
parent 01d12e08
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import android.media.tv.ITvInputClient;
import android.media.tv.ITvInputHardware;
import android.media.tv.ITvInputHardwareCallback;
import android.media.tv.ITvInputManagerCallback;
import android.media.tv.TvChannelInfo;
import android.media.tv.TunedInfo;
import android.media.tv.TvContentRatingSystemInfo;
import android.media.tv.TvInputHardwareInfo;
import android.media.tv.TvInputInfo;
@@ -89,7 +89,7 @@ interface ITvInputManager {
    void timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId);
    void timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId);

    List<TvChannelInfo> getCurrentTvChannelInfos(int userId);
    List<TunedInfo> getCurrentTunedInfos(int userId);

    // For the recording session
    void startRecording(in IBinder sessionToken, in Uri programUri, in Bundle params, int userId);
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package android.media.tv;

import android.media.tv.TvChannelInfo;
import android.media.tv.TunedInfo;
import android.media.tv.TvInputInfo;

/**
@@ -29,5 +29,5 @@ oneway interface ITvInputManagerCallback {
    void onInputUpdated(in String inputId);
    void onInputStateChanged(in String inputId, int state);
    void onTvInputInfoUpdated(in TvInputInfo TvInputInfo);
    void onCurrentTvChannelInfosUpdated(in List<TvChannelInfo> currentTvChannelInfos);
    void onCurrentTunedInfosUpdated(in List<TunedInfo> currentTunedInfos);
}
+1 −1
Original line number Diff line number Diff line
@@ -16,4 +16,4 @@

package android.media.tv;

parcelable TvChannelInfo;
parcelable TunedInfo;
+15 −14
Original line number Diff line number Diff line
@@ -31,11 +31,12 @@ import java.util.Objects;


/**
 * This class is used to specify information of a TV channel.
 * Contains information about a {@link TvInputService.Session} that is currently tuned to a channel
 * or pass-through input.
 * @hide
 */
public final class TvChannelInfo implements Parcelable {
    static final String TAG = "TvChannelInfo";
public final class TunedInfo implements Parcelable {
    static final String TAG = "TunedInfo";

    /**
     * App tag for {@link #getAppTag()}: the corresponding application of the channel is the same as
@@ -67,21 +68,21 @@ public final class TvChannelInfo implements Parcelable {
    @Retention(RetentionPolicy.SOURCE)
    public @interface AppType {}

    public static final @NonNull Parcelable.Creator<TvChannelInfo> CREATOR =
            new Parcelable.Creator<TvChannelInfo>() {
    public static final @NonNull Parcelable.Creator<TunedInfo> CREATOR =
            new Parcelable.Creator<TunedInfo>() {
                @Override
                public TvChannelInfo createFromParcel(Parcel source) {
                public TunedInfo createFromParcel(Parcel source) {
                    try {
                        return new TvChannelInfo(source);
                        return new TunedInfo(source);
                    } catch (Exception e) {
                        Log.e(TAG, "Exception creating TvChannelInfo from parcel", e);
                        Log.e(TAG, "Exception creating TunedInfo from parcel", e);
                        return null;
                    }
                }

                @Override
                public TvChannelInfo[] newArray(int size) {
                    return new TvChannelInfo[size];
                public TunedInfo[] newArray(int size) {
                    return new TunedInfo[size];
                }
            };

@@ -94,7 +95,7 @@ public final class TvChannelInfo implements Parcelable {
    private final int mAppTag;

    /** @hide */
    public TvChannelInfo(
    public TunedInfo(
            String inputId, @Nullable Uri channelUri, boolean isRecordingSession,
            boolean isForeground, @AppType int appType, int appTag) {
        mInputId = inputId;
@@ -106,7 +107,7 @@ public final class TvChannelInfo implements Parcelable {
    }


    private TvChannelInfo(Parcel source) {
    private TunedInfo(Parcel source) {
        mInputId = source.readString();
        String uriString = source.readString();
        mChannelUri = uriString == null ? null : Uri.parse(uriString);
@@ -194,11 +195,11 @@ public final class TvChannelInfo implements Parcelable {

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof TvChannelInfo)) {
        if (!(o instanceof TunedInfo)) {
            return false;
        }

        TvChannelInfo other = (TvChannelInfo) o;
        TunedInfo other = (TunedInfo) o;

        return TextUtils.equals(mInputId, other.getInputId())
                && Objects.equals(mChannelUri, other.mChannelUri)
+13 −13
Original line number Diff line number Diff line
@@ -901,12 +901,13 @@ public final class TvInputManager {
        }

        /**
         * This is called when the information about current TV channels has been updated.
         * This is called when the information about current tuned information has been updated.
         *
         * @param tvChannelInfos a list of {@link TvChannelInfo} objects of new current channels.
         * @param tunedInfos a list of {@link TunedInfo} objects of new tuned information.
         * @hide
         */
        public void onCurrentTvChannelInfosUpdated(@NonNull List<TvChannelInfo> tvChannelInfos) {
        public void onCurrentTunedInfosUpdated(
                @NonNull List<TunedInfo> tunedInfos) {
        }
    }

@@ -968,12 +969,11 @@ public final class TvInputManager {
            });
        }

        public void postCurrentTvChannelInfosUpdated(
                final List<TvChannelInfo> currentTvChannelInfos) {
        public void onCurrentTunedInfosUpdated(final List<TunedInfo> currentTunedInfos) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mCallback.onCurrentTvChannelInfosUpdated(currentTvChannelInfos);
                    mCallback.onCurrentTunedInfosUpdated(currentTunedInfos);
                }
            });
        }
@@ -1283,10 +1283,10 @@ public final class TvInputManager {
            }

            @Override
            public void onCurrentTvChannelInfosUpdated(List<TvChannelInfo> currentTvChannelInfos) {
            public void onCurrentTunedInfosUpdated(List<TunedInfo> currentTunedInfos) {
                synchronized (mLock) {
                    for (TvInputCallbackRecord record : mCallbackRecords) {
                        record.postCurrentTvChannelInfosUpdated(currentTvChannelInfos);
                        record.onCurrentTunedInfosUpdated(currentTunedInfos);
                    }
                }
            }
@@ -1981,18 +1981,18 @@ public final class TvInputManager {
    }

    /**
     * Returns the list of TV channel information for {@link TvInputService.Session} that are
     * Returns the list of session information for {@link TvInputService.Session} that are
     * currently in use.
     * <p> Permission com.android.providers.tv.permission.ACCESS_WATCHED_PROGRAMS is required to get
     * the channel URIs. If the permission is not granted, {@link TvChannelInfo#getChannelUri()}
     * returns {@code null}.
     * the channel URIs. If the permission is not granted,
     * {@link TunedInfo#getChannelUri()} returns {@code null}.
     * @hide
     */
    @RequiresPermission("com.android.providers.tv.permission.ACCESS_WATCHED_PROGRAMS")
    @NonNull
    public List<TvChannelInfo> getCurrentTvChannelInfos() {
    public List<TunedInfo> getCurrentTunedInfos() {
        try {
            return mService.getCurrentTvChannelInfos(mUserId);
            return mService.getCurrentTunedInfos(mUserId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
Loading