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

Commit 3d254be3 authored by David Zhao's avatar David Zhao Committed by Android (Google) Code Review
Browse files

Merge "Add requestStopRecording APIs"

parents d7f2ef4b 08953f55
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ oneway interface ITvInteractiveAppClient {
    void onRequestTrackInfoList(int seq);
    void onRequestTrackInfoList(int seq);
    void onRequestCurrentTvInputId(int seq);
    void onRequestCurrentTvInputId(int seq);
    void onRequestStartRecording(in Uri programUri, int seq);
    void onRequestStartRecording(in Uri programUri, int seq);
    void onRequestStopRecording(in String recordingId, int seq);
    void onRequestSigning(
    void onRequestSigning(
            in String id, in String algorithm, in String alias, in byte[] data, int seq);
            in String id, in String algorithm, in String alias, in byte[] data, int seq);
    void onAdRequest(in AdRequest request, int Seq);
    void onAdRequest(in AdRequest request, int Seq);
+1 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@ oneway interface ITvInteractiveAppSessionCallback {
    void onRequestTrackInfoList();
    void onRequestTrackInfoList();
    void onRequestCurrentTvInputId();
    void onRequestCurrentTvInputId();
    void onRequestStartRecording(in Uri programUri);
    void onRequestStartRecording(in Uri programUri);
    void onRequestStopRecording(in String recordingId);
    void onRequestSigning(in String id, in String algorithm, in String alias, in byte[] data);
    void onRequestSigning(in String id, in String algorithm, in String alias, in byte[] data);
    void onAdRequest(in AdRequest request);
    void onAdRequest(in AdRequest request);
}
}
+32 −0
Original line number Original line Diff line number Diff line
@@ -498,6 +498,18 @@ public final class TvInteractiveAppManager {
                }
                }
            }
            }


            @Override
            public void onRequestStopRecording(String recordingId, int seq) {
                synchronized (mSessionCallbackRecordMap) {
                    SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq);
                    if (record == null) {
                        Log.e(TAG, "Callback not found for seq " + seq);
                        return;
                    }
                    record.postRequestStopRecording(recordingId);
                }
            }

            @Override
            @Override
            public void onRequestSigning(
            public void onRequestSigning(
                    String id, String algorithm, String alias, byte[] data, int seq) {
                    String id, String algorithm, String alias, byte[] data, int seq) {
@@ -1729,6 +1741,15 @@ public final class TvInteractiveAppManager {
            });
            });
        }
        }


        void postRequestStopRecording(String recordingId) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mSessionCallback.onRequestStopRecording(mSession, recordingId);
                }
            });
        }

        void postRequestSigning(String id, String algorithm, String alias, byte[] data) {
        void postRequestSigning(String id, String algorithm, String alias, byte[] data) {
            mHandler.post(new Runnable() {
            mHandler.post(new Runnable() {
                @Override
                @Override
@@ -1884,10 +1905,21 @@ public final class TvInteractiveAppManager {
         * called.
         * called.
         *
         *
         * @param session A {@link TvInteractiveAppService.Session} associated with this callback.
         * @param session A {@link TvInteractiveAppService.Session} associated with this callback.
         * @param programUri The Uri of the program to be recorded.
         */
         */
        public void onRequestStartRecording(Session session, Uri programUri) {
        public void onRequestStartRecording(Session session, Uri programUri) {
        }
        }


        /**
         * This is called when {@link TvInteractiveAppService.Session#RequestStopRecording} is
         * called.
         *
         * @param session A {@link TvInteractiveAppService.Session} associated with this callback.
         * @param recordingId The recordingId of the recording to be stopped.
         */
        public void onRequestStopRecording(Session session, String recordingId) {
        }

        /**
        /**
         * This is called when
         * This is called when
         * {@link TvInteractiveAppService.Session#requestSigning(String, String, String, byte[])} is
         * {@link TvInteractiveAppService.Session#requestSigning(String, String, String, byte[])} is
+27 −0
Original line number Original line Diff line number Diff line
@@ -941,6 +941,33 @@ public abstract class TvInteractiveAppService extends Service {
            });
            });
        }
        }


        /**
         * Requests starting of recording
         *
         * <p> This is used to request the active {@link android.media.tv.TvRecordingClient} to
         * call {@link android.media.tv.TvRecordingClient#stopRecording()}.
         * @see android.media.tv.TvRecordingClient#stopRecording()
         *
         * @hide
         */
        @CallSuper
        public void requestStopRecording(@NonNull String recordingId) {
            executeOrPostRunnableOnMainThread(() -> {
                try {
                    if (DEBUG) {
                        Log.d(TAG, "requestStopRecording");
                    }
                    if (mSessionCallback != null) {
                        mSessionCallback.onRequestStopRecording(recordingId);
                    }
                } catch (RemoteException e) {
                    Log.w(TAG, "error in requestStopRecording", e);
                }
            });
        }



        /**
        /**
         * Requests signing of the given data.
         * Requests signing of the given data.
         *
         *
+27 −0
Original line number Original line Diff line number Diff line
@@ -866,6 +866,19 @@ public class TvInteractiveAppView extends ViewGroup {
                @Nullable Uri programUri) {
                @Nullable Uri programUri) {
        }
        }


        /**
         * This is called when {@link TvInteractiveAppService.Session#requestStopRecording()}
         * is called.
         *
         * @param iAppServiceId The ID of the TV interactive app service bound to this view.
         * @param recordingId The ID of the recording to stop.
         * @hide
         */
        public void onRequestStopRecording(
                @NonNull String iAppServiceId,
                @NonNull String recordingId) {
        }

        /**
        /**
         * This is called when
         * This is called when
         * {@link TvInteractiveAppService.Session#requestSigning(String, String, String, byte[])} is
         * {@link TvInteractiveAppService.Session#requestSigning(String, String, String, byte[])} is
@@ -1203,6 +1216,20 @@ public class TvInteractiveAppView extends ViewGroup {
            }
            }
        }
        }


        @Override
        public void onRequestStopRecording(Session session, String recordingId) {
            if (DEBUG) {
                Log.d(TAG, "onRequestStopRecording");
            }
            if (this != mSessionCallback) {
                Log.w(TAG, "onRequestStopRecording - session not created");
                return;
            }
            if (mCallback != null) {
                mCallback.onRequestStopRecording(mIAppServiceId, recordingId);
            }
        }

        @Override
        @Override
        public void onRequestSigning(
        public void onRequestSigning(
                Session session, String id, String algorithm, String alias, byte[] data) {
                Session session, String id, String algorithm, String alias, byte[] data) {
Loading