summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jae Seo <jaeseo@google.com> 2014-06-13 11:09:09 -0700
committer Jae Seo <jaeseo@google.com> 2014-06-16 17:55:32 -0700
commitcf9bec5bb6abfe134332d5004c1fee90901da62c (patch)
treed8ccc8ca5222b3fba0c32533dea83a5cccd3cdad
parent6b2df21ecacfa6826a85cabdf8d6fe0e81fe11d9 (diff)
TvContract: Enable building programs URI also with channel ID
Bug: 15446137 Change-Id: I322c1b90c272e553b028af1f9011feecde124915
-rw-r--r--api/current.txt2
-rw-r--r--media/java/android/media/tv/TvContract.java39
2 files changed, 35 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt
index 2f813aca8286..c74c6c5372d2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -15791,7 +15791,9 @@ package android.media.tv {
method public static final android.net.Uri buildChannelsUriForInput(android.content.ComponentName);
method public static final android.net.Uri buildChannelsUriForInput(android.content.ComponentName, boolean);
method public static final android.net.Uri buildProgramUri(long);
+ method public static final android.net.Uri buildProgramsUriForChannel(long);
method public static final android.net.Uri buildProgramsUriForChannel(android.net.Uri);
+ method public static final android.net.Uri buildProgramsUriForChannel(long, long, long);
method public static final android.net.Uri buildProgramsUriForChannel(android.net.Uri, long, long);
field public static final java.lang.String AUTHORITY = "android.media.tv";
}
diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java
index 7ff2c2ea8060..3f0405d78a9e 100644
--- a/media/java/android/media/tv/TvContract.java
+++ b/media/java/android/media/tv/TvContract.java
@@ -144,35 +144,62 @@ public final class TvContract {
/**
* Builds a URI that points to all programs on a given channel.
*
+ * @param channelId The ID of the channel to return programs for.
+ */
+ public static final Uri buildProgramsUriForChannel(long channelId) {
+ return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY)
+ .appendPath(PATH_CHANNEL).appendPath(String.valueOf(channelId))
+ .appendPath(PATH_PROGRAM).build();
+ }
+
+ /**
+ * Builds a URI that points to all programs on a given channel.
+ *
* @param channelUri The URI of the channel to return programs for.
*/
public static final Uri buildProgramsUriForChannel(Uri channelUri) {
if (!PATH_CHANNEL.equals(channelUri.getPathSegments().get(0))) {
throw new IllegalArgumentException("Not a channel: " + channelUri);
}
- String channelId = String.valueOf(ContentUris.parseId(channelUri));
- return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY)
- .appendPath(PATH_CHANNEL).appendPath(channelId).appendPath(PATH_PROGRAM).build();
+ return buildProgramsUriForChannel(ContentUris.parseId(channelUri));
}
/**
* Builds a URI that points to programs on a specific channel whose schedules overlap with the
* given time frame.
*
- * @param channelUri The URI of the channel to return programs for.
+ * @param channelId The ID of the channel to return programs for.
* @param 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 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.
*/
- public static final Uri buildProgramsUriForChannel(Uri channelUri, long startTime,
+ public static final Uri buildProgramsUriForChannel(long channelId, long startTime,
long endTime) {
- Uri uri = buildProgramsUriForChannel(channelUri);
+ Uri uri = buildProgramsUriForChannel(channelId);
return uri.buildUpon().appendQueryParameter(PARAM_START_TIME, String.valueOf(startTime))
.appendQueryParameter(PARAM_END_TIME, String.valueOf(endTime)).build();
}
/**
+ * Builds a URI that points to programs on a specific channel whose schedules overlap with the
+ * given time frame.
+ *
+ * @param channelUri The URI of the channel to return programs for.
+ * @param 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 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.
+ */
+ public static final Uri buildProgramsUriForChannel(Uri channelUri, long startTime,
+ long endTime) {
+ if (!PATH_CHANNEL.equals(channelUri.getPathSegments().get(0))) {
+ throw new IllegalArgumentException("Not a channel: " + channelUri);
+ }
+ return buildProgramsUriForChannel(ContentUris.parseId(channelUri), startTime, endTime);
+ }
+
+ /**
* Builds a URI that points to a specific program the user watched.
*
* @param watchedProgramId The ID of the watched program to point to.