diff options
Diffstat (limited to 'src/com/android/tv/SetupPassthroughActivity.java')
-rw-r--r-- | src/com/android/tv/SetupPassthroughActivity.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/com/android/tv/SetupPassthroughActivity.java b/src/com/android/tv/SetupPassthroughActivity.java index 806bb142..25049f1d 100644 --- a/src/com/android/tv/SetupPassthroughActivity.java +++ b/src/com/android/tv/SetupPassthroughActivity.java @@ -19,7 +19,6 @@ package com.android.tv; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.ComponentName; -import android.content.Context; import android.content.Intent; import android.media.tv.TvInputInfo; import android.os.Bundle; @@ -27,6 +26,7 @@ import android.os.Handler; import android.os.Looper; import android.support.annotation.MainThread; import android.util.Log; + import com.android.tv.common.CommonConstants; import com.android.tv.common.SoftPreconditions; import com.android.tv.common.actions.InputSetupActionUtils; @@ -38,10 +38,14 @@ import com.android.tv.features.TvFeatures; import com.android.tv.util.SetupUtils; import com.android.tv.util.TvInputManagerHelper; import com.android.tv.util.Utils; + import com.google.android.tv.partner.support.EpgContract; + import dagger.android.AndroidInjection; import dagger.android.ContributesAndroidInjector; + import java.util.concurrent.TimeUnit; + import javax.inject.Inject; /** @@ -64,6 +68,7 @@ public class SetupPassthroughActivity extends Activity { @Inject TvInputManagerHelper mInputManager; @Inject SetupUtils mSetupUtils; @Inject ChannelDataManager mChannelDataManager; + @Inject EpgFetcher mEpgFetcher; @Override public void onCreate(Bundle savedInstanceState) { @@ -131,10 +136,10 @@ public class SetupPassthroughActivity extends Activity { } if (needToFetchEpg) { if (sScanTimeoutMonitor == null) { - sScanTimeoutMonitor = new ScanTimeoutMonitor(this, mChannelDataManager); + sScanTimeoutMonitor = new ScanTimeoutMonitor(mEpgFetcher, mChannelDataManager); } sScanTimeoutMonitor.startMonitoring(); - TvSingletons.getSingletons(this).getEpgFetcher().onChannelScanStarted(); + mEpgFetcher.onChannelScanStarted(); } } } @@ -150,9 +155,9 @@ public class SetupPassthroughActivity extends Activity { boolean setupComplete = requestCode == REQUEST_START_SETUP_ACTIVITY && resultCode == Activity.RESULT_OK; // Tells EpgFetcher that channel source setup is finished. - EpgFetcher epgFetcher = TvSingletons.getSingletons(this).getEpgFetcher(); + if (mEpgFetcherDuringScan) { - epgFetcher.onChannelScanFinished(); + mEpgFetcher.onChannelScanFinished(); } if (!setupComplete) { setResult(resultCode, data); @@ -165,7 +170,7 @@ public class SetupPassthroughActivity extends Activity { if (DEBUG) Log.d(TAG, "extra " + data.getExtras()); String inputId = data.getStringExtra(TvInputInfo.EXTRA_INPUT_ID); if (mEpgInputWhiteList.isInputWhiteListed(inputId)) { - epgFetcher.fetchImmediately(); + mEpgFetcher.fetchImmediately(); } } @@ -204,7 +209,7 @@ public class SetupPassthroughActivity extends Activity { // Set timeout long enough. The message in Sony TV says the scanning takes about 30 minutes. private static final long SCAN_TIMEOUT_MS = TimeUnit.MINUTES.toMillis(30); - private final Context mContext; + private final EpgFetcher mEpgFetcher; private final ChannelDataManager mChannelDataManager; private final Handler mHandler = new Handler(Looper.getMainLooper()); private final Runnable mScanTimeoutRunnable = @@ -232,8 +237,8 @@ public class SetupPassthroughActivity extends Activity { }; private boolean mStarted; - private ScanTimeoutMonitor(Context context, ChannelDataManager mChannelDataManager) { - mContext = context.getApplicationContext(); + private ScanTimeoutMonitor(EpgFetcher epgFetcher, ChannelDataManager mChannelDataManager) { + mEpgFetcher = epgFetcher; this.mChannelDataManager = mChannelDataManager; } @@ -262,7 +267,7 @@ public class SetupPassthroughActivity extends Activity { private void onScanTimedOut() { stopMonitoring(); - TvSingletons.getSingletons(mContext).getEpgFetcher().onChannelScanFinished(); + mEpgFetcher.onChannelScanFinished(); } } |