Loading media/java/android/media/tv/ITvInputClient.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ oneway interface ITvInputClient { void onTimeShiftCurrentPositionChanged(long timeMs, int seq); void onAitInfoUpdated(in AitInfo aitInfo, int seq); void onSignalStrength(int stength, int seq); void onTvMessage(in String type, in Bundle data, int seq); void onTuned(in Uri channelUri, int seq); // For the recording session Loading media/java/android/media/tv/ITvInputSessionCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -58,4 +58,7 @@ oneway interface ITvInputSessionCallback { // For ad response void onAdResponse(in AdResponse response); void onAdBufferConsumed(in AdBuffer buffer); // For messages sent from the TV input void onTvMessage(in String type, in Bundle data); } media/java/android/media/tv/TvInputManager.java +51 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.StringDef; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; Loading Loading @@ -130,6 +131,20 @@ public final class TvInputManager { VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING, VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN}) public @interface VideoUnavailableReason {} /** * @hide */ public static final String TV_MESSAGE_TYPE_WATERMARK = "Watermark"; /** * @hide */ public static final String TV_MESSAGE_TYPE_ATSC_CC = "ATSC_CC"; /** @hide */ @Retention(RetentionPolicy.SOURCE) @StringDef({TV_MESSAGE_TYPE_WATERMARK, TV_MESSAGE_TYPE_ATSC_CC}) public @interface TvMessageType {} static final int VIDEO_UNAVAILABLE_REASON_START = 0; static final int VIDEO_UNAVAILABLE_REASON_END = 18; Loading Loading @@ -690,6 +705,17 @@ public final class TvInputManager { public void onTuned(Session session, Uri channelUri) { } /** * This is called when the session receives a new Tv Message * * @param type the type of {@link TvMessageType} * @param data the raw data of the message * @hide */ public void onTvMessage(Session session, @TvInputManager.TvMessageType String type, Bundle data) { } // For the recording session only /** * This is called when the current recording session has stopped recording and created a Loading Loading @@ -919,6 +945,19 @@ public final class TvInputManager { }); } void postTvMessage(String type, Bundle data) { mHandler.post(new Runnable() { @Override public void run() { mSessionCallback.onTvMessage(mSession, type, data); if (mSession.mIAppNotificationEnabled && mSession.getInteractiveAppSession() != null) { mSession.getInteractiveAppSession().notifyTvMessage(type, data); } } }); } // For the recording session only void postRecordingStopped(final Uri recordedProgramUri) { mHandler.post(new Runnable() { Loading Loading @@ -1378,6 +1417,18 @@ public final class TvInputManager { } } @Override public void onTvMessage(String type, Bundle data, int seq) { synchronized (mSessionCallbackRecordMap) { SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq); if (record == null) { Log.e(TAG, "Callback not found for seq " + seq); return; } record.postTvMessage(type, data); } } @Override public void onRecordingStopped(Uri recordedProgramUri, int seq) { synchronized (mSessionCallbackRecordMap) { Loading media/java/android/media/tv/TvInputService.java +21 −0 Original line number Diff line number Diff line Loading @@ -2062,6 +2062,27 @@ public abstract class TvInputService extends Service { }); } /** * Informs the application of the raw data from the TV message. * @param type The {@link TvInputManager.TvMessageType} of message that was sent. * @param data The data sent with the message. * @hide */ public void notifyTvMessage(@TvInputManager.TvMessageType String type, Bundle data) { } /** * Called when the application enables or disables the detection of the specified message * type. * @param type The {@link TvInputManager.TvMessageType} of message that was sent. * @param enabled {@code true} if you want to enable TV message detecting * {@code false} otherwise. * @hide */ public void onSetTvMessageEnabled(@TvInputManager.TvMessageType String type, boolean enabled) { } /** * Called when the application requests to tune to a given channel for TV program recording. * Loading media/java/android/media/tv/TvView.java +36 −0 Original line number Diff line number Diff line Loading @@ -653,6 +653,17 @@ public class TvView extends ViewGroup { mOnUnhandledInputEventListener = listener; } /** * Enables or disables TV message detecting in the streams of bound TV input. * * @param type The type of {@link android.media.tv.TvInputManager.TvMessageType} * @param enabled {@code true} if you want to enable TV message detecting * {@code false} otherwise. * @hide */ public void setTvMessageEnabled(@TvInputManager.TvMessageType String type, boolean enabled) { } @Override public boolean dispatchKeyEvent(KeyEvent event) { if (super.dispatchKeyEvent(event)) { Loading Loading @@ -1094,6 +1105,17 @@ public class TvView extends ViewGroup { */ public void onTuned(@NonNull String inputId, @NonNull Uri channelUri) { } /** * This is called when the session has been tuned to the given channel. * * @param type The type of {@link android.media.tv.TvInputManager.TvMessageType} * @param data The raw data of the message * @hide */ public void onTvMessage(@NonNull String inputId, @TvInputManager.TvMessageType String type, Bundle data) { } } /** Loading Loading @@ -1432,5 +1454,19 @@ public class TvView extends ViewGroup { mCallback.onTuned(mInputId, channelUri); } } @Override public void onTvMessage(Session session, String type, Bundle data) { if (DEBUG) { Log.d(TAG, "onTvMessage(type=" + type + ", data=" + data + ")"); } if (this != mSessionCallback) { Log.w(TAG, "onTvMessage - session not created"); return; } if (mCallback != null) { mCallback.onTvMessage(mInputId, type, data); } } } } Loading
media/java/android/media/tv/ITvInputClient.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ oneway interface ITvInputClient { void onTimeShiftCurrentPositionChanged(long timeMs, int seq); void onAitInfoUpdated(in AitInfo aitInfo, int seq); void onSignalStrength(int stength, int seq); void onTvMessage(in String type, in Bundle data, int seq); void onTuned(in Uri channelUri, int seq); // For the recording session Loading
media/java/android/media/tv/ITvInputSessionCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -58,4 +58,7 @@ oneway interface ITvInputSessionCallback { // For ad response void onAdResponse(in AdResponse response); void onAdBufferConsumed(in AdBuffer buffer); // For messages sent from the TV input void onTvMessage(in String type, in Bundle data); }
media/java/android/media/tv/TvInputManager.java +51 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.StringDef; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; Loading Loading @@ -130,6 +131,20 @@ public final class TvInputManager { VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING, VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN}) public @interface VideoUnavailableReason {} /** * @hide */ public static final String TV_MESSAGE_TYPE_WATERMARK = "Watermark"; /** * @hide */ public static final String TV_MESSAGE_TYPE_ATSC_CC = "ATSC_CC"; /** @hide */ @Retention(RetentionPolicy.SOURCE) @StringDef({TV_MESSAGE_TYPE_WATERMARK, TV_MESSAGE_TYPE_ATSC_CC}) public @interface TvMessageType {} static final int VIDEO_UNAVAILABLE_REASON_START = 0; static final int VIDEO_UNAVAILABLE_REASON_END = 18; Loading Loading @@ -690,6 +705,17 @@ public final class TvInputManager { public void onTuned(Session session, Uri channelUri) { } /** * This is called when the session receives a new Tv Message * * @param type the type of {@link TvMessageType} * @param data the raw data of the message * @hide */ public void onTvMessage(Session session, @TvInputManager.TvMessageType String type, Bundle data) { } // For the recording session only /** * This is called when the current recording session has stopped recording and created a Loading Loading @@ -919,6 +945,19 @@ public final class TvInputManager { }); } void postTvMessage(String type, Bundle data) { mHandler.post(new Runnable() { @Override public void run() { mSessionCallback.onTvMessage(mSession, type, data); if (mSession.mIAppNotificationEnabled && mSession.getInteractiveAppSession() != null) { mSession.getInteractiveAppSession().notifyTvMessage(type, data); } } }); } // For the recording session only void postRecordingStopped(final Uri recordedProgramUri) { mHandler.post(new Runnable() { Loading Loading @@ -1378,6 +1417,18 @@ public final class TvInputManager { } } @Override public void onTvMessage(String type, Bundle data, int seq) { synchronized (mSessionCallbackRecordMap) { SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq); if (record == null) { Log.e(TAG, "Callback not found for seq " + seq); return; } record.postTvMessage(type, data); } } @Override public void onRecordingStopped(Uri recordedProgramUri, int seq) { synchronized (mSessionCallbackRecordMap) { Loading
media/java/android/media/tv/TvInputService.java +21 −0 Original line number Diff line number Diff line Loading @@ -2062,6 +2062,27 @@ public abstract class TvInputService extends Service { }); } /** * Informs the application of the raw data from the TV message. * @param type The {@link TvInputManager.TvMessageType} of message that was sent. * @param data The data sent with the message. * @hide */ public void notifyTvMessage(@TvInputManager.TvMessageType String type, Bundle data) { } /** * Called when the application enables or disables the detection of the specified message * type. * @param type The {@link TvInputManager.TvMessageType} of message that was sent. * @param enabled {@code true} if you want to enable TV message detecting * {@code false} otherwise. * @hide */ public void onSetTvMessageEnabled(@TvInputManager.TvMessageType String type, boolean enabled) { } /** * Called when the application requests to tune to a given channel for TV program recording. * Loading
media/java/android/media/tv/TvView.java +36 −0 Original line number Diff line number Diff line Loading @@ -653,6 +653,17 @@ public class TvView extends ViewGroup { mOnUnhandledInputEventListener = listener; } /** * Enables or disables TV message detecting in the streams of bound TV input. * * @param type The type of {@link android.media.tv.TvInputManager.TvMessageType} * @param enabled {@code true} if you want to enable TV message detecting * {@code false} otherwise. * @hide */ public void setTvMessageEnabled(@TvInputManager.TvMessageType String type, boolean enabled) { } @Override public boolean dispatchKeyEvent(KeyEvent event) { if (super.dispatchKeyEvent(event)) { Loading Loading @@ -1094,6 +1105,17 @@ public class TvView extends ViewGroup { */ public void onTuned(@NonNull String inputId, @NonNull Uri channelUri) { } /** * This is called when the session has been tuned to the given channel. * * @param type The type of {@link android.media.tv.TvInputManager.TvMessageType} * @param data The raw data of the message * @hide */ public void onTvMessage(@NonNull String inputId, @TvInputManager.TvMessageType String type, Bundle data) { } } /** Loading Loading @@ -1432,5 +1454,19 @@ public class TvView extends ViewGroup { mCallback.onTuned(mInputId, channelUri); } } @Override public void onTvMessage(Session session, String type, Bundle data) { if (DEBUG) { Log.d(TAG, "onTvMessage(type=" + type + ", data=" + data + ")"); } if (this != mSessionCallback) { Log.w(TAG, "onTvMessage - session not created"); return; } if (mCallback != null) { mCallback.onTvMessage(mInputId, type, data); } } } }