• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.tv.data.epg;
18 
19 import android.app.job.JobParameters;
20 import android.app.job.JobScheduler;
21 import android.app.job.JobService;
22 import android.support.annotation.MainThread;
23 
24 /** Fetch EPG routinely or on-demand during channel scanning */
25 public interface EpgFetcher {
26 
27     /**
28      * Starts the routine service of EPG fetching. It use {@link JobScheduler} to schedule the EPG
29      * fetching routine. The EPG fetching routine will be started roughly every 4 hours, unless the
30      * channel scanning of tuner input is started.
31      */
32     @MainThread
startRoutineService()33     void startRoutineService();
34 
35     /**
36      * Fetches EPG immediately if current EPG data are out-dated, i.e., not successfully updated by
37      * routine fetching service due to various reasons.
38      */
39     @MainThread
fetchImmediatelyIfNeeded()40     void fetchImmediatelyIfNeeded();
41 
42     /** Fetches EPG immediately. */
43     @MainThread
fetchImmediately()44     void fetchImmediately();
45 
46     /** Notifies EPG fetch service that channel scanning is started. */
47     @MainThread
onChannelScanStarted()48     void onChannelScanStarted();
49 
50     /** Notifies EPG fetch service that channel scanning is finished. */
51     @MainThread
onChannelScanFinished()52     void onChannelScanFinished();
53 
54     @MainThread
executeFetchTaskIfPossible(JobService jobService, JobParameters params)55     boolean executeFetchTaskIfPossible(JobService jobService, JobParameters params);
56 
57     @MainThread
stopFetchingJob()58     void stopFetchingJob();
59 }
60