/**@class android.media.tv.TvContract @extends java.lang.Object The contract between the TV provider and applications. Contains definitions for the supported URIs and columns. <h3>Overview</h3> <p>TvContract defines a basic database of TV content metadata such as channel and program information. The information is stored in {@link android.media.tv.TvContract.Channels} and {@link android.media.tv.TvContract.Programs} tables. <ul> <li>A row in the {@link android.media.tv.TvContract.Channels} table represents information about a TV channel. The data format can vary greatly from standard to standard or according to service provider, thus the columns here are mostly comprised of basic entities that are usually seen to users regardless of standard such as channel number and name.</li> <li>A row in the {@link android.media.tv.TvContract.Programs} table represents a set of data describing a TV program such as program title and start time.</li> </ul> */ var TvContract = { /**The authority for the TV provider. */ AUTHORITY : "android.media.tv", /** Permission to read TV listings. This is required to read all the TV channel and program information available on the system. @hide */ PERMISSION_READ_TV_LISTINGS : "android.permission.READ_TV_LISTINGS", /** Broadcast Action: sent when an application requests the system to make the given channel browsable. The operation is performed in the background without user interaction. This is only relevant to channels with {@link android.media.tv.TvContract.Channels#TYPE_PREVIEW} type. <p>The intent must contain the following bundle parameters: <ul> <li>{@link #EXTRA_CHANNEL_ID}: ID for the {@link android.media.tv.TvContract.Channels#TYPE_PREVIEW} channel as a long integer.</li> <li>{@link #EXTRA_PACKAGE_NAME}: the package name of the requesting application.</li> </ul> @hide */ ACTION_CHANNEL_BROWSABLE_REQUESTED : "android.media.tv.action.CHANNEL_BROWSABLE_REQUESTED", /** Activity Action: sent by an application telling the system to make the given channel browsable with user interaction. The system may show UI to ask user to approve the channel. This is only relevant to channels with {@link android.media.tv.TvContract.Channels#TYPE_PREVIEW} type. Use {@link Activity#startActivityForResult} to get the result of the request. <p>The intent must contain the following bundle parameters: <ul> <li>{@link #EXTRA_CHANNEL_ID}: ID for the {@link android.media.tv.TvContract.Channels#TYPE_PREVIEW} channel as a long integer.</li> </ul> */ ACTION_REQUEST_CHANNEL_BROWSABLE : "android.media.tv.action.REQUEST_CHANNEL_BROWSABLE", /** Broadcast Action: sent by the system to tell the target TV input that one of its preview program's browsable state is disabled, i.e., it will no longer be shown to users, which, for example, might be a result of users' interaction with UI. The input is expected to delete the preview program from the content provider. <p>The intent must contain the following bundle parameter: <ul> <li>{@link #EXTRA_PREVIEW_PROGRAM_ID}: the disabled preview program ID.</li> </ul> */ ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED : "android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED", /** Broadcast Action: sent by the system to tell the target TV input that one of its "watch next" program's browsable state is disabled, i.e., it will no longer be shown to users, which, for example, might be a result of users' interaction with UI. The input is expected to delete the "watch next" program from the content provider. <p>The intent must contain the following bundle parameter: <ul> <li>{@link #EXTRA_WATCH_NEXT_PROGRAM_ID}: the disabled "watch next" program ID.</li> </ul> */ ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED : "android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED", /** Broadcast Action: sent by the system to tell the target TV input that one of its existing preview programs is added to the watch next programs table by user. <p>The intent must contain the following bundle parameters: <ul> <li>{@link #EXTRA_PREVIEW_PROGRAM_ID}: the ID of the existing preview program.</li> <li>{@link #EXTRA_WATCH_NEXT_PROGRAM_ID}: the ID of the new watch next program.</li> </ul> */ ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT : "android.media.tv.action.PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT", /** Broadcast Action: sent to the target TV input after it is first installed to notify the input to initialize its channels and programs to the system content provider. <p>Note that this intent is sent only on devices with {@link android.content.pm.PackageManager#FEATURE_LEANBACK} enabled. Besides that, in order to receive this intent, the target TV input must: <ul> <li>Declare a broadcast receiver for this intent in its <code>AndroidManifest.xml</code>.</li> <li>Declare appropriate permissions to write channel and program data in its <code>AndroidManifest.xml</code>.</li> </ul> */ ACTION_INITIALIZE_PROGRAMS : "android.media.tv.action.INITIALIZE_PROGRAMS", /** The key for a bundle parameter containing a channel ID as a long integer */ EXTRA_CHANNEL_ID : "android.media.tv.extra.CHANNEL_ID", /** The key for a bundle parameter containing a package name as a string. @hide */ EXTRA_PACKAGE_NAME : "android.media.tv.extra.PACKAGE_NAME", /**The key for a bundle parameter containing a program ID as a long integer. */ EXTRA_PREVIEW_PROGRAM_ID : "android.media.tv.extra.PREVIEW_PROGRAM_ID", /**The key for a bundle parameter containing a watch next program ID as a long integer. */ EXTRA_WATCH_NEXT_PROGRAM_ID : "android.media.tv.extra.WATCH_NEXT_PROGRAM_ID", /** The key for a bundle parameter containing the result code of a method call as an integer. @see #RESULT_OK @see #RESULT_ERROR_IO @see #RESULT_ERROR_INVALID_ARGUMENT @hide */ EXTRA_RESULT_CODE : "android.media.tv.extra.RESULT_CODE", /** The result code for a successful execution without error. @hide */ RESULT_OK : "0", /** The result code for a failure from I/O operation. @hide */ RESULT_ERROR_IO : "1", /** The result code for a failure from invalid argument. @hide */ RESULT_ERROR_INVALID_ARGUMENT : "2", /** The method name to get existing columns in the given table of the specified content provider. <p>The method caller must provide the following parameter: <ul> <li>{@code arg}: The content URI of the target table as a {@link String}.</li> </ul> <p>On success, the returned {@link android.os.Bundle} will include existing column names with the key {@link #EXTRA_EXISTING_COLUMN_NAMES}. Otherwise, the return value will be {@code null}. @see ContentResolver#call(Uri, String, String, Bundle) @see #EXTRA_EXISTING_COLUMN_NAMES @hide */ METHOD_GET_COLUMNS : "get_columns", /** The method name to add a new column in the given table of the specified content provider. <p>The method caller must provide the following parameter: <ul> <li>{@code arg}: The content URI of the target table as a {@link String}.</li> <li>{@code extra}: Name, data type, and default value of the new column in a Bundle: <ul> <li>{@link #EXTRA_COLUMN_NAME} the column name as a {@link String}.</li> <li>{@link #EXTRA_DATA_TYPE} the data type as a {@link String}.</li> <li>{@link #EXTRA_DEFAULT_VALUE} the default value as a {@link String}. (optional)</li> </ul> </li> </ul> <p>On success, the returned {@link android.os.Bundle} will include current colum names after the addition operation with the key {@link #EXTRA_EXISTING_COLUMN_NAMES}. Otherwise, the return value will be {@code null}. @see ContentResolver#call(Uri, String, String, Bundle) @see #EXTRA_COLUMN_NAME @see #EXTRA_DATA_TYPE @see #EXTRA_DEFAULT_VALUE @see #EXTRA_EXISTING_COLUMN_NAMES @hide */ METHOD_ADD_COLUMN : "add_column", /** The method name to get all the blocked packages. When a package is blocked, all the data for preview programs/channels and watch next programs belonging to this package in the content provider will be cleared. Once a package is blocked, {@link SecurityException} will be thrown for all the requests to preview programs/channels and watch next programs via {@link android.content.ContentProvider} from it. <p>The returned {@link android.os.Bundle} will include all the blocked package names with the key {@link #EXTRA_BLOCKED_PACKAGES}. @see ContentResolver#call(Uri, String, String, Bundle) @see #EXTRA_BLOCKED_PACKAGES @see #METHOD_BLOCK_PACKAGE @see #METHOD_UNBLOCK_PACKAGE @hide */ METHOD_GET_BLOCKED_PACKAGES : "get_blocked_packages", /** The method name to block the access from the given package. When a package is blocked, all the data for preview programs/channels and watch next programs belonging to this package in the content provider will be cleared. Once a package is blocked, {@link SecurityException} will be thrown for all the requests to preview programs/channels and watch next programs via {@link android.content.ContentProvider} from it. <p>The method caller must provide the following parameter: <ul> <li>{@code arg}: The package name to be added as blocked package {@link String}.</li> </ul> <p>The returned {@link android.os.Bundle} will include an integer code denoting whether the execution is successful or not with the key {@link #EXTRA_RESULT_CODE}. If {@code arg} is empty, the result code will be {@link #RESULT_ERROR_INVALID_ARGUMENT}. If success, the result code will be {@link #RESULT_OK}. Otherwise, the result code will be {@link #RESULT_ERROR_IO}. @see ContentResolver#call(Uri, String, String, Bundle) @see #EXTRA_RESULT_CODE @see #METHOD_GET_BLOCKED_PACKAGES @see #METHOD_UNBLOCK_PACKAGE @hide */ METHOD_BLOCK_PACKAGE : "block_package", /** The method name to unblock the access from the given package. When a package is blocked, all the data for preview programs/channels and watch next programs belonging to this package in the content provider will be cleared. Once a package is blocked, {@link SecurityException} will be thrown for all the requests to preview programs/channels and watch next programs via {@link android.content.ContentProvider} from it. <p>The method caller must provide the following parameter: <ul> <li>{@code arg}: The package name to be removed from blocked list as a {@link String}. </li> </ul> <p>The returned {@link android.os.Bundle} will include an integer code denoting whether the execution is successful or not with the key {@link #EXTRA_RESULT_CODE}. If {@code arg} is empty, the result code will be {@link #RESULT_ERROR_INVALID_ARGUMENT}. If success, the result code will be {@link #RESULT_OK}. Otherwise, the result code will be {@link #RESULT_ERROR_IO}. @see ContentResolver#call(Uri, String, String, Bundle) @see #EXTRA_RESULT_CODE @see #METHOD_GET_BLOCKED_PACKAGES @see #METHOD_BLOCK_PACKAGE @hide */ METHOD_UNBLOCK_PACKAGE : "unblock_package", /** The key for a returned {@link Bundle} value containing existing column names in the given table as an {@link ArrayList} of {@link String}. @see #METHOD_GET_COLUMNS @see #METHOD_ADD_COLUMN @hide */ EXTRA_EXISTING_COLUMN_NAMES : "android.media.tv.extra.EXISTING_COLUMN_NAMES", /** The key for a {@link Bundle} parameter containing the new column name to be added in the given table as a non-empty {@link CharSequence}. @see #METHOD_ADD_COLUMN @hide */ EXTRA_COLUMN_NAME : "android.media.tv.extra.COLUMN_NAME", /** The key for a {@link Bundle} parameter containing the data type of the new column to be added in the given table as a non-empty {@link CharSequence}, which should be one of the following values: {@code "TEXT"}, {@code "INTEGER"}, {@code "REAL"}, or {@code "BLOB"}. @see #METHOD_ADD_COLUMN @hide */ EXTRA_DATA_TYPE : "android.media.tv.extra.DATA_TYPE", /** The key for a {@link Bundle} parameter containing the default value of the new column to be added in the given table as a {@link CharSequence}, which represents a valid default value according to the data type provided with {@link #EXTRA_DATA_TYPE}. @see #METHOD_ADD_COLUMN @hide */ EXTRA_DEFAULT_VALUE : "android.media.tv.extra.DEFAULT_VALUE", /** The key for a returned {@link Bundle} value containing all the blocked package names as an {@link ArrayList} of {@link String}. @see #METHOD_GET_BLOCKED_PACKAGES @hide */ EXTRA_BLOCKED_PACKAGES : "android.media.tv.extra.BLOCKED_PACKAGES", /** An optional query, update or delete URI parameter that allows the caller to specify TV input ID to filter channels. @hide */ PARAM_INPUT : "input", /** An optional query, update or delete URI parameter that allows the caller to specify channel ID to filter programs. @hide */ PARAM_CHANNEL : "channel", /** An optional query, update or delete URI parameter that allows the caller to specify start time (in milliseconds since the epoch) to filter programs. @hide */ PARAM_START_TIME : "start_time", /** An optional query, update or delete URI parameter that allows the caller to specify end time (in milliseconds since the epoch) to filter programs. @hide */ PARAM_END_TIME : "end_time", /** A query, update or delete URI parameter that allows the caller to operate on all or browsable-only channels. If set to "true", the rows that contain non-browsable channels are not affected. @hide */ PARAM_BROWSABLE_ONLY : "browsable_only", /** An optional query, update or delete URI parameter that allows the caller to specify canonical genre to filter programs. @hide */ PARAM_CANONICAL_GENRE : "canonical_genre", /** A query, update or delete URI parameter that allows the caller to operate only on preview or non-preview channels. If set to "true", the operation affects the rows for preview channels only. If set to "false", the operation affects the rows for non-preview channels only. @hide */ PARAM_PREVIEW : "preview", /** An optional query, update or delete URI parameter that allows the caller to specify package name to filter channels. @hide */ PARAM_PACKAGE : "package", /**Builds an ID that uniquely identifies a TV input service. @param {Object {ComponentName}} name The {@link ComponentName} of the TV input service to build ID for. @return {String} the ID for the given TV input service. */ buildInputId : function( ) {}, /**Builds a URI that points to a specific channel. @param {Number} channelId The ID of the channel to point to. */ buildChannelUri : function( ) {}, /**Build a special channel URI intended to be used with pass-through inputs. (e.g. HDMI) @param {String} inputId The ID of the pass-through input to build a channels URI for. @see TvInputInfo#isPassthroughInput() */ buildChannelUriForPassthroughInput : function( ) {}, /**Builds a URI that points to a channel logo. See {@link android.media.tv.TvContract.Channels.Logo}. @param {Number} channelId The ID of the channel whose logo is pointed to. */ buildChannelLogoUri : function( ) {}, /**Builds a URI that points to a channel logo. See {@link android.media.tv.TvContract.Channels.Logo}. @param {Object {Uri}} channelUri The URI of the channel whose logo is pointed to. */ buildChannelLogoUri : function( ) {}, /**Builds a URI that points to all channels from a given TV input. @param {String} inputId The ID of the TV input to build a channels URI for. If {@code null}, builds a URI for all the TV inputs. */ buildChannelsUriForInput : function( ) {}, /**Builds a URI that points to all or browsable-only channels from a given TV input. @param {String} inputId The ID of the TV input to build a channels URI for. If {@code null}, builds a URI for all the TV inputs. @param {Boolean} browsableOnly If set to {@code true} the URI points to only browsable channels. If set to {@code false} the URI points to all channels regardless of whether they are browsable or not. @hide */ buildChannelsUriForInput : function( ) {}, /**Builds a URI that points to all or browsable-only channels which have programs with the given genre from the given TV input. @param {String} inputId The ID of the TV input to build a channels URI for. If {@code null}, builds a URI for all the TV inputs. @param {String} genre {@link Programs.Genres} to search. If {@code null}, builds a URI for all genres. @param {Boolean} browsableOnly If set to {@code true} the URI points to only browsable channels. If set to {@code false} the URI points to all channels regardless of whether they are browsable or not. @hide */ buildChannelsUriForInput : function( ) {}, /**Builds a URI that points to a specific program. @param {Number} programId The ID of the program to point to. */ buildProgramUri : function( ) {}, /**Builds a URI that points to all programs on a given channel. @param {Number} channelId The ID of the channel to return programs for. */ buildProgramsUriForChannel : function( ) {}, /**Builds a URI that points to all programs on a given channel. @param {Object {Uri}} channelUri The URI of the channel to return programs for. */ buildProgramsUriForChannel : function( ) {}, /**Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame. @param {Number} channelId The ID of the channel to return programs for. @param {Number} startTime The start time used to filter programs. The returned programs will have a {@link Programs#COLUMN_END_TIME_UTC_MILLIS} that is greater than or equal to {@code startTime}. @param {Number} endTime The end time used to filter programs. The returned programs will have {@link Programs#COLUMN_START_TIME_UTC_MILLIS} that is less than or equal to {@code endTime}. */ buildProgramsUriForChannel : function( ) {}, /**Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame. @param {Object {Uri}} channelUri The URI of the channel to return programs for. @param {Number} startTime The start time used to filter programs. The returned programs should have {@link Programs#COLUMN_END_TIME_UTC_MILLIS} that is greater than this time. @param {Number} endTime The end time used to filter programs. The returned programs should have {@link Programs#COLUMN_START_TIME_UTC_MILLIS} that is less than this time. */ buildProgramsUriForChannel : function( ) {}, /**Builds a URI that points to a specific recorded program. @param {Number} recordedProgramId The ID of the recorded program to point to. */ buildRecordedProgramUri : function( ) {}, /**Builds a URI that points to a specific preview program. @param {Number} previewProgramId The ID of the preview program to point to. */ buildPreviewProgramUri : function( ) {}, /**Builds a URI that points to all preview programs on a given channel. @param {Number} channelId The ID of the channel to return preview programs for. */ buildPreviewProgramsUriForChannel : function( ) {}, /**Builds a URI that points to all preview programs on a given channel. @param {Object {Uri}} channelUri The URI of the channel to return preview programs for. */ buildPreviewProgramsUriForChannel : function( ) {}, /**Builds a URI that points to a specific watch next program. @param {Number} watchNextProgramId The ID of the watch next program to point to. */ buildWatchNextProgramUri : function( ) {}, /**Builds a URI that points to a specific program the user watched. @param {Number} watchedProgramId The ID of the watched program to point to. @hide */ buildWatchedProgramUri : function( ) {}, /** @return {Boolean} {@code true} if {@code uri} is a channel URI. */ isChannelUri : function( ) {}, /** @return {Boolean} {@code true} if {@code uri} is a channel URI for a tuner input. */ isChannelUriForTunerInput : function( ) {}, /** @return {Boolean} {@code true} if {@code uri} is a channel URI for a pass-through input. */ isChannelUriForPassthroughInput : function( ) {}, /** @return {Boolean} {@code true} if {@code uri} is a program URI. */ isProgramUri : function( ) {}, /** @return {Boolean} {@code true} if {@code uri} is a recorded program URI. */ isRecordedProgramUri : function( ) {}, /**Requests to make a channel browsable. <p>Once called, the system will review the request and make the channel browsable based on its policy. The first request from a package is guaranteed to be approved. This is only relevant to channels with {@link android.media.tv.TvContract.Channels#TYPE_PREVIEW} type. @param {Object {Context}} context The context for accessing content provider. @param {Number} channelId The channel ID to be browsable. @see Channels#COLUMN_BROWSABLE */ requestChannelBrowsable : function( ) {}, };