Skip to content

Commit 7eb75df

Browse files
author
Jae Seo
committed
TIF: Move watch history logging to TvProvider
There are only two kinds of watch events that can happen on the system: 1. The current TV input session is tuned to a new channel. 2. The session is released for some reason. The former indicates the end of the previous log entry, if any, followed by the start of a new entry. The latter indicates the end of the most recent entry for the given session. Here the system supplies the database the smallest set of information only that is sufficient to consolidate the log entries while minimizing database operations in the system service. Bug: 14791151, Bug: 15921205, Bug: 15988715, Bug: 16831555 Change-Id: Ifcb1a1273c14ee234919d819d082b1004eb92ebc
1 parent 97f5504 commit 7eb75df

2 files changed

Lines changed: 107 additions & 243 deletions

File tree

media/java/android/media/tv/TvContract.java

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.content.ContentResolver;
2222
import android.content.ContentUris;
2323
import android.net.Uri;
24+
import android.os.IBinder;
2425
import android.provider.BaseColumns;
2526
import android.util.ArraySet;
2627

@@ -795,7 +796,7 @@ public static final class Programs implements BaseTvColumns {
795796
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/program";
796797

797798
/**
798-
* The ID of the TV channel that contains this TV program.
799+
* The ID of the TV channel that provides this TV program.
799800
* <p>
800801
* This is a part of the channel URI and matches to {@link BaseColumns#_ID}.
801802
* </p><p>
@@ -1109,6 +1110,7 @@ public static boolean isCanonical(String genre) {
11091110
* to this table.
11101111
* @hide
11111112
*/
1113+
@SystemApi
11121114
public static final class WatchedPrograms implements BaseTvColumns {
11131115

11141116
/** The content:// style URI for this table. */
@@ -1141,7 +1143,7 @@ public static final class WatchedPrograms implements BaseTvColumns {
11411143
public static final String COLUMN_WATCH_END_TIME_UTC_MILLIS = "watch_end_time_utc_millis";
11421144

11431145
/**
1144-
* The channel ID that contains this TV program.
1146+
* The ID of the TV channel that provides this TV program.
11451147
* <p>
11461148
* Type: INTEGER (long)
11471149
* </p>
@@ -1181,17 +1183,30 @@ public static final class WatchedPrograms implements BaseTvColumns {
11811183
public static final String COLUMN_DESCRIPTION = "description";
11821184

11831185
/**
1184-
* Extra parameters of the tune operation.
1186+
* Extra parameters given to {@link TvInputService.Session#tune(Uri, android.os.Bundle)
1187+
* TvInputService.Session.tune(Uri, android.os.Bundle)} when tuning to the channel that
1188+
* provides this TV program. (Used internally.)
1189+
* <p>
1190+
* This column contains an encoded string that represents comma-separated key-value pairs of
1191+
* the tune parameters. (Ex. "[key1]=[value1], [key2]=[value2]"). '%' is used as an escape
1192+
* character for '%', '=', and ','.
1193+
* </p><p>
1194+
* Type: TEXT
1195+
* </p>
1196+
*/
1197+
public static final String COLUMN_INTERNAL_TUNE_PARAMS = "tune_params";
1198+
1199+
/**
1200+
* The session token of this TV program. (Used internally.)
11851201
* <p>
1186-
* This column contains an encoded string which is comma-separated key-value pairs.
1187-
* (Ex. "[key1]=[value1], [key2]=[value2]"). COLUMN_TUNE_PARAMS will use '%' as an escape
1188-
* character for the characters of '%', '=', and ','.
1202+
* This contains a String representation of {@link IBinder} for
1203+
* {@link TvInputService.Session} that provides the current TV program. It is used
1204+
* internally to distinguish watched programs entries from different TV input sessions.
11891205
* </p><p>
11901206
* Type: TEXT
11911207
* </p>
1192-
* @see TvInputManager.Session.tune(Uri, Bundle)
11931208
*/
1194-
public static final String COLUMN_TUNE_PARAMS = "tune_params";
1209+
public static final String COLUMN_INTERNAL_SESSION_TOKEN = "session_token";
11951210

11961211
private WatchedPrograms() {}
11971212
}

0 commit comments

Comments
 (0)