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

Commit 3a54f98a authored by Shubang Lu's avatar Shubang Lu Committed by Android (Google) Code Review
Browse files

Merge "[TIAF] Time shift APIs"

parents 32c59e9c a99455d1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ oneway interface ITvInteractiveAppClient {
    void onTeletextAppStateChanged(int state, int seq);
    void onAdBuffer(in AdBuffer buffer, int seq);
    void onCommandRequest(in String cmdType, in Bundle parameters, int seq);
    void onTimeShiftCommandRequest(in String cmdType, in Bundle parameters, int seq);
    void onSetVideoBounds(in Rect rect, int seq);
    void onRequestCurrentChannelUri(int seq);
    void onRequestCurrentChannelLcn(int seq);
+9 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.media.tv.interactive.AppLinkInfo;
import android.media.tv.interactive.ITvInteractiveAppClient;
import android.media.tv.interactive.ITvInteractiveAppManagerCallback;
import android.media.tv.interactive.TvInteractiveAppServiceInfo;
import android.media.PlaybackParams;
import android.net.Uri;
import android.os.Bundle;
import android.view.Surface;
@@ -57,6 +58,14 @@ interface ITvInteractiveAppManager {
    void sendTvRecordingInfoList(in IBinder sessionToken,
            in List<TvRecordingInfo> recordingInfoList, int userId);
    void notifyError(in IBinder sessionToken, in String errMsg, in Bundle params, int userId);
    void notifyTimeShiftPlaybackParams(
            in IBinder sessionToken, in PlaybackParams params, int userId);
    void notifyTimeShiftStatusChanged(
            in IBinder sessionToken, in String inputId, int status, int userId);
    void notifyTimeShiftStartPositionChanged(
            in IBinder sessionToken, in String inputId, long timeMs, int userId);
    void notifyTimeShiftCurrentPositionChanged(
            in IBinder sessionToken, in String inputId, long timeMs, int userId);
    void createSession(in ITvInteractiveAppClient client, in String iAppServiceId, int type,
            int seq, int userId);
    void releaseSession(in IBinder sessionToken, int userId);
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Rect;
import android.media.tv.BroadcastInfoResponse;
import android.net.Uri;
import android.media.tv.AdBuffer;
import android.media.PlaybackParams;
import android.media.tv.AdResponse;
import android.media.tv.BroadcastInfoResponse;
import android.media.tv.TvTrackInfo;
@@ -48,6 +49,10 @@ oneway interface ITvInteractiveAppSession {
    void sendTvRecordingInfo(in TvRecordingInfo recordingInfo);
    void sendTvRecordingInfoList(in List<TvRecordingInfo> recordingInfoList);
    void notifyError(in String errMsg, in Bundle params);
    void notifyTimeShiftPlaybackParams(in PlaybackParams params);
    void notifyTimeShiftStatusChanged(in String inputId, int status);
    void notifyTimeShiftStartPositionChanged(in String inputId, long timeMs);
    void notifyTimeShiftCurrentPositionChanged(in String inputId, long timeMs);
    void release();
    void notifyTuned(in Uri channelUri);
    void notifyTrackSelected(int type, in String trackId);
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ oneway interface ITvInteractiveAppSessionCallback {
    void onTeletextAppStateChanged(int state);
    void onAdBuffer(in AdBuffer buffer);
    void onCommandRequest(in String cmdType, in Bundle parameters);
    void onTimeShiftCommandRequest(in String cmdType, in Bundle parameters);
    void onSetVideoBounds(in Rect rect);
    void onRequestCurrentChannelUri();
    void onRequestCurrentChannelLcn();
+53 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Rect;
import android.media.PlaybackParams;
import android.media.tv.AdBuffer;
import android.media.tv.AdResponse;
import android.media.tv.BroadcastInfoResponse;
@@ -89,6 +90,10 @@ public class ITvInteractiveAppSessionWrapper
    private static final int DO_NOTIFY_TV_MESSAGE = 33;
    private static final int DO_SEND_RECORDING_INFO = 34;
    private static final int DO_SEND_RECORDING_INFO_LIST = 35;
    private static final int DO_NOTIFY_TIME_SHIFT_PLAYBACK_PARAMS = 36;
    private static final int DO_NOTIFY_TIME_SHIFT_STATUS_CHANGED = 37;
    private static final int DO_NOTIFY_TIME_SHIFT_START_POSITION_CHANGED = 38;
    private static final int DO_NOTIFY_TIME_SHIFT_CURRENT_POSITION_CHANGED = 39;

    private final HandlerCaller mCaller;
    private Session mSessionImpl;
@@ -277,6 +282,30 @@ public class ITvInteractiveAppSessionWrapper
                mSessionImpl.notifyAdBufferConsumed((AdBuffer) msg.obj);
                break;
            }
            case DO_NOTIFY_TIME_SHIFT_PLAYBACK_PARAMS: {
                mSessionImpl.notifyTimeShiftPlaybackParams((PlaybackParams) msg.obj);
                break;
            }
            case DO_NOTIFY_TIME_SHIFT_STATUS_CHANGED: {
                SomeArgs args = (SomeArgs) msg.obj;
                mSessionImpl.notifyTimeShiftStatusChanged((String) args.arg1, (Integer) args.arg2);
                args.recycle();
                break;
            }
            case DO_NOTIFY_TIME_SHIFT_START_POSITION_CHANGED: {
                SomeArgs args = (SomeArgs) msg.obj;
                mSessionImpl.notifyTimeShiftStartPositionChanged(
                        (String) args.arg1, (Long) args.arg2);
                args.recycle();
                break;
            }
            case DO_NOTIFY_TIME_SHIFT_CURRENT_POSITION_CHANGED: {
                SomeArgs args = (SomeArgs) msg.obj;
                mSessionImpl.notifyTimeShiftCurrentPositionChanged(
                        (String) args.arg1, (Long) args.arg2);
                args.recycle();
                break;
            }
            default: {
                Log.w(TAG, "Unhandled message code: " + msg.what);
                break;
@@ -379,6 +408,30 @@ public class ITvInteractiveAppSessionWrapper
                mCaller.obtainMessageOO(DO_NOTIFY_ERROR, errMsg, params));
    }

    @Override
    public void notifyTimeShiftPlaybackParams(@NonNull PlaybackParams params) {
        mCaller.executeOrSendMessage(
                mCaller.obtainMessageO(DO_NOTIFY_TIME_SHIFT_PLAYBACK_PARAMS, params));
    }

    @Override
    public void notifyTimeShiftStatusChanged(@NonNull String inputId, int status) {
        mCaller.executeOrSendMessage(
                mCaller.obtainMessageOO(DO_NOTIFY_TIME_SHIFT_STATUS_CHANGED, inputId, status));
    }

    @Override
    public void notifyTimeShiftStartPositionChanged(@NonNull String inputId, long timeMs) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageOO(
                DO_NOTIFY_TIME_SHIFT_START_POSITION_CHANGED, inputId, timeMs));
    }

    @Override
    public void notifyTimeShiftCurrentPositionChanged(@NonNull String inputId, long timeMs) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageOO(
                DO_NOTIFY_TIME_SHIFT_CURRENT_POSITION_CHANGED, inputId, timeMs));
    }

    @Override
    public void release() {
        mSessionImpl.scheduleMediaViewCleanup();
Loading