Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16a95459 authored by Jae Seo's avatar Jae Seo Committed by Android (Google) Code Review
Browse files

Merge "TvContract: Enable building programs URI also with channel ID"

parents d9e98439 cf9bec5b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15795,7 +15795,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";
  }
+33 −6
Original line number Diff line number Diff line
@@ -141,6 +141,17 @@ public final class TvContract {
        return ContentUris.withAppendedId(Programs.CONTENT_URI, programId);
    }

    /**
     * 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.
     *
@@ -150,28 +161,44 @@ public final class TvContract {
        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.
     *