aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Chalko <nchalko@google.com>2016-03-04 13:12:56 -0800
committerYoungsang Cho <youngsang@google.com>2016-03-04 21:20:51 +0000
commit0fc3bb1d772f623c187267c781642ba4846d047e (patch)
treebcfc89b2171ac887116f1c631c0847ce62642356
parentba5845f23b8fbc985890f892961abc8b39886611 (diff)
downloadTV-0fc3bb1d772f623c187267c781642ba4846d047e.tar.gz
Sync to ub-tv-intens at 4ef2591eb74883f8ae2ce15d4e89bec7da5320fc
Bug: 27219388 Change-Id: I50601d0e0f680f170829945689eef989308b02fa
-rw-r--r--common/res_leanback/layout/lb_onboarding_fragment.xml2
-rw-r--r--src/com/android/tv/MainActivity.java41
-rw-r--r--version.mk2
3 files changed, 34 insertions, 11 deletions
diff --git a/common/res_leanback/layout/lb_onboarding_fragment.xml b/common/res_leanback/layout/lb_onboarding_fragment.xml
index 61cb93bd..20489ed0 100644
--- a/common/res_leanback/layout/lb_onboarding_fragment.xml
+++ b/common/res_leanback/layout/lb_onboarding_fragment.xml
@@ -72,7 +72,7 @@
android:layout_centerHorizontal="true"
android:visibility="gone" />
- <com.google.android.tv.common.ui.setup.leanback.PagingIndicator
+ <com.android.tv.common.ui.setup.leanback.PagingIndicator
android:id="@id/page_indicator"
android:layout_width="@dimen/lb_onboarding_content_width"
android:layout_height="@dimen/lb_onboarding_navigation_height"
diff --git a/src/com/android/tv/MainActivity.java b/src/com/android/tv/MainActivity.java
index 5ea23a79..99bcb125 100644
--- a/src/com/android/tv/MainActivity.java
+++ b/src/com/android/tv/MainActivity.java
@@ -47,6 +47,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.os.PowerManager;
import android.provider.Settings;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
@@ -259,6 +260,7 @@ public class MainActivity extends Activity implements AudioManager.OnAudioFocusC
private Uri mInitChannelUri;
@Nullable
private String mParentInputIdWhenScreenOff;
+ private boolean mScreenOffIntentReceived;
private boolean mShowProgramGuide;
private boolean mShowSelectInputView;
private TvInputInfo mInputToSetUp;
@@ -331,15 +333,8 @@ public class MainActivity extends Activity implements AudioManager.OnAudioFocusC
// We need to stop TvView, when the screen is turned off. If not and TIS uses
// MediaPlayer, a device may not go to the sleep mode and audio can be heard,
// because MediaPlayer keeps playing media by its wake lock.
- mInitChannelUri = mChannelTuner.getCurrentChannelUri();
- if (mChannelTuner.isCurrentChannelPassthrough()) {
- // When ACTION_SCREEN_OFF is invoked, some CEC devices may be already
- // removed. So we need to get the input info from ChannelTuner instead of
- // TvInputManagerHelper.
- TvInputInfo input = mChannelTuner.getCurrentInputInfo();
- mParentInputIdWhenScreenOff = input.getParentId();
- if (DEBUG) Log.d(TAG, "Parent input: " + mParentInputIdWhenScreenOff);
- }
+ mScreenOffIntentReceived = true;
+ markCurrentChannelDuringScreenOff();
stopAll(true);
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
if (DEBUG) Log.d(TAG, "Received ACTION_SCREEN_ON");
@@ -703,6 +698,7 @@ public class MainActivity extends Activity implements AudioManager.OnAudioFocusC
protected void onStart() {
if (DEBUG) Log.d(TAG,"onStart()");
super.onStart();
+ mScreenOffIntentReceived = false;
mActivityStarted = true;
mTracker.sendMainStart();
mMainDurationTimer.start();
@@ -949,6 +945,18 @@ public class MainActivity extends Activity implements AudioManager.OnAudioFocusC
@Override
protected void onStop() {
if (DEBUG) Log.d(TAG, "onStop()");
+ if (mScreenOffIntentReceived) {
+ mScreenOffIntentReceived = false;
+ } else {
+ PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ if (!powerManager.isInteractive()) {
+ // We added to check isInteractive as well as SCREEN_OFF intent, because
+ // calling timing of the intent SCREEN_OFF is not consistent. b/25953633.
+ // If we verify that checking isInteractive is enough, we can remove the logic
+ // for SCREEN_OFF intent.
+ markCurrentChannelDuringScreenOff();
+ }
+ }
mActivityStarted = false;
stopAll(false);
unregisterReceiver(mBroadcastReceiver);
@@ -956,6 +964,21 @@ public class MainActivity extends Activity implements AudioManager.OnAudioFocusC
super.onStop();
}
+ /**
+ * Handles screen off to keep the current channel for next screen on.
+ */
+ private void markCurrentChannelDuringScreenOff() {
+ mInitChannelUri = mChannelTuner.getCurrentChannelUri();
+ if (mChannelTuner.isCurrentChannelPassthrough()) {
+ // When ACTION_SCREEN_OFF is invoked, some CEC devices may be already
+ // removed. So we need to get the input info from ChannelTuner instead of
+ // TvInputManagerHelper.
+ TvInputInfo input = mChannelTuner.getCurrentInputInfo();
+ mParentInputIdWhenScreenOff = input.getParentId();
+ if (DEBUG) Log.d(TAG, "Parent input: " + mParentInputIdWhenScreenOff);
+ }
+ }
+
private void stopAll(boolean keepVisibleBehind) {
mOverlayManager.hideOverlays(TvOverlayManager.FLAG_HIDE_OVERLAYS_WITHOUT_ANIMATION);
stopTv("stopAll()", keepVisibleBehind);
diff --git a/version.mk b/version.mk
index 55839297..70f4ec4c 100644
--- a/version.mk
+++ b/version.mk
@@ -58,7 +58,7 @@ code_version_major := $(shell echo $$(($(base_version_major)+3)))
git_commit_count := $(shell git --git-dir $(LOCAL_PATH)/.git rev-list --since=$(base_version_since) --all --count HEAD)
# x86 and arm sometimes don't match.
#code_version_build := $(shell printf "%03d" $(git_commit_count))
-code_version_build := 419
+code_version_build := 420
#####################################################
#####################################################
# Collect automatic version code parameters