aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tv/SetupPassthroughActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/tv/SetupPassthroughActivity.java')
-rw-r--r--src/com/android/tv/SetupPassthroughActivity.java51
1 files changed, 17 insertions, 34 deletions
diff --git a/src/com/android/tv/SetupPassthroughActivity.java b/src/com/android/tv/SetupPassthroughActivity.java
index 40d38118..d1158682 100644
--- a/src/com/android/tv/SetupPassthroughActivity.java
+++ b/src/com/android/tv/SetupPassthroughActivity.java
@@ -26,14 +26,12 @@ 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.experiments.Experiments;
+import com.android.tv.common.TvCommonConstants;
import com.android.tv.data.ChannelDataManager;
import com.android.tv.data.ChannelDataManager.Listener;
import com.android.tv.data.epg.EpgFetcher;
-import com.android.tv.data.epg.EpgInputWhiteList;
-
+import com.android.tv.experiments.Experiments;
import com.android.tv.util.SetupUtils;
import com.android.tv.util.TvInputManagerHelper;
import com.android.tv.util.Utils;
@@ -55,47 +53,35 @@ public class SetupPassthroughActivity extends Activity {
private TvInputInfo mTvInputInfo;
private Intent mActivityAfterCompletion;
private boolean mEpgFetcherDuringScan;
- private EpgInputWhiteList mEpgInputWhiteList;
@Override
public void onCreate(Bundle savedInstanceState) {
if (DEBUG) Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
- TvSingletons tvSingletons = TvSingletons.getSingletons(this);
- TvInputManagerHelper inputManager = tvSingletons.getTvInputManagerHelper();
+ ApplicationSingletons appSingletons = TvApplication.getSingletons(this);
+ TvInputManagerHelper inputManager = appSingletons.getTvInputManagerHelper();
Intent intent = getIntent();
- String inputId = intent.getStringExtra(CommonConstants.EXTRA_INPUT_ID);
+ String inputId = intent.getStringExtra(TvCommonConstants.EXTRA_INPUT_ID);
mTvInputInfo = inputManager.getTvInputInfo(inputId);
- mEpgInputWhiteList = new EpgInputWhiteList(tvSingletons.getRemoteConfig());
mActivityAfterCompletion =
- intent.getParcelableExtra(CommonConstants.EXTRA_ACTIVITY_AFTER_COMPLETION);
+ intent.getParcelableExtra(TvCommonConstants.EXTRA_ACTIVITY_AFTER_COMPLETION);
boolean needToFetchEpg =
- mTvInputInfo != null
- && Utils.isInternalTvInput(this, mTvInputInfo.getId())
- && Experiments.CLOUD_EPG.get();
+ Utils.isInternalTvInput(this, mTvInputInfo.getId()) && Experiments.CLOUD_EPG.get();
if (needToFetchEpg) {
// In case when the activity is restored, this flag should be restored as well.
mEpgFetcherDuringScan = true;
}
if (savedInstanceState == null) {
- SoftPreconditions.checkArgument(
- CommonConstants.INTENT_ACTION_INPUT_SETUP.equals(intent.getAction()),
- TAG,
- "Unsupported action %s",
- intent.getAction());
+ SoftPreconditions.checkState(
+ intent.getAction().equals(TvCommonConstants.INTENT_ACTION_INPUT_SETUP));
if (DEBUG) Log.d(TAG, "TvInputId " + inputId + " / TvInputInfo " + mTvInputInfo);
if (mTvInputInfo == null) {
Log.w(TAG, "There is no input with the ID " + inputId + ".");
finish();
return;
}
- if (intent.getExtras() == null) {
- Log.w(TAG, "There is no extra info in the intent");
- finish();
- return;
- }
Intent setupIntent =
- intent.getExtras().getParcelable(CommonConstants.EXTRA_SETUP_INTENT);
+ intent.getExtras().getParcelable(TvCommonConstants.EXTRA_SETUP_INTENT);
if (DEBUG) Log.d(TAG, "Setup activity launch intent: " + setupIntent);
if (setupIntent == null) {
Log.w(TAG, "The input (" + mTvInputInfo.getId() + ") doesn't have setup.");
@@ -107,7 +93,7 @@ public class SetupPassthroughActivity extends Activity {
// If EXTRA_SETUP_INTENT is not removed, an infinite recursion happens during
// setupIntent.putExtras(intent.getExtras()).
Bundle extras = intent.getExtras();
- extras.remove(CommonConstants.EXTRA_SETUP_INTENT);
+ extras.remove(TvCommonConstants.EXTRA_SETUP_INTENT);
setupIntent.putExtras(extras);
try {
startActivityForResult(setupIntent, REQUEST_START_SETUP_ACTIVITY);
@@ -121,15 +107,14 @@ public class SetupPassthroughActivity extends Activity {
sScanTimeoutMonitor = new ScanTimeoutMonitor(this);
}
sScanTimeoutMonitor.startMonitoring();
- TvSingletons.getSingletons(this).getEpgFetcher().onChannelScanStarted();
+ EpgFetcher.getInstance(this).onChannelScanStarted();
}
}
}
@Override
public void onActivityResult(int requestCode, final int resultCode, final Intent data) {
- if (DEBUG)
- Log.d(TAG, "onActivityResult(" + requestCode + ", " + resultCode + ", " + data + ")");
+ if (DEBUG) Log.d(TAG, "onActivityResult");
if (sScanTimeoutMonitor != null) {
sScanTimeoutMonitor.stopMonitoring();
}
@@ -137,17 +122,15 @@ 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();
+ EpgFetcher.getInstance(this).onChannelScanFinished();
}
if (!setupComplete) {
setResult(resultCode, data);
finish();
return;
}
- TvSingletons.getSingletons(this)
- .getSetupUtils()
+ SetupUtils.getInstance(this)
.onTvInputSetupFinished(
mTvInputInfo.getId(),
new Runnable() {
@@ -209,7 +192,7 @@ public class SetupPassthroughActivity extends Activity {
private ScanTimeoutMonitor(Context context) {
mContext = context.getApplicationContext();
- mChannelDataManager = TvSingletons.getSingletons(context).getChannelDataManager();
+ mChannelDataManager = TvApplication.getSingletons(context).getChannelDataManager();
}
private void startMonitoring() {
@@ -237,7 +220,7 @@ public class SetupPassthroughActivity extends Activity {
private void onScanTimedOut() {
stopMonitoring();
- TvSingletons.getSingletons(mContext).getEpgFetcher().onChannelScanFinished();
+ EpgFetcher.getInstance(mContext).onChannelScanFinished();
}
}
}