1 /* 2 * Copyright (C) 2015 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; 18 19 import android.content.Context; 20 import com.android.tv.analytics.Analytics; 21 import com.android.tv.analytics.Tracker; 22 import com.android.tv.common.BaseApplication; 23 import com.android.tv.common.BaseSingletons; 24 import com.android.tv.common.experiments.ExperimentLoader; 25 import com.android.tv.data.ChannelDataManager; 26 import com.android.tv.data.PreviewDataManager; 27 import com.android.tv.data.ProgramDataManager; 28 import com.android.tv.data.epg.EpgFetcher; 29 import com.android.tv.data.epg.EpgReader; 30 import com.android.tv.dvr.DvrDataManager; 31 import com.android.tv.dvr.DvrManager; 32 import com.android.tv.dvr.DvrScheduleManager; 33 import com.android.tv.dvr.DvrWatchedPositionManager; 34 import com.android.tv.dvr.recorder.RecordingScheduler; 35 import com.android.tv.perf.PerformanceMonitor; 36 import com.android.tv.tuner.TunerInputController; 37 import com.android.tv.util.SetupUtils; 38 import com.android.tv.util.TvInputManagerHelper; 39 import com.android.tv.util.account.AccountHelper; 40 import java.util.concurrent.Executor; 41 import javax.inject.Provider; 42 43 /** Interface with getters for application scoped singletons. */ 44 public interface TvSingletons extends BaseSingletons { 45 46 /** Returns the @{@link TvSingletons} using the application context. */ getSingletons(Context context)47 static TvSingletons getSingletons(Context context) { 48 return (TvSingletons) BaseApplication.getSingletons(context); 49 } 50 getAnalytics()51 Analytics getAnalytics(); 52 handleInputCountChanged()53 void handleInputCountChanged(); 54 getChannelDataManager()55 ChannelDataManager getChannelDataManager(); 56 57 /** 58 * Checks if the {@link ChannelDataManager} instance has been created and all the channels has 59 * been loaded. 60 */ isChannelDataManagerLoadFinished()61 boolean isChannelDataManagerLoadFinished(); 62 getProgramDataManager()63 ProgramDataManager getProgramDataManager(); 64 65 /** 66 * Checks if the {@link ProgramDataManager} instance has been created and the current programs 67 * for all the channels has been loaded. 68 */ isProgramDataManagerCurrentProgramsLoadFinished()69 boolean isProgramDataManagerCurrentProgramsLoadFinished(); 70 getPreviewDataManager()71 PreviewDataManager getPreviewDataManager(); 72 getDvrDataManager()73 DvrDataManager getDvrDataManager(); 74 getDvrScheduleManager()75 DvrScheduleManager getDvrScheduleManager(); 76 getDvrManager()77 DvrManager getDvrManager(); 78 getRecordingScheduler()79 RecordingScheduler getRecordingScheduler(); 80 getDvrWatchedPositionManager()81 DvrWatchedPositionManager getDvrWatchedPositionManager(); 82 getInputSessionManager()83 InputSessionManager getInputSessionManager(); 84 getTracker()85 Tracker getTracker(); 86 getMainActivityWrapper()87 MainActivityWrapper getMainActivityWrapper(); 88 getAccountHelper()89 AccountHelper getAccountHelper(); 90 isRunningInMainProcess()91 boolean isRunningInMainProcess(); 92 getPerformanceMonitor()93 PerformanceMonitor getPerformanceMonitor(); 94 getTvInputManagerHelper()95 TvInputManagerHelper getTvInputManagerHelper(); 96 providesEpgReader()97 Provider<EpgReader> providesEpgReader(); 98 getEpgFetcher()99 EpgFetcher getEpgFetcher(); 100 getSetupUtils()101 SetupUtils getSetupUtils(); 102 getTunerInputController()103 TunerInputController getTunerInputController(); 104 getExperimentLoader()105 ExperimentLoader getExperimentLoader(); 106 getDbExecutor()107 Executor getDbExecutor(); 108 } 109