aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tv/data/epg/EpgReader.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/tv/data/epg/EpgReader.java')
-rw-r--r--src/com/android/tv/data/epg/EpgReader.java46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/com/android/tv/data/epg/EpgReader.java b/src/com/android/tv/data/epg/EpgReader.java
index c5aeca27..7147905a 100644
--- a/src/com/android/tv/data/epg/EpgReader.java
+++ b/src/com/android/tv/data/epg/EpgReader.java
@@ -19,28 +19,37 @@ package com.android.tv.data.epg;
import android.support.annotation.AnyThread;
import android.support.annotation.NonNull;
import android.support.annotation.WorkerThread;
-
-import com.android.tv.data.Channel;
import com.android.tv.data.Lineup;
import com.android.tv.data.Program;
+import com.android.tv.data.api.Channel;
import com.android.tv.dvr.data.SeriesInfo;
-
+import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Set;
-/**
- * An interface used to retrieve the EPG data. This class should be used in worker thread.
- */
+/** An interface used to retrieve the EPG data. This class should be used in worker thread. */
@WorkerThread
public interface EpgReader {
- /**
- * Checks if the reader is available.
- */
+
+ /** Value class that holds a EpgChannelId and its corresponding {@link Channel} */
+ // TODO(b/72052568): Get autovalue to work in aosp master
+ abstract class EpgChannel {
+ public static EpgChannel createEpgChannel(Channel channel, String epgChannelId) {
+ return new AutoValue_EpgReader_EpgChannel(channel, epgChannelId);
+ }
+
+ public abstract Channel getChannel();
+
+ public abstract String getEpgChannelId();
+ }
+
+ /** Checks if the reader is available. */
boolean isAvailable();
/**
- * Returns the timestamp of the current EPG.
- * The format should be YYYYMMDDHHmmSS as a long value. ex) 20160308141500
+ * Returns the timestamp of the current EPG. The format should be YYYYMMDDHHmmSS as a long
+ * value. ex) 20160308141500
*/
long getEpgTimestamp();
@@ -61,31 +70,30 @@ public interface EpgReader {
* Returns the list of channels for the given lineup. The returned channels should map into the
* existing channels on the device. This method is usually called after selecting the lineup.
*/
- List<Channel> getChannels(@NonNull String lineupId);
+ Set<EpgChannel> getChannels(Set<Channel> inputChannels, @NonNull String lineupId);
/** Pre-loads and caches channels for a given lineup. */
void preloadChannels(@NonNull String lineupId);
- /**
- * Clears cached channels for a given lineup.
- */
+ /** Clears cached channels for a given lineup. */
@AnyThread
void clearCachedChannels(@NonNull String lineupId);
/**
- * Returns the programs for the given channel. Must call {@link #getChannels(String)}
+ * Returns the programs for the given channel. Must call {@link #getChannels(Set, String)}
* beforehand. Note that the {@code Program} doesn't have valid program ID because it's not
* retrieved from TvProvider.
*/
- List<Program> getPrograms(long channelId);
+ List<Program> getPrograms(EpgChannel epgChannel);
/**
* Returns the programs for the given channels. Note that the {@code Program} doesn't have valid
* program ID because it's not retrieved from TvProvider. This method is only used to get
* programs for a short duration typically.
*/
- Map<Long, List<Program>> getPrograms(@NonNull List<Long> channelIds, long duration);
+ Map<EpgChannel, Collection<Program>> getPrograms(
+ @NonNull Set<EpgChannel> epgChannels, long duration);
/** Returns the series information for the given series ID. */
SeriesInfo getSeriesInfo(@NonNull String seriesId);
-} \ No newline at end of file
+}