aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tv
diff options
context:
space:
mode:
authorJaewan Kim <jaewan@google.com>2014-05-21 07:55:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-21 07:55:22 +0000
commitae5f46e74d9f935ce25220c3ab05ff006eab5f57 (patch)
treefb0dda84135cf299291aebb160263dbc9dcba959 /src/com/android/tv
parent0ce13b9154c57fe8c44ea2a074824af9fcf3f3a9 (diff)
parentb518910bfbc2b436bc710449d507ab9fe708b799 (diff)
downloadTV-ae5f46e74d9f935ce25220c3ab05ff006eab5f57.tar.gz
Merge "Always show TV at the background from the Launcher"
Diffstat (limited to 'src/com/android/tv')
-rw-r--r--src/com/android/tv/TvActivity.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/tv/TvActivity.java b/src/com/android/tv/TvActivity.java
index 1c027716..f90a464d 100644
--- a/src/com/android/tv/TvActivity.java
+++ b/src/com/android/tv/TvActivity.java
@@ -540,8 +540,12 @@ public class TvActivity extends Activity implements
mTunePendding = false;
}
+ private boolean isPlaying() {
+ return mTvView.isPlaying() && mTvView.getCurrentChannelId() != Channel.INVALID_ID;
+ }
+
private void startPip() {
- if (!mTvView.isPlaying() || mTvView.getCurrentChannelId() == Channel.INVALID_ID) {
+ if (!isPlaying()) {
Log.w(TAG, "TV content should be playing");
return;
}
@@ -782,6 +786,20 @@ public class TvActivity extends Activity implements
}
@Override
+ public void onBackPressed() {
+ if (getFragmentManager().getBackStackEntryCount() <= 0 && isPlaying()) {
+ // If back key would exit TV app,
+ // show McLauncher instead so we can get benefit of McLauncher's shyMode.
+ Intent startMain = new Intent(Intent.ACTION_MAIN);
+ startMain.addCategory(Intent.CATEGORY_HOME);
+ startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(startMain);
+ } else {
+ super.onBackPressed();
+ }
+ }
+
+ @Override
public void onUserInteraction() {
super.onUserInteraction();
if (mMainMenuView.getVisibility() == View.VISIBLE) {