From a496ccded68d858a7f86de9474a85c291c821a02 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 19 Jan 2023 18:05:33 -0800 Subject: [PATCH] Unhide setTvRecordingInfo Bug: 261648703 Test: atest android.media.tv.interactive Change-Id: Ib9e286a59615b1ec6677ae834ddc21fc2802fbad --- core/api/current.txt | 2 ++ .../interactive/TvInteractiveAppService.java | 10 ++++--- .../tv/interactive/TvInteractiveAppView.java | 29 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 6e909bd7717c9..d5f0e3637a262 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -27406,6 +27406,7 @@ package android.media.tv.interactive { method @CallSuper public void requestTrackInfoList(); method @CallSuper public void sendPlaybackCommandRequest(@NonNull String, @Nullable android.os.Bundle); method @CallSuper public void setMediaViewEnabled(boolean); + method @CallSuper public void setTvRecordingInfo(@NonNull String, @NonNull android.media.tv.TvRecordingInfo); method @CallSuper public void setVideoBounds(@NonNull android.graphics.Rect); } @@ -27480,6 +27481,7 @@ package android.media.tv.interactive { method public void onRequestStopRecording(@NonNull String, @NonNull String); method public void onRequestStreamVolume(@NonNull String); method public void onRequestTrackInfoList(@NonNull String); + method public void onSetTvRecordingInfo(@NonNull String, @NonNull String, @NonNull android.media.tv.TvRecordingInfo); method public void onSetVideoBounds(@NonNull String, @NonNull android.graphics.Rect); method public void onStateChanged(@NonNull String, int, int); method public void onTeletextAppStateChanged(@NonNull String, int); diff --git a/media/java/android/media/tv/interactive/TvInteractiveAppService.java b/media/java/android/media/tv/interactive/TvInteractiveAppService.java index be2c16c90b9e1..f46dc1019412c 100755 --- a/media/java/android/media/tv/interactive/TvInteractiveAppService.java +++ b/media/java/android/media/tv/interactive/TvInteractiveAppService.java @@ -1219,13 +1219,15 @@ public abstract class TvInteractiveAppService extends Service { } /** - * Sets the recording info for the specified recording + * Sets the recording info for the specified recording. * - * @hide + * @param recordingId The ID of the recording to set the info for. This is provided by the + * TV app in {@link TvInteractiveAppView#notifyRecordingStarted(String)} + * @param recordingInfo The {@link TvRecordingInfo} to set to the recording. */ @CallSuper - public void setTvRecordingInfo(@NonNull String recordingId, - @NonNull TvRecordingInfo recordingInfo) { + public void setTvRecordingInfo( + @NonNull String recordingId, @NonNull TvRecordingInfo recordingInfo) { executeOrPostRunnableOnMainThread(() -> { try { if (DEBUG) { diff --git a/media/java/android/media/tv/interactive/TvInteractiveAppView.java b/media/java/android/media/tv/interactive/TvInteractiveAppView.java index af03bb86d3648..14e5d62d8425b 100755 --- a/media/java/android/media/tv/interactive/TvInteractiveAppView.java +++ b/media/java/android/media/tv/interactive/TvInteractiveAppView.java @@ -1055,6 +1055,20 @@ public class TvInteractiveAppView extends ViewGroup { @NonNull String algorithm, @NonNull String alias, @NonNull byte[] data) { } + /** + * This is called when {@link TvInteractiveAppService.Session#setTvRecordingInfo(String, + * TvRecordingInfo)} is called. + * + * @param iAppServiceId The ID of the TV interactive app service bound to this view. + * @param recordingId The ID of the recording to set the info for. This is provided by the + * TV app in {@link TvInteractiveAppView#notifyRecordingStarted(String)} + * @param recordingInfo The {@link TvRecordingInfo} to set to the recording. + */ + public void onSetTvRecordingInfo( + @NonNull String iAppServiceId, + @NonNull String recordingId, + @NonNull TvRecordingInfo recordingInfo) { + } } /** @@ -1439,6 +1453,21 @@ public class TvInteractiveAppView extends ViewGroup { } } + @Override + public void onSetTvRecordingInfo( + Session session, String recordingId, TvRecordingInfo recordingInfo) { + if (DEBUG) { + Log.d(TAG, "onSetRecordingInfo"); + } + if (this != mSessionCallback) { + Log.w(TAG, "onSetRecordingInfo - session not created"); + return; + } + if (mCallback != null) { + mCallback.onSetTvRecordingInfo(mIAppServiceId, recordingId, recordingInfo); + } + } + @Override public void onRequestSigning( Session session, String id, String algorithm, String alias, byte[] data) {