/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.media.tv; import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.ComponentName; import android.content.ContentResolver; import android.content.ContentUris; import android.content.Intent; import android.net.Uri; import android.os.IBinder; import android.provider.BaseColumns; import android.util.ArraySet; import java.util.HashMap; import java.util.List; import java.util.Map; /** * The contract between the TV provider and applications. Contains definitions for the supported * URIs and columns. *
TvContract defines a basic database of TV content metadata such as channel and program * information. The information is stored in {@link Channels} and {@link Programs} tables. * *
The TV provider fills in this column with the name of the package that provides the * initial data of the row. If the package is later uninstalled, the rows it owns are * automatically removed from the tables. * *
Type: TEXT
*/
String COLUMN_PACKAGE_NAME = "package_name";
}
/** Column definitions for the TV channels table. */
public static final class Channels implements BaseTvColumns {
/** The content:// style URI for this table. */
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/"
+ PATH_CHANNEL);
/** The MIME type of a directory of TV channels. */
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/channel";
/** The MIME type of a single TV channel. */
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/channel";
/** A generic channel type. */
public static final String TYPE_OTHER = "TYPE_OTHER";
/** The channel type for NTSC. */
public static final String TYPE_NTSC = "TYPE_NTSC";
/** The channel type for PAL. */
public static final String TYPE_PAL = "TYPE_PAL";
/** The channel type for SECAM. */
public static final String TYPE_SECAM = "TYPE_SECAM";
/** The channel type for DVB-T (terrestrial). */
public static final String TYPE_DVB_T = "TYPE_DVB_T";
/** The channel type for DVB-T2 (terrestrial). */
public static final String TYPE_DVB_T2 = "TYPE_DVB_T2";
/** The channel type for DVB-S (satellite). */
public static final String TYPE_DVB_S = "TYPE_DVB_S";
/** The channel type for DVB-S2 (satellite). */
public static final String TYPE_DVB_S2 = "TYPE_DVB_S2";
/** The channel type for DVB-C (cable). */
public static final String TYPE_DVB_C = "TYPE_DVB_C";
/** The channel type for DVB-C2 (cable). */
public static final String TYPE_DVB_C2 = "TYPE_DVB_C2";
/** The channel type for DVB-H (handheld). */
public static final String TYPE_DVB_H = "TYPE_DVB_H";
/** The channel type for DVB-SH (satellite). */
public static final String TYPE_DVB_SH = "TYPE_DVB_SH";
/** The channel type for ATSC (terrestrial). */
public static final String TYPE_ATSC_T = "TYPE_ATSC_T";
/** The channel type for ATSC (cable). */
public static final String TYPE_ATSC_C = "TYPE_ATSC_C";
/** The channel type for ATSC-M/H (mobile/handheld). */
public static final String TYPE_ATSC_M_H = "TYPE_ATSC_M_H";
/** The channel type for ISDB-T (terrestrial). */
public static final String TYPE_ISDB_T = "TYPE_ISDB_T";
/** The channel type for ISDB-Tb (Brazil). */
public static final String TYPE_ISDB_TB = "TYPE_ISDB_TB";
/** The channel type for ISDB-S (satellite). */
public static final String TYPE_ISDB_S = "TYPE_ISDB_S";
/** The channel type for ISDB-C (cable). */
public static final String TYPE_ISDB_C = "TYPE_ISDB_C";
/** The channel type for 1seg (handheld). */
public static final String TYPE_1SEG = "TYPE_1SEG";
/** The channel type for DTMB (terrestrial). */
public static final String TYPE_DTMB = "TYPE_DTMB";
/** The channel type for CMMB (handheld). */
public static final String TYPE_CMMB = "TYPE_CMMB";
/** The channel type for T-DMB (terrestrial). */
public static final String TYPE_T_DMB = "TYPE_T_DMB";
/** The channel type for S-DMB (satellite). */
public static final String TYPE_S_DMB = "TYPE_S_DMB";
/** A generic service type. */
public static final String SERVICE_TYPE_OTHER = "SERVICE_TYPE_OTHER";
/** The service type for regular TV channels that have both audio and video. */
public static final String SERVICE_TYPE_AUDIO_VIDEO = "SERVICE_TYPE_AUDIO_VIDEO";
/** The service type for radio channels that have audio only. */
public static final String SERVICE_TYPE_AUDIO = "SERVICE_TYPE_AUDIO";
/** The video format for 240p. */
public static final String VIDEO_FORMAT_240P = "VIDEO_FORMAT_240P";
/** The video format for 360p. */
public static final String VIDEO_FORMAT_360P = "VIDEO_FORMAT_360P";
/** The video format for 480i. */
public static final String VIDEO_FORMAT_480I = "VIDEO_FORMAT_480I";
/** The video format for 480p. */
public static final String VIDEO_FORMAT_480P = "VIDEO_FORMAT_480P";
/** The video format for 576i. */
public static final String VIDEO_FORMAT_576I = "VIDEO_FORMAT_576I";
/** The video format for 576p. */
public static final String VIDEO_FORMAT_576P = "VIDEO_FORMAT_576P";
/** The video format for 720p. */
public static final String VIDEO_FORMAT_720P = "VIDEO_FORMAT_720P";
/** The video format for 1080i. */
public static final String VIDEO_FORMAT_1080I = "VIDEO_FORMAT_1080I";
/** The video format for 1080p. */
public static final String VIDEO_FORMAT_1080P = "VIDEO_FORMAT_1080P";
/** The video format for 2160p. */
public static final String VIDEO_FORMAT_2160P = "VIDEO_FORMAT_2160P";
/** The video format for 4320p. */
public static final String VIDEO_FORMAT_4320P = "VIDEO_FORMAT_4320P";
/** The video resolution for standard-definition. */
public static final String VIDEO_RESOLUTION_SD = "VIDEO_RESOLUTION_SD";
/** The video resolution for enhanced-definition. */
public static final String VIDEO_RESOLUTION_ED = "VIDEO_RESOLUTION_ED";
/** The video resolution for high-definition. */
public static final String VIDEO_RESOLUTION_HD = "VIDEO_RESOLUTION_HD";
/** The video resolution for full high-definition. */
public static final String VIDEO_RESOLUTION_FHD = "VIDEO_RESOLUTION_FHD";
/** The video resolution for ultra high-definition. */
public static final String VIDEO_RESOLUTION_UHD = "VIDEO_RESOLUTION_UHD";
private static final Map Use {@link #buildInputId} to build the ID.
*
* This is a required field.
*
* Type: TEXT
*/
public static final String COLUMN_INPUT_ID = "input_id";
/**
* The predefined type of this TV channel.
*
* This is primarily used to indicate which broadcast standard (e.g. ATSC, DVB or ISDB)
* the current channel conforms to. The value should match to one of the followings:
* {@link #TYPE_OTHER}, {@link #TYPE_DVB_T}, {@link #TYPE_DVB_T2}, {@link #TYPE_DVB_S},
* {@link #TYPE_DVB_S2}, {@link #TYPE_DVB_C}, {@link #TYPE_DVB_C2}, {@link #TYPE_DVB_H},
* {@link #TYPE_DVB_SH}, {@link #TYPE_ATSC_T}, {@link #TYPE_ATSC_C},
* {@link #TYPE_ATSC_M_H}, {@link #TYPE_ISDB_T}, {@link #TYPE_ISDB_TB},
* {@link #TYPE_ISDB_S}, {@link #TYPE_ISDB_C}, {@link #TYPE_1SEG}, {@link #TYPE_DTMB},
* {@link #TYPE_CMMB}, {@link #TYPE_T_DMB}, {@link #TYPE_S_DMB}
*
* This is a required field.
*
* Type: TEXT
*/
public static final String COLUMN_TYPE = "type";
/**
* The predefined service type of this TV channel.
*
* This is primarily used to indicate whether the current channel is a regular TV channel
* or a radio-like channel. Use the same coding for {@code service_type} in the underlying
* broadcast standard if it is defined there (e.g. ATSC A/53, ETSI EN 300 468 and ARIB
* STD-B10). Otherwise use one of the followings: {@link #SERVICE_TYPE_OTHER},
* {@link #SERVICE_TYPE_AUDIO_VIDEO}, {@link #SERVICE_TYPE_AUDIO}
*
* This is a required field.
*
* Type: TEXT
*/
public static final String COLUMN_SERVICE_TYPE = "service_type";
/**
* The original network ID of this TV channel.
*
* This is used to identify the originating delivery system, if applicable. Use the same
* coding for {@code original_network_id} in the underlying broadcast standard if it is
* defined there (e.g. ETSI EN 300 468/TR 101 211 and ARIB STD-B10). If channels cannot be
* globally identified by 2-tuple {{@link #COLUMN_TRANSPORT_STREAM_ID},
* {@link #COLUMN_SERVICE_ID}}, one must carefully assign a value to this field to form a
* unique 3-tuple identification {{@code COLUMN_ORIGINAL_NETWORK_ID},
* {@link #COLUMN_TRANSPORT_STREAM_ID}, {@link #COLUMN_SERVICE_ID}} for its channels.
*
* This is a required field if the channel cannot be uniquely identified by a 2-tuple
* {{@link #COLUMN_TRANSPORT_STREAM_ID}, {@link #COLUMN_SERVICE_ID}}.
*
* Type: INTEGER
*/
public static final String COLUMN_ORIGINAL_NETWORK_ID = "original_network_id";
/**
* The transport stream ID of this channel.
*
* This is used to identify the Transport Stream that contains the current channel from
* any other multiplex within a network, if applicable. Use the same coding for
* {@code transport_stream_id} defined in ISO/IEC 13818-1 if the channel is transmitted via
* the MPEG Transport Stream as is the case for many digital broadcast standards.
*
* This is a required field if the current channel is transmitted via the MPEG Transport
* Stream.
*
* Type: INTEGER
*/
public static final String COLUMN_TRANSPORT_STREAM_ID = "transport_stream_id";
/**
* The service ID of this channel.
*
* This is used to identify the current service (roughly equivalent to channel) from any
* other service within the Transport Stream, if applicable. Use the same coding for
* {@code service_id} in the underlying broadcast standard if it is defined there (e.g. ETSI
* EN 300 468 and ARIB STD-B10) or {@code program_number} (which usually has the same value
* as {@code service_id}) in ISO/IEC 13818-1 if the channel is transmitted via the MPEG
* Transport Stream.
*
* This is a required field if the current channel is transmitted via the MPEG Transport
* Stream.
*
* Type: INTEGER
*/
public static final String COLUMN_SERVICE_ID = "service_id";
/**
* The channel number that is displayed to the user.
*
* The format can vary depending on broadcast standard and product specification.
*
* Type: TEXT
*/
public static final String COLUMN_DISPLAY_NUMBER = "display_number";
/**
* The channel name that is displayed to the user.
*
* A call sign is a good candidate to use for this purpose but any name that helps the
* user recognize the current channel will be enough. Can also be empty depending on
* broadcast standard.
*
* Type: TEXT
*/
public static final String COLUMN_DISPLAY_NAME = "display_name";
/**
* The network affiliation for this TV channel.
*
* This is used to identify a channel that is commonly called by its network affiliation
* instead of the display name. Examples include ABC for the channel KGO-HD, FOX for the
* channel KTVU-HD and NBC for the channel KNTV-HD. Can be empty if not applicable.
*
* Type: TEXT
*/
public static final String COLUMN_NETWORK_AFFILIATION = "network_affiliation";
/**
* The description of this TV channel.
*
* Can be empty initially.
*
* Type: TEXT
*/
public static final String COLUMN_DESCRIPTION = "description";
/**
* The typical video format for programs from this TV channel.
*
* This is primarily used to filter out channels based on video format by applications.
* The value should match one of the followings: {@link #VIDEO_FORMAT_240P},
* {@link #VIDEO_FORMAT_360P}, {@link #VIDEO_FORMAT_480I}, {@link #VIDEO_FORMAT_480P},
* {@link #VIDEO_FORMAT_576I}, {@link #VIDEO_FORMAT_576P}, {@link #VIDEO_FORMAT_720P},
* {@link #VIDEO_FORMAT_1080I}, {@link #VIDEO_FORMAT_1080P}, {@link #VIDEO_FORMAT_2160P},
* {@link #VIDEO_FORMAT_4320P}. Note that the actual video resolution of each program from a
* given channel can vary thus one should use {@link Programs#COLUMN_VIDEO_WIDTH} and
* {@link Programs#COLUMN_VIDEO_HEIGHT} to get more accurate video resolution.
*
* Type: TEXT
*
* @see #getVideoResolution
*/
public static final String COLUMN_VIDEO_FORMAT = "video_format";
/**
* The flag indicating whether this TV channel is browsable or not.
*
* A value of 1 indicates the channel is included in the channel list that applications
* use to browse channels, a value of 0 indicates the channel is not included in the list.
* If not specified, this value is set to 0 (not browsable) by default.
*
* Type: INTEGER (boolean)
* @hide
*/
@SystemApi
public static final String COLUMN_BROWSABLE = "browsable";
/**
* The flag indicating whether this TV channel is searchable or not.
*
* The columns of searchable channels can be read by other applications that have proper
* permission. Care must be taken not to open sensitive data.
*
* A value of 1 indicates that the channel is searchable and its columns can be read by
* other applications, a value of 0 indicates that the channel is hidden and its columns can
* be read only by the package that owns the channel and the system. If not specified, this
* value is set to 1 (searchable) by default.
*
* Type: INTEGER (boolean)
*/
public static final String COLUMN_SEARCHABLE = "searchable";
/**
* The flag indicating whether this TV channel is locked or not.
*
* This is primarily used for alternative parental control to prevent unauthorized users
* from watching the current channel regardless of the content rating. A value of 1
* indicates the channel is locked and the user is required to enter passcode to unlock it
* in order to watch the current program from the channel, a value of 0 indicates the
* channel is not locked thus the user is not prompted to enter passcode If not specified,
* this value is set to 0 (not locked) by default.
*
* Type: INTEGER (boolean)
* @hide
*/
@SystemApi
public static final String COLUMN_LOCKED = "locked";
/**
* The URI for the app badge icon of the app link template for this channel.
*
* This small icon is overlaid at the bottom of the poster art specified by
* {@link #COLUMN_APP_LINK_POSTER_ART_URI}. The data in the column must be a URI in one of
* the following formats:
*
* The app-linking allows channel input sources to provide activity links from their live
* channel programming to another activity. This enables content providers to increase user
* engagement by offering the viewer other content or actions.
*
* Type: TEXT
* @see #COLUMN_APP_LINK_COLOR
* @see #COLUMN_APP_LINK_INTENT_URI
* @see #COLUMN_APP_LINK_POSTER_ART_URI
* @see #COLUMN_APP_LINK_TEXT
*/
public static final String COLUMN_APP_LINK_ICON_URI = "app_link_icon_uri";
/**
* The URI for the poster art used as the background of the app link template for this
* channel.
*
* The data in the column must be a URL, or a URI in one of the following formats:
*
* The app-linking allows channel input sources to provide activity links from their live
* channel programming to another activity. This enables content providers to increase user
* engagement by offering the viewer other content or actions.
*
* Type: TEXT
* @see #COLUMN_APP_LINK_COLOR
* @see #COLUMN_APP_LINK_ICON_URI
* @see #COLUMN_APP_LINK_INTENT_URI
* @see #COLUMN_APP_LINK_TEXT
*/
public static final String COLUMN_APP_LINK_POSTER_ART_URI = "app_link_poster_art_uri";
/**
* The link text of the app link template for this channel.
*
* This provides a short description of the action that happens when the corresponding
* app link is clicked.
*
* The app-linking allows channel input sources to provide activity links from their live
* channel programming to another activity. This enables content providers to increase user
* engagement by offering the viewer other content or actions.
*
* Type: TEXT
* @see #COLUMN_APP_LINK_COLOR
* @see #COLUMN_APP_LINK_ICON_URI
* @see #COLUMN_APP_LINK_INTENT_URI
* @see #COLUMN_APP_LINK_POSTER_ART_URI
*/
public static final String COLUMN_APP_LINK_TEXT = "app_link_text";
/**
* The accent color of the app link template for this channel. This is primarily used for
* the background color of the text box in the template.
*
* The app-linking allows channel input sources to provide activity links from their live
* channel programming to another activity. This enables content providers to increase user
* engagement by offering the viewer other content or actions.
*
* Type: INTEGER (color value)
* @see #COLUMN_APP_LINK_ICON_URI
* @see #COLUMN_APP_LINK_INTENT_URI
* @see #COLUMN_APP_LINK_POSTER_ART_URI
* @see #COLUMN_APP_LINK_TEXT
*/
public static final String COLUMN_APP_LINK_COLOR = "app_link_color";
/**
* The intent URI of the app link for this channel.
*
* The URI is created using {@link Intent#toUri} with {@link Intent#URI_INTENT_SCHEME}
* and converted back to the original intent with {@link Intent#parseUri}. The intent is
* launched when the user clicks the corresponding app link for the current channel.
*
* The app-linking allows channel input sources to provide activity links from their live
* channel programming to another activity. This enables content providers to increase user
* engagement by offering the viewer other content or actions.
*
* Type: TEXT
* @see #COLUMN_APP_LINK_COLOR
* @see #COLUMN_APP_LINK_ICON_URI
* @see #COLUMN_APP_LINK_POSTER_ART_URI
* @see #COLUMN_APP_LINK_TEXT
*/
public static final String COLUMN_APP_LINK_INTENT_URI = "app_link_intent_uri";
/**
* Internal data used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: BLOB
*/
public static final String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
/**
* The version number of this row entry used by TV input services.
*
* This is best used by sync adapters to identify the rows to update. The number can be
* defined by individual TV input services. One may assign the same value as
* {@code version_number} that appears in ETSI EN 300 468 or ATSC A/65, if the data are
* coming from a TV broadcast.
*
* Type: INTEGER
*/
public static final String COLUMN_VERSION_NUMBER = "version_number";
private Channels() {}
/**
* A sub-directory of a single TV channel that represents its primary logo.
*
* To access this directory, append {@link Channels.Logo#CONTENT_DIRECTORY} to the raw
* channel URI. The resulting URI represents an image file, and should be interacted
* using ContentResolver.openAssetFileDescriptor.
*
* Note that this sub-directory also supports opening the logo as an asset file in write
* mode. Callers can create or replace the primary logo associated with this channel by
* opening the asset file and writing the full-size photo contents into it. (Make sure there
* is no padding around the logo image.) When the file is closed, the image will be parsed,
* sized down if necessary, and stored.
*
* Usage example:
* By default, the query results will be sorted by
* {@link Programs#COLUMN_START_TIME_UTC_MILLIS} in ascending order.
*/
public static final class Programs implements BaseTvColumns {
/** The content:// style URI for this table. */
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/"
+ PATH_PROGRAM);
/** The MIME type of a directory of TV programs. */
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/program";
/** The MIME type of a single TV program. */
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/program";
/**
* The ID of the TV channel that provides this TV program.
*
* This is a part of the channel URI and matches to {@link BaseColumns#_ID}.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_CHANNEL_ID = "channel_id";
/**
* The title of this TV program.
*
* If this program is an episodic TV show, it is recommended that the title is the series
* title and its related fields ({@link #COLUMN_SEASON_NUMBER},
* {@link #COLUMN_EPISODE_NUMBER}, and {@link #COLUMN_EPISODE_TITLE}) are filled in.
*
* Type: TEXT
*/
public static final String COLUMN_TITLE = "title";
/**
* The season number of this TV program for episodic TV shows.
*
* Can be empty.
*
* Type: INTEGER
*/
public static final String COLUMN_SEASON_NUMBER = "season_number";
/**
* The episode number of this TV program for episodic TV shows.
*
* Can be empty.
*
* Type: INTEGER
*/
public static final String COLUMN_EPISODE_NUMBER = "episode_number";
/**
* The episode title of this TV program for episodic TV shows.
*
* Can be empty.
*
* Type: TEXT
*/
public static final String COLUMN_EPISODE_TITLE = "episode_title";
/**
* The start time of this TV program, in milliseconds since the epoch.
*
* The value should be equal to or larger than {@link #COLUMN_END_TIME_UTC_MILLIS} of the
* previous program in the same channel.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
/**
* The end time of this TV program, in milliseconds since the epoch.
*
* The value should be equal to or less than {@link #COLUMN_START_TIME_UTC_MILLIS} of the
* next program in the same channel.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
/**
* The comma-separated genre string of this TV program.
*
* Use the same language appeared in the underlying broadcast standard, if applicable.
* (For example, one can refer to the genre strings used in Genre Descriptor of ATSC A/65 or
* Content Descriptor of ETSI EN 300 468, if appropriate.) Otherwise, leave empty.
*
* Type: TEXT
*/
public static final String COLUMN_BROADCAST_GENRE = "broadcast_genre";
/**
* The comma-separated canonical genre string of this TV program.
*
* Canonical genres are defined in {@link Genres}. Use
* {@link Genres#encode Genres.encode()} to create a text that can be stored in this column.
* Use {@link Genres#decode Genres.decode()} to get the canonical genre strings from the
* text stored in this column.
*
* Type: TEXT
* @see Genres
*/
public static final String COLUMN_CANONICAL_GENRE = "canonical_genre";
/**
* The short description of this TV program that is displayed to the user by default.
*
* It is recommended to limit the length of the descriptions to 256 characters.
*
* Type: TEXT
*/
public static final String COLUMN_SHORT_DESCRIPTION = "short_description";
/**
* The detailed, lengthy description of this TV program that is displayed only when the user
* wants to see more information.
*
* TV input services should leave this field empty if they have no additional details
* beyond {@link #COLUMN_SHORT_DESCRIPTION}.
*
* Type: TEXT
*/
public static final String COLUMN_LONG_DESCRIPTION = "long_description";
/**
* The width of the video for this TV program, in the unit of pixels.
*
* Together with {@link #COLUMN_VIDEO_HEIGHT} this is used to determine the video
* resolution of the current TV program. Can be empty if it is not known initially or the
* program does not convey any video such as the programs from type
* {@link Channels#SERVICE_TYPE_AUDIO} channels.
*
* Type: INTEGER
*/
public static final String COLUMN_VIDEO_WIDTH = "video_width";
/**
* The height of the video for this TV program, in the unit of pixels.
*
* Together with {@link #COLUMN_VIDEO_WIDTH} this is used to determine the video
* resolution of the current TV program. Can be empty if it is not known initially or the
* program does not convey any video such as the programs from type
* {@link Channels#SERVICE_TYPE_AUDIO} channels.
*
* Type: INTEGER
*/
public static final String COLUMN_VIDEO_HEIGHT = "video_height";
/**
* The comma-separated audio languages of this TV program.
*
* This is used to describe available audio languages included in the program. Use either
* ISO 639-1 or 639-2/T codes.
*
* Type: TEXT
*/
public static final String COLUMN_AUDIO_LANGUAGE = "audio_language";
/**
* The comma-separated content ratings of this TV program.
*
* This is used to describe the content rating(s) of this program. Each comma-separated
* content rating sub-string should be generated by calling
* {@link TvContentRating#flattenToString}. Note that in most cases the program content is
* rated by a single rating system, thus resulting in a corresponding single sub-string that
* does not require comma separation and multiple sub-strings appear only when the program
* content is rated by two or more content rating systems. If any of those ratings is
* specified as "blocked rating" in the user's parental control settings, the TV input
* service should block the current content and wait for the signal that it is okay to
* unblock.
*
* Type: TEXT
*/
public static final String COLUMN_CONTENT_RATING = "content_rating";
/**
* The URI for the poster art of this TV program.
*
* The data in the column must be a URL, or a URI in one of the following formats:
*
* Can be empty.
*
* Type: TEXT
*/
public static final String COLUMN_POSTER_ART_URI = "poster_art_uri";
/**
* The URI for the thumbnail of this TV program.
*
* The system can generate a thumbnail from the poster art if this column is not
* specified. Thus it is not necessary for TV input services to include a thumbnail if it is
* just a scaled image of the poster art.
*
* The data in the column must be a URL, or a URI in one of the following formats:
*
* Can be empty.
*
* Type: TEXT
*/
public static final String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
/**
* The flag indicating whether this TV program is searchable or not.
*
* The columns of searchable programs can be read by other applications that have proper
* permission. Care must be taken not to open sensitive data.
*
* A value of 1 indicates that the program is searchable and its columns can be read by
* other applications, a value of 0 indicates that the program is hidden and its columns can
* be read only by the package that owns the program and the system. If not specified, this
* value is set to 1 (searchable) by default.
*
* Type: INTEGER (boolean)
*/
public static final String COLUMN_SEARCHABLE = "searchable";
/**
* Internal data used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: BLOB
*/
public static final String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
/**
* Internal integer flag used by individual TV input services.
*
* This is internal to the provider that inserted it, and should not be decoded by other
* apps.
*
* Type: INTEGER
*/
public static final String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
/**
* The version number of this row entry used by TV input services.
*
* This is best used by sync adapters to identify the rows to update. The number can be
* defined by individual TV input services. One may assign the same value as
* {@code version_number} in ETSI EN 300 468 or ATSC A/65, if the data are coming from a TV
* broadcast.
*
* Type: INTEGER
*/
public static final String COLUMN_VERSION_NUMBER = "version_number";
private Programs() {}
/** Canonical genres for TV programs. */
public static final class Genres {
/** The genre for Family/Kids. */
public static final String FAMILY_KIDS = "FAMILY_KIDS";
/** The genre for Sports. */
public static final String SPORTS = "SPORTS";
/** The genre for Shopping. */
public static final String SHOPPING = "SHOPPING";
/** The genre for Movies. */
public static final String MOVIES = "MOVIES";
/** The genre for Comedy. */
public static final String COMEDY = "COMEDY";
/** The genre for Travel. */
public static final String TRAVEL = "TRAVEL";
/** The genre for Drama. */
public static final String DRAMA = "DRAMA";
/** The genre for Education. */
public static final String EDUCATION = "EDUCATION";
/** The genre for Animal/Wildlife. */
public static final String ANIMAL_WILDLIFE = "ANIMAL_WILDLIFE";
/** The genre for News. */
public static final String NEWS = "NEWS";
/** The genre for Gaming. */
public static final String GAMING = "GAMING";
/** The genre for Arts. */
public static final String ARTS = "ARTS";
/** The genre for Entertainment. */
public static final String ENTERTAINMENT = "ENTERTAINMENT";
/** The genre for Life Style. */
public static final String LIFE_STYLE = "LIFE_STYLE";
/** The genre for Music. */
public static final String MUSIC = "MUSIC";
/** The genre for Premier. */
public static final String PREMIER = "PREMIER";
/** The genre for Tech/Science. */
public static final String TECH_SCIENCE = "TECH_SCIENCE";
private static final ArraySet By default, the query results will be sorted by
* {@link WatchedPrograms#COLUMN_WATCH_START_TIME_UTC_MILLIS} in descending order.
* @hide
*/
@SystemApi
public static final class WatchedPrograms implements BaseTvColumns {
/** The content:// style URI for this table. */
public static final Uri CONTENT_URI =
Uri.parse("content://" + AUTHORITY + "/watched_program");
/** The MIME type of a directory of watched programs. */
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/watched_program";
/** The MIME type of a single item in this table. */
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/watched_program";
/**
* The UTC time that the user started watching this TV program, in milliseconds since the
* epoch.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_WATCH_START_TIME_UTC_MILLIS =
"watch_start_time_utc_millis";
/**
* The UTC time that the user stopped watching this TV program, in milliseconds since the
* epoch.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_WATCH_END_TIME_UTC_MILLIS = "watch_end_time_utc_millis";
/**
* The ID of the TV channel that provides this TV program.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_CHANNEL_ID = "channel_id";
/**
* The title of this TV program.
*
* Type: TEXT
*/
public static final String COLUMN_TITLE = "title";
/**
* The start time of this TV program, in milliseconds since the epoch.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
/**
* The end time of this TV program, in milliseconds since the epoch.
*
* Type: INTEGER (long)
*/
public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
/**
* The description of this TV program.
*
* Type: TEXT
*/
public static final String COLUMN_DESCRIPTION = "description";
/**
* Extra parameters given to {@link TvInputService.Session#tune(Uri, android.os.Bundle)
* TvInputService.Session.tune(Uri, android.os.Bundle)} when tuning to the channel that
* provides this TV program. (Used internally.)
*
* This column contains an encoded string that represents comma-separated key-value pairs of
* the tune parameters. (Ex. "[key1]=[value1], [key2]=[value2]"). '%' is used as an escape
* character for '%', '=', and ','.
*
* Type: TEXT
*/
public static final String COLUMN_INTERNAL_TUNE_PARAMS = "tune_params";
/**
* The session token of this TV program. (Used internally.)
*
* This contains a String representation of {@link IBinder} for
* {@link TvInputService.Session} that provides the current TV program. It is used
* internally to distinguish watched programs entries from different TV input sessions.
*
* Type: TEXT
*/
public static final String COLUMN_INTERNAL_SESSION_TOKEN = "session_token";
private WatchedPrograms() {}
}
}
*
*
*
*
*
*
* public void writeChannelLogo(long channelId, byte[] logo) {
* Uri channelLogoUri = TvContract.buildChannelLogoUri(channelId);
* try {
* AssetFileDescriptor fd =
* getContentResolver().openAssetFileDescriptor(channelLogoUri, "rw");
* OutputStream os = fd.createOutputStream();
* os.write(logo);
* os.close();
* fd.close();
* } catch (IOException e) {
* // Handle error cases.
* }
* }
*
*/
public static final class Logo {
/**
* The directory twig for this sub-table.
*/
public static final String CONTENT_DIRECTORY = "logo";
private Logo() {}
}
}
/**
* Column definitions for the TV programs table.
*
*
*
*
*
*
*
*