diff --git a/core/api/current.txt b/core/api/current.txt index c9431360e897b..dd4f2134c3d2d 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -27345,7 +27345,9 @@ package android.media.tv { field public static final int TIME_SHIFT_STATUS_UNAVAILABLE = 2; // 0x2 field public static final int TIME_SHIFT_STATUS_UNKNOWN = 0; // 0x0 field public static final int TIME_SHIFT_STATUS_UNSUPPORTED = 1; // 0x1 + field public static final String TV_MESSAGE_KEY_RAW_DATA = "android.media.tv.TvInputManager.raw_data"; field public static final String TV_MESSAGE_KEY_STREAM_ID = "android.media.tv.TvInputManager.stream_id"; + field public static final String TV_MESSAGE_KEY_SUBTYPE = "android.media.tv.TvInputManager.subtype"; field public static final int TV_MESSAGE_TYPE_CLOSED_CAPTION = 2; // 0x2 field public static final int TV_MESSAGE_TYPE_OTHER = 1000; // 0x3e8 field public static final int TV_MESSAGE_TYPE_WATERMARK = 1; // 0x1 diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java index 7d6a8b4c2e977..ef2b5a5b6e503 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -149,10 +149,45 @@ public final class TvInputManager { /** * This constant is used as a {@link Bundle} key for TV messages. The value of the key * identifies the stream on the TV input source for which the watermark event is relevant to. + * + *
Type: String */ public static final String TV_MESSAGE_KEY_STREAM_ID = "android.media.tv.TvInputManager.stream_id"; + /** + * This constant is used as a {@link Bundle} key for TV messages. The value of the key + * identifies the subtype of the data, such as the format of the CC data. The format + * found at this key can then be used to identify how to parse the data at + * {@link #TV_MESSAGE_KEY_RAW_DATA}. + * + * To parse the raw data bsed on the subtype, please refer to the official documentation of the + * concerning subtype. For example, for the subtype "ATSC A/335" for watermarking, the + * document for A/335 from the ATSC standard details how this data is formatted. + * + * Some other examples of common formats include: + *
Type: String + */ + public static final String TV_MESSAGE_KEY_SUBTYPE = + "android.media.tv.TvInputManager.subtype"; + + /** + * This constant is used as a {@link Bundle} key for TV messages. The value of the key + * stores the raw data contained in this TV Message. The format of this data is determined + * by the format defined by the subtype, found using the key at + * {@link #TV_MESSAGE_KEY_SUBTYPE}. See {@link #TV_MESSAGE_KEY_SUBTYPE} for more + * information on how to parse this data. + * + *
Type: byte[] + */ + public static final String TV_MESSAGE_KEY_RAW_DATA = + "android.media.tv.TvInputManager.raw_data"; + static final int VIDEO_UNAVAILABLE_REASON_START = 0; static final int VIDEO_UNAVAILABLE_REASON_END = 18; @@ -802,7 +837,13 @@ public final class TvInputManager { * * @param session A {@link TvInputManager.Session} associated with this callback. * @param type The type of message received, such as {@link #TV_MESSAGE_TYPE_WATERMARK} - * @param data The raw data of the message + * @param data The raw data of the message. The bundle keys are: + * {@link TvInputManager#TV_MESSAGE_KEY_STREAM_ID}, + * {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE}, + * {@link TvInputManager#TV_MESSAGE_KEY_RAW_DATA}. + * See {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE} for more information on + * how to parse this data. + * */ public void onTvMessage(Session session, @TvInputManager.TvMessageType int type, Bundle data) { diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index 3c6ed91d21002..4e380c41ccdbd 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -1030,7 +1030,12 @@ public abstract class TvInputService extends Service { * * @param type The of message that was sent, such as * {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK} - * @param data The data sent with the message. + * @param data The raw data of the message. The bundle keys are: + * {@link TvInputManager#TV_MESSAGE_KEY_STREAM_ID}, + * {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE}, + * {@link TvInputManager#TV_MESSAGE_KEY_RAW_DATA}. + * See {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE} for more information on + * how to parse this data. */ public void notifyTvMessage(@TvInputManager.TvMessageType int type, @NonNull Bundle data) { @@ -1500,7 +1505,12 @@ public abstract class TvInputService extends Service { * * @param type The type of message received, such as * {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK} - * @param data The raw data of the message + * @param data The raw data of the message. The bundle keys are: + * {@link TvInputManager#TV_MESSAGE_KEY_STREAM_ID}, + * {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE}, + * {@link TvInputManager#TV_MESSAGE_KEY_RAW_DATA}. + * See {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE} for more information on + * how to parse this data. */ public void onTvMessage(@NonNull @TvInputManager.TvMessageType String type, @NonNull Bundle data) { diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java index 19a2e5d8d1570..8a886832e88e2 100644 --- a/media/java/android/media/tv/TvView.java +++ b/media/java/android/media/tv/TvView.java @@ -1254,7 +1254,12 @@ public class TvView extends ViewGroup { * @param inputId The ID of the TV input bound to this view. * @param type The type of message received, such as * {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK} - * @param data The raw data of the message + * @param data The raw data of the message. The bundle keys are: + * {@link TvInputManager#TV_MESSAGE_KEY_STREAM_ID}, + * {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE}, + * {@link TvInputManager#TV_MESSAGE_KEY_RAW_DATA}. + * See {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE} for more information on + * how to parse this data. */ public void onTvMessage(@NonNull String inputId, @TvInputManager.TvMessageType int type, @NonNull Bundle data) { diff --git a/media/java/android/media/tv/interactive/TvInteractiveAppService.java b/media/java/android/media/tv/interactive/TvInteractiveAppService.java index 7dfe16a3caf99..69ff9c63b32bc 100755 --- a/media/java/android/media/tv/interactive/TvInteractiveAppService.java +++ b/media/java/android/media/tv/interactive/TvInteractiveAppService.java @@ -919,7 +919,12 @@ public abstract class TvInteractiveAppService extends Service { * * @param type The type of message received, such as * {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK} - * @param data The raw data of the message + * @param data The raw data of the message. The bundle keys are: + * {@link TvInputManager#TV_MESSAGE_KEY_STREAM_ID}, + * {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE}, + * {@link TvInputManager#TV_MESSAGE_KEY_RAW_DATA}. + * See {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE} for more information on + * how to parse this data. */ public void onTvMessage(@TvInputManager.TvMessageType int type, @NonNull Bundle data) { diff --git a/media/java/android/media/tv/interactive/TvInteractiveAppView.java b/media/java/android/media/tv/interactive/TvInteractiveAppView.java index 1a0319bddc2d8..80a14354ef7a5 100755 --- a/media/java/android/media/tv/interactive/TvInteractiveAppView.java +++ b/media/java/android/media/tv/interactive/TvInteractiveAppView.java @@ -944,7 +944,12 @@ public class TvInteractiveAppView extends ViewGroup { * * @param type The type of message received, such as * {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK} - * @param data The raw data of the message + * @param data The raw data of the message. The bundle keys are: + * {@link TvInputManager#TV_MESSAGE_KEY_STREAM_ID}, + * {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE}, + * {@link TvInputManager#TV_MESSAGE_KEY_RAW_DATA}. + * See {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE} for more information on + * how to parse this data. */ public void notifyTvMessage(@NonNull @TvInputManager.TvMessageType int type, @NonNull Bundle data) {