From f5cd0b388ac31104e014f9193d06080851a09e18 Mon Sep 17 00:00:00 2001
From: Jae Seo
* This is a required field. *
* Type: TEXT *
*/ - public static final String SERVICE_NAME = "service_name"; + public static final String COLUMN_SERVICE_NAME = "service_name"; /** * The predefined type of this TV channel. *- * This is used to indicate which broadcast standard (e.g. ATSC, DVB or ISDB) the current - * channel conforms to. + * This is primarily used to indicate which broadcast standard (e.g. ATSC, DVB or ISDB) the + * current channel conforms to, with an exception being {@link #TYPE_PASSTHROUGH}, which is + * a special channel type used only by pass-through inputs such as HDMI. The value should + * match to one of the followings: {@link #TYPE_OTHER}, {@link #TYPE_PASSTHROUGH}, + * {@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: INTEGER *
*/ - public static final String TYPE = "type"; + public static final String COLUMN_TYPE = "type"; /** - * The transport stream ID as appeared in various broadcast standards. + * The predefined service type of this TV channel. *- * This is not a required field but if provided, can significantly increase the accuracy of - * channel identification. + * 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_TV}, {@link #SERVICE_TYPE_RADIO} + *
+ * This is a required field. *
* Type: INTEGER *
*/ - public static final String TRANSPORT_STREAM_ID = "transport_stream_id"; + 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 origianal_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 {{@link #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: INTEGER + * Type: TEXT *
*/ - public static final String DISPLAY_NUMBER = "display_number"; + public static final String COLUMN_DISPLAY_NUMBER = "display_number"; /** * The channel name that is displayed to the user. @@ -369,7 +445,7 @@ public final class TvContract { * Type: TEXT * */ - public static final String DISPLAY_NAME = "display_name"; + public static final String COLUMN_DISPLAY_NAME = "display_name"; /** * The description of this TV channel. @@ -379,7 +455,7 @@ public final class TvContract { * Type: TEXT * */ - public static final String DESCRIPTION = "description"; + public static final String COLUMN_DESCRIPTION = "description"; /** * The flag indicating whether this TV channel is browsable or not. @@ -391,7 +467,7 @@ public final class TvContract { * Type: INTEGER (boolean) * */ - public static final String BROWSABLE = "browsable"; + public static final String COLUMN_BROWSABLE = "browsable"; /** * Generic data used by individual TV input services. @@ -399,7 +475,7 @@ public final class TvContract { * Type: BLOB * */ - public static final String DATA = "data"; + public static final String COLUMN_DATA = "data"; /** @@ -413,7 +489,7 @@ public final class TvContract { * Type: INTEGER * */ - public static final String VERSION_NUMBER = "version_number"; + public static final String COLUMN_VERSION_NUMBER = "version_number"; private Channels() {} } @@ -441,7 +517,7 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String CHANNEL_ID = "channel_id"; + public static final String COLUMN_CHANNEL_ID = "channel_id"; /** * The title of this TV program. @@ -449,7 +525,7 @@ public final class TvContract { * Type: TEXT * **/ - public static final String TITLE = "title"; + public static final String COLUMN_TITLE = "title"; /** * The start time of this TV program, in milliseconds since the epoch. @@ -457,7 +533,7 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String START_TIME_UTC_MILLIS = "start_time_utc_millis"; + 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. @@ -465,7 +541,7 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String END_TIME_UTC_MILLIS = "end_time_utc_millis"; + public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis"; /** * The description of this TV program that is displayed to the user by default. @@ -475,19 +551,19 @@ public final class TvContract { * Type: TEXT * */ - public static final String DESCRIPTION = "description"; + public static final String COLUMN_DESCRIPTION = "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 #DESCRIPTION}. + * details beyond {@link #COLUMN_DESCRIPTION}. *
* Type: TEXT *
*/ - public static final String LONG_DESCRIPTION = "long_description"; + public static final String COLUMN_LONG_DESCRIPTION = "long_description"; /** * Generic data used by TV input services. @@ -495,7 +571,7 @@ public final class TvContract { * Type: BLOB * */ - public static final String DATA = "data"; + public static final String COLUMN_DATA = "data"; /** * The version number of this row entry used by TV input services. @@ -508,7 +584,7 @@ public final class TvContract { * Type: INTEGER * */ - public static final String VERSION_NUMBER = "version_number"; + public static final String COLUMN_VERSION_NUMBER = "version_number"; private Programs() {} } @@ -540,7 +616,8 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String WATCH_START_TIME_UTC_MILLIS = "watch_start_time_utc_millis"; + 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 @@ -549,7 +626,7 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String WATCH_END_TIME_UTC_MILLIS = "watch_end_time_utc_millis"; + public static final String COLUMN_WATCH_END_TIME_UTC_MILLIS = "watch_end_time_utc_millis"; /** * The channel ID that contains this TV program. @@ -557,7 +634,7 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String CHANNEL_ID = "channel_id"; + public static final String COLUMN_CHANNEL_ID = "channel_id"; /** * The title of this TV program. @@ -565,7 +642,7 @@ public final class TvContract { * Type: TEXT * */ - public static final String TITLE = "title"; + public static final String COLUMN_TITLE = "title"; /** * The start time of this TV program, in milliseconds since the epoch. @@ -573,7 +650,7 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String START_TIME_UTC_MILLIS = "start_time_utc_millis"; + 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. @@ -581,7 +658,7 @@ public final class TvContract { * Type: INTEGER (long) * */ - public static final String END_TIME_UTC_MILLIS = "end_time_utc_millis"; + public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis"; /** * The description of this TV program. @@ -589,7 +666,7 @@ public final class TvContract { * Type: TEXT * */ - public static final String DESCRIPTION = "description"; + public static final String COLUMN_DESCRIPTION = "description"; private WatchedPrograms() {} } diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java index 05f99475a4953..8ad7fffff6652 100644 --- a/services/core/java/com/android/server/tv/TvInputManagerService.java +++ b/services/core/java/com/android/server/tv/TvInputManagerService.java @@ -648,10 +648,10 @@ public final class TvInputManagerService extends SystemService { // Create a log entry and fill it later. ContentValues values = new ContentValues(); - values.put(TvContract.WatchedPrograms.WATCH_START_TIME_UTC_MILLIS, + values.put(TvContract.WatchedPrograms.COLUMN_WATCH_START_TIME_UTC_MILLIS, currentTime); - values.put(TvContract.WatchedPrograms.WATCH_END_TIME_UTC_MILLIS, 0); - values.put(TvContract.WatchedPrograms.CHANNEL_ID, channelId); + values.put(TvContract.WatchedPrograms.COLUMN_WATCH_END_TIME_UTC_MILLIS, 0); + values.put(TvContract.WatchedPrograms.COLUMN_CHANNEL_ID, channelId); sessionState.mLogUri = mContentResolver.insert( TvContract.WatchedPrograms.CONTENT_URI, values); @@ -944,31 +944,32 @@ public final class TvInputManagerService extends SystemService { private void onOpenEntry(Uri uri, long channelId, long watchStarttime) { String[] projection = { - TvContract.Programs.TITLE, - TvContract.Programs.START_TIME_UTC_MILLIS, - TvContract.Programs.END_TIME_UTC_MILLIS, - TvContract.Programs.DESCRIPTION + TvContract.Programs.COLUMN_TITLE, + TvContract.Programs.COLUMN_START_TIME_UTC_MILLIS, + TvContract.Programs.COLUMN_END_TIME_UTC_MILLIS, + TvContract.Programs.COLUMN_DESCRIPTION }; - String selection = TvContract.Programs.CHANNEL_ID + "=? AND " - + TvContract.Programs.START_TIME_UTC_MILLIS + "<=? AND " - + TvContract.Programs.END_TIME_UTC_MILLIS + ">?"; + String selection = TvContract.Programs.COLUMN_CHANNEL_ID + "=? AND " + + TvContract.Programs.COLUMN_START_TIME_UTC_MILLIS + "<=? AND " + + TvContract.Programs.COLUMN_END_TIME_UTC_MILLIS + ">?"; String[] selectionArgs = { String.valueOf(channelId), String.valueOf(watchStarttime), String.valueOf(watchStarttime) }; - String sortOrder = TvContract.Programs.START_TIME_UTC_MILLIS + " ASC"; + String sortOrder = TvContract.Programs.COLUMN_START_TIME_UTC_MILLIS + " ASC"; Cursor cursor = null; try { cursor = mContentResolver.query(TvContract.Programs.CONTENT_URI, projection, selection, selectionArgs, sortOrder); if (cursor != null && cursor.moveToNext()) { ContentValues values = new ContentValues(); - values.put(TvContract.WatchedPrograms.TITLE, cursor.getString(0)); - values.put(TvContract.WatchedPrograms.START_TIME_UTC_MILLIS, cursor.getLong(1)); + values.put(TvContract.WatchedPrograms.COLUMN_TITLE, cursor.getString(0)); + values.put(TvContract.WatchedPrograms.COLUMN_START_TIME_UTC_MILLIS, + cursor.getLong(1)); long endTime = cursor.getLong(2); - values.put(TvContract.WatchedPrograms.END_TIME_UTC_MILLIS, endTime); - values.put(TvContract.WatchedPrograms.DESCRIPTION, cursor.getString(3)); + values.put(TvContract.WatchedPrograms.COLUMN_END_TIME_UTC_MILLIS, endTime); + values.put(TvContract.WatchedPrograms.COLUMN_DESCRIPTION, cursor.getString(3)); mContentResolver.update(uri, values, null, null); // Schedule an update when the current program ends. @@ -988,12 +989,12 @@ public final class TvInputManagerService extends SystemService { private void onUpdateEntry(Uri uri, long channelId, long time) { String[] projection = { - TvContract.WatchedPrograms.WATCH_START_TIME_UTC_MILLIS, - TvContract.WatchedPrograms.WATCH_END_TIME_UTC_MILLIS, - TvContract.WatchedPrograms.TITLE, - TvContract.WatchedPrograms.START_TIME_UTC_MILLIS, - TvContract.WatchedPrograms.END_TIME_UTC_MILLIS, - TvContract.WatchedPrograms.DESCRIPTION + TvContract.WatchedPrograms.COLUMN_WATCH_START_TIME_UTC_MILLIS, + TvContract.WatchedPrograms.COLUMN_WATCH_END_TIME_UTC_MILLIS, + TvContract.WatchedPrograms.COLUMN_TITLE, + TvContract.WatchedPrograms.COLUMN_START_TIME_UTC_MILLIS, + TvContract.WatchedPrograms.COLUMN_END_TIME_UTC_MILLIS, + TvContract.WatchedPrograms.COLUMN_DESCRIPTION }; Cursor cursor = null; try { @@ -1014,14 +1015,14 @@ public final class TvInputManagerService extends SystemService { // The current program has just ended. Create a (complete) log entry off the // current entry. ContentValues values = new ContentValues(); - values.put(TvContract.WatchedPrograms.WATCH_START_TIME_UTC_MILLIS, + values.put(TvContract.WatchedPrograms.COLUMN_WATCH_START_TIME_UTC_MILLIS, watchStartTime); - values.put(TvContract.WatchedPrograms.WATCH_END_TIME_UTC_MILLIS, time); - values.put(TvContract.WatchedPrograms.CHANNEL_ID, channelId); - values.put(TvContract.WatchedPrograms.TITLE, title); - values.put(TvContract.WatchedPrograms.START_TIME_UTC_MILLIS, startTime); - values.put(TvContract.WatchedPrograms.END_TIME_UTC_MILLIS, endTime); - values.put(TvContract.WatchedPrograms.DESCRIPTION, description); + values.put(TvContract.WatchedPrograms.COLUMN_WATCH_END_TIME_UTC_MILLIS, time); + values.put(TvContract.WatchedPrograms.COLUMN_CHANNEL_ID, channelId); + values.put(TvContract.WatchedPrograms.COLUMN_TITLE, title); + values.put(TvContract.WatchedPrograms.COLUMN_START_TIME_UTC_MILLIS, startTime); + values.put(TvContract.WatchedPrograms.COLUMN_END_TIME_UTC_MILLIS, endTime); + values.put(TvContract.WatchedPrograms.COLUMN_DESCRIPTION, description); mContentResolver.insert(TvContract.WatchedPrograms.CONTENT_URI, values); } } finally { @@ -1035,7 +1036,7 @@ public final class TvInputManagerService extends SystemService { private void onCloseEntry(Uri uri, long watchEndTime) { ContentValues values = new ContentValues(); - values.put(TvContract.WatchedPrograms.WATCH_END_TIME_UTC_MILLIS, watchEndTime); + values.put(TvContract.WatchedPrograms.COLUMN_WATCH_END_TIME_UTC_MILLIS, watchEndTime); mContentResolver.update(uri, values, null, null); } }