aboutsummaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/tv/MainActivity.java28
-rw-r--r--src/com/android/tv/TvApplication.java10
-rw-r--r--src/com/android/tv/data/ChannelDataManager.java16
-rw-r--r--src/com/android/tv/features/TvFeatures.java7
-rw-r--r--src/com/android/tv/onboarding/OnboardingActivity.java6
-rw-r--r--src/com/android/tv/onboarding/SetupSourcesFragment.java2
-rw-r--r--src/com/android/tv/ui/BlockScreenView.java15
-rw-r--r--src/com/android/tv/ui/EmptyInputStatusBlockView.java68
-rw-r--r--src/com/android/tv/ui/InputBannerView.java38
-rw-r--r--src/com/android/tv/ui/InputBannerViewBase.java69
-rw-r--r--src/com/android/tv/ui/InputBannerViewV2.java84
-rw-r--r--src/com/android/tv/ui/TunableTvView.java13
-rw-r--r--src/com/android/tv/ui/TvOverlayManager.java11
-rw-r--r--src/com/android/tv/ui/TvTransitionManager.java8
-rw-r--r--src/com/android/tv/util/SetupUtils.java16
15 files changed, 341 insertions, 50 deletions
diff --git a/src/com/android/tv/MainActivity.java b/src/com/android/tv/MainActivity.java
index cea293de..5b359483 100644
--- a/src/com/android/tv/MainActivity.java
+++ b/src/com/android/tv/MainActivity.java
@@ -134,7 +134,7 @@ import com.android.tv.search.ProgramGuideSearchFragment;
import com.android.tv.tunerinputcontroller.BuiltInTunerManager;
import com.android.tv.ui.ChannelBannerView;
import com.android.tv.ui.DetailsActivity;
-import com.android.tv.ui.InputBannerView;
+import com.android.tv.ui.InputBannerViewBase;
import com.android.tv.ui.KeypadChannelSwitchView;
import com.android.tv.ui.SelectInputView;
import com.android.tv.ui.SelectInputView.OnInputSelectedCallback;
@@ -455,7 +455,7 @@ public class MainActivity extends Activity
public void onLoadFinished() {
Debug.getTimer(Debug.TAG_START_UP_TIMER)
.log("MainActivity.mChannelTunerListener.onLoadFinished");
- mSetupUtils.markNewChannelsBrowsable();
+ mSetupUtils.markNewChannelsBrowsableIfEnabled();
if (mActivityResumed) {
resumeTvIfNeeded();
}
@@ -677,9 +677,13 @@ public class MainActivity extends Activity
(KeypadChannelSwitchView)
getLayoutInflater()
.inflate(R.layout.keypad_channel_switch, sceneContainer, false);
- InputBannerView inputBannerView =
- (InputBannerView)
- getLayoutInflater().inflate(R.layout.input_banner, sceneContainer, false);
+
+
+ boolean useV2 = TvFeatures.USE_GTV_LIVETV_V2.isEnabled(this);
+ int inputBannerLayoutId = useV2 ? R.layout.input_banner_v2 : R.layout.input_banner;
+ InputBannerViewBase inputBannerView =
+ (InputBannerViewBase)
+ getLayoutInflater().inflate(inputBannerLayoutId, sceneContainer, false);
SelectInputView selectInputView =
(SelectInputView)
getLayoutInflater().inflate(R.layout.select_input, sceneContainer, false);
@@ -922,7 +926,7 @@ public class MainActivity extends Activity
}
if (mChannelTuner.areAllChannelsLoaded()) {
- mSetupUtils.markNewChannelsBrowsable();
+ mSetupUtils.markNewChannelsBrowsableIfEnabled();
resumeTvIfNeeded();
}
mOverlayManager.showMenuWithTimeShiftPauseIfNeeded();
@@ -1094,7 +1098,10 @@ public class MainActivity extends Activity
}
if (channelUri == null) {
- mChannelTuner.moveToChannel(mChannelTuner.findNearestBrowsableChannel(0));
+ if (!mChannelTuner.moveToChannel(mChannelTuner.findNearestBrowsableChannel(0))) {
+ Log.w(TAG, "No browsable channel, show setup");
+ showSettingsFragment();
+ }
} else {
if (TvContract.isChannelUriForPassthroughInput(channelUri)) {
ChannelImpl channel = ChannelImpl.createPassthroughChannel(channelUri);
@@ -1103,13 +1110,17 @@ public class MainActivity extends Activity
long channelId = ContentUris.parseId(channelUri);
Channel channel = mChannelDataManager.getChannel(channelId);
if (channel == null || !mChannelTuner.moveToChannel(channel)) {
- mChannelTuner.moveToChannel(mChannelTuner.findNearestBrowsableChannel(0));
Log.w(
TAG,
"The requested channel (id="
+ channelId
+ ") doesn't exist. "
+ "The first channel will be tuned to.");
+ if (!mChannelTuner.moveToChannel(
+ mChannelTuner.findNearestBrowsableChannel(0))) {
+ Log.w(TAG, "No browsable channel, show setup");
+ showSettingsFragment();
+ }
}
}
}
@@ -2960,6 +2971,7 @@ public class MainActivity extends Activity
allowAutoSelectionOfTrack ? null : getSelectedTrack(TvTrackInfo.TYPE_AUDIO));
applyClosedCaption();
mOverlayManager.getMenu().onStreamInfoChanged();
+ mOverlayManager.updateInputBannerIfNeeded(info);
if (mTvView.isVideoAvailable()) {
mTvViewUiManager.fadeInTvView();
}
diff --git a/src/com/android/tv/TvApplication.java b/src/com/android/tv/TvApplication.java
index c5e4f32e..738759fc 100644
--- a/src/com/android/tv/TvApplication.java
+++ b/src/com/android/tv/TvApplication.java
@@ -409,9 +409,17 @@ public abstract class TvApplication extends BaseApplication implements TvSinglet
++inputCount;
}
}
- if (inputCount < 2) {
+
+ if (inputCount < 1) {
+ Log.w(TAG, "No available input to be selected.");
return;
}
+
+ if (mMainActivityWrapper.isResumed() && inputCount < 2) {
+ // if no other inputs can be switched to, keep in the same input
+ return;
+ }
+
Activity activityToHandle =
mMainActivityWrapper.isResumed()
? mMainActivityWrapper.getMainActivity()
diff --git a/src/com/android/tv/data/ChannelDataManager.java b/src/com/android/tv/data/ChannelDataManager.java
index 67c32309..fb7ab02a 100644
--- a/src/com/android/tv/data/ChannelDataManager.java
+++ b/src/com/android/tv/data/ChannelDataManager.java
@@ -301,6 +301,22 @@ public class ChannelDataManager {
}
/**
+ * Returns the total browsable channel count for a given input.
+ *
+ * @param inputId The ID of the input.
+ */
+ public int getBrowsableChannelCountForInput(String inputId) {
+ int count = 0;
+ for (Channel channel : mData.channels) {
+ if (channel.getInputId().equals(inputId) && channel.isBrowsable()) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+
+ /**
* Checks if the channel exists in DB.
*
* <p>Note that the channels of the removed inputs can not be obtained from {@link #getChannel}.
diff --git a/src/com/android/tv/features/TvFeatures.java b/src/com/android/tv/features/TvFeatures.java
index ebd7cb9a..c4e388a3 100644
--- a/src/com/android/tv/features/TvFeatures.java
+++ b/src/com/android/tv/features/TvFeatures.java
@@ -28,10 +28,13 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
+import androidx.core.R;
+
import com.android.tv.common.feature.CommonFeatures;
import com.android.tv.common.feature.Feature;
import com.android.tv.common.feature.FeatureUtils;
import com.android.tv.common.feature.FlagFeature;
+import com.android.tv.common.feature.ResourceConfigFeature;
import com.android.tv.common.feature.Sdk;
import com.android.tv.common.feature.TestableFeature;
import com.android.tv.common.flags.has.HasUiFlags;
@@ -104,5 +107,9 @@ public final class TvFeatures extends CommonFeatures {
/** Support for interactive applications using the TIAF **/
public static final Feature HAS_TIAF = Sdk.AT_LEAST_T;
+ /** Use new components that are consistent with other Google TV styles b/302992748 */
+ public static final Feature USE_GTV_LIVETV_V2 =
+ new ResourceConfigFeature(R.bool.use_gtv_livetv_v2, false);
+
private TvFeatures() {}
}
diff --git a/src/com/android/tv/onboarding/OnboardingActivity.java b/src/com/android/tv/onboarding/OnboardingActivity.java
index 0ce5d931..6eb1a894 100644
--- a/src/com/android/tv/onboarding/OnboardingActivity.java
+++ b/src/com/android/tv/onboarding/OnboardingActivity.java
@@ -66,7 +66,7 @@ public class OnboardingActivity extends SetupActivity {
@Override
public void onLoadFinished() {
mChannelDataManager.removeListener(this);
- mSetupUtils.markNewChannelsBrowsable();
+ mSetupUtils.markNewChannelsBrowsableIfEnabled();
}
@Override
@@ -97,9 +97,9 @@ public class OnboardingActivity extends SetupActivity {
mInputManager = singletons.getTvInputManagerHelper();
if (PermissionUtils.hasAccessAllEpg(this) || PermissionUtils.hasReadTvListings(this)) {
// Make the channels of the new inputs which have been setup outside TV app
- // browsable.
+ // browsable if enabled.
if (mChannelDataManager.isDbLoadFinished()) {
- mSetupUtils.markNewChannelsBrowsable();
+ mSetupUtils.markNewChannelsBrowsableIfEnabled();
} else {
mChannelDataManager.addListener(mChannelListener);
}
diff --git a/src/com/android/tv/onboarding/SetupSourcesFragment.java b/src/com/android/tv/onboarding/SetupSourcesFragment.java
index b97c7801..855fb274 100644
--- a/src/com/android/tv/onboarding/SetupSourcesFragment.java
+++ b/src/com/android/tv/onboarding/SetupSourcesFragment.java
@@ -313,7 +313,7 @@ public class SetupSourcesFragment extends SetupMultiPaneFragment {
TvInputInfo input = mInputs.get(i);
String inputId = input.getId();
String description;
- int channelCount = mChannelDataManager.getChannelCountForInput(inputId);
+ int channelCount = mChannelDataManager.getBrowsableChannelCountForInput(inputId);
if (mSetupUtils.isSetupDone(inputId) || channelCount > 0) {
if (channelCount == 0) {
description = getString(R.string.setup_input_no_channels);
diff --git a/src/com/android/tv/ui/BlockScreenView.java b/src/com/android/tv/ui/BlockScreenView.java
index b7a2dd95..9f61bf02 100644
--- a/src/com/android/tv/ui/BlockScreenView.java
+++ b/src/com/android/tv/ui/BlockScreenView.java
@@ -16,12 +16,15 @@
package com.android.tv.ui;
+import static com.android.tv.R.animator.tvview_block_screen_fade_out;
+
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.media.tv.TvInputInfo;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -30,6 +33,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.TextView;
+
import com.android.tv.R;
import com.android.tv.ui.TunableTvView.BlockScreenType;
@@ -42,6 +46,8 @@ public class BlockScreenView extends FrameLayout {
private TextView mBlockingInfoTextView;
private ImageView mBackgroundImageView;
+ private EmptyInputStatusBlockView mEmptyInputStatusBlockView;
+
private final int mSpacingNormal;
private final int mSpacingShrunken;
@@ -79,6 +85,7 @@ public class BlockScreenView extends FrameLayout {
mSpace = findViewById(R.id.space);
mBlockingInfoTextView = (TextView) findViewById(R.id.block_screen_text);
mBackgroundImageView = (ImageView) findViewById(R.id.background_image);
+ mEmptyInputStatusBlockView = findViewById(R.id.empty_input_status_block_view);
mFadeOut =
AnimatorInflater.loadAnimator(
getContext(), R.animator.tvview_block_screen_fade_out);
@@ -261,4 +268,12 @@ public class BlockScreenView extends FrameLayout {
public void setInfoTextClickable(boolean clickable) {
mBlockingInfoTextView.setClickable(clickable);
}
+
+ public void setEmptyInputStatusInputInfo(TvInputInfo inputInfo) {
+ mEmptyInputStatusBlockView.setIconAndLabelByInputInfo(inputInfo);
+ }
+
+ public void setEmptyInputStatusBlockVisibility(boolean visible) {
+ mEmptyInputStatusBlockView.setVisibility(visible ? View.VISIBLE : View.GONE);
+ }
}
diff --git a/src/com/android/tv/ui/EmptyInputStatusBlockView.java b/src/com/android/tv/ui/EmptyInputStatusBlockView.java
new file mode 100644
index 00000000..a7f91661
--- /dev/null
+++ b/src/com/android/tv/ui/EmptyInputStatusBlockView.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tv.ui;
+
+import android.content.Context;
+import android.media.tv.TvInputInfo;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.android.tv.R;
+
+public class EmptyInputStatusBlockView extends FrameLayout {
+ private ImageView mEmptyInputStatusIcon;
+ private TextView mEmptyInputTitleTextView;
+
+ public EmptyInputStatusBlockView(Context context) {
+ this(context, null, 0);
+ }
+
+ public EmptyInputStatusBlockView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public EmptyInputStatusBlockView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ inflate(context, R.layout.empty_input_status_block, this);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+
+ mEmptyInputStatusIcon = findViewById(R.id.empty_input_status_icon);
+ mEmptyInputTitleTextView = findViewById(R.id.empty_input_status_title_text);
+ }
+
+ public void setIconAndLabelByInputInfo(TvInputInfo inputInfo) {
+ CharSequence label = inputInfo.loadLabel(getContext());
+ String title = getResources().getString(R.string.empty_input_status_title_format, label);
+ mEmptyInputTitleTextView.setText(title);
+
+ if (inputInfo.isPassthroughInput()) {
+ mEmptyInputStatusIcon.setImageDrawable(
+ getResources().getDrawable(R.drawable.ic_empty_input_hdmi, null)
+ );
+ } else {
+ mEmptyInputStatusIcon.setImageDrawable(
+ getResources().getDrawable(R.drawable.ic_empty_input_tuner, null)
+ );
+ }
+ }
+}
diff --git a/src/com/android/tv/ui/InputBannerView.java b/src/com/android/tv/ui/InputBannerView.java
index d0609186..598d18ac 100644
--- a/src/com/android/tv/ui/InputBannerView.java
+++ b/src/com/android/tv/ui/InputBannerView.java
@@ -21,49 +21,38 @@ import android.media.tv.TvInputInfo;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.LinearLayout;
import android.widget.TextView;
+
import com.android.tv.MainActivity;
import com.android.tv.R;
import com.android.tv.data.api.Channel;
-public class InputBannerView extends LinearLayout implements TvTransitionManager.TransitionLayout {
- private final long mShowDurationMillis;
+public class InputBannerView extends InputBannerViewBase
+ implements TvTransitionManager.TransitionLayout {
- private final Runnable mHideRunnable =
- () ->
- ((MainActivity) getContext())
- .getOverlayManager()
- .hideOverlays(
- TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_DIALOG
- | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_SIDE_PANELS
- | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_PROGRAM_GUIDE
- | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_MENU
- | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_FRAGMENT);
private TextView mInputLabelTextView;
private TextView mSecondaryInputLabelTextView;
public InputBannerView(Context context) {
- this(context, null, 0);
+ super(context);
}
public InputBannerView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
+ super(context, attrs);
}
public InputBannerView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- mShowDurationMillis =
- context.getResources().getInteger(R.integer.select_input_show_duration);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mInputLabelTextView = (TextView) findViewById(R.id.input_label);
- mSecondaryInputLabelTextView = (TextView) findViewById(R.id.secondary_input_label);
+ mInputLabelTextView = findViewById(R.id.input_label);
+ mSecondaryInputLabelTextView = findViewById(R.id.secondary_input_label);
}
+ @Override
public void updateLabel() {
MainActivity mainActivity = (MainActivity) getContext();
Channel channel = mainActivity.getCurrentChannel();
@@ -83,15 +72,4 @@ public class InputBannerView extends LinearLayout implements TvTransitionManager
mSecondaryInputLabelTextView.setVisibility(View.VISIBLE);
}
}
-
- @Override
- public void onEnterAction(boolean fromEmptyScene) {
- removeCallbacks(mHideRunnable);
- postDelayed(mHideRunnable, mShowDurationMillis);
- }
-
- @Override
- public void onExitAction() {
- removeCallbacks(mHideRunnable);
- }
}
diff --git a/src/com/android/tv/ui/InputBannerViewBase.java b/src/com/android/tv/ui/InputBannerViewBase.java
new file mode 100644
index 00000000..c20e1da7
--- /dev/null
+++ b/src/com/android/tv/ui/InputBannerViewBase.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tv.ui;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.LinearLayout;
+
+import com.android.tv.MainActivity;
+import com.android.tv.R;
+import com.android.tv.data.StreamInfo;
+
+public abstract class InputBannerViewBase extends LinearLayout
+ implements TvTransitionManager.TransitionLayout {
+ protected final long mShowDurationMillis;
+ protected final Runnable mHideRunnable =
+ () ->
+ ((MainActivity) getContext())
+ .getOverlayManager()
+ .hideOverlays(
+ TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_DIALOG
+ | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_SIDE_PANELS
+ | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_PROGRAM_GUIDE
+ | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_MENU
+ | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_FRAGMENT);
+ public InputBannerViewBase(Context context) {
+ this(context, null, 0);
+ }
+
+ public InputBannerViewBase(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public InputBannerViewBase(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ mShowDurationMillis =
+ context.getResources().getInteger(R.integer.select_input_show_duration);
+
+ }
+
+ public abstract void updateLabel();
+
+ @Override
+ public void onEnterAction(boolean fromEmptyScene) {
+ removeCallbacks(mHideRunnable);
+ postDelayed(mHideRunnable, mShowDurationMillis);
+ }
+
+ @Override
+ public void onExitAction() {
+ removeCallbacks(mHideRunnable);
+ }
+
+ public void onStreamInfoUpdated(StreamInfo info) {}
+}
diff --git a/src/com/android/tv/ui/InputBannerViewV2.java b/src/com/android/tv/ui/InputBannerViewV2.java
new file mode 100644
index 00000000..e340819b
--- /dev/null
+++ b/src/com/android/tv/ui/InputBannerViewV2.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tv.ui;
+
+import android.content.Context;
+import android.media.tv.TvInputInfo;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.TextView;
+
+import com.android.tv.MainActivity;
+import com.android.tv.R;
+import com.android.tv.data.StreamInfo;
+import com.android.tv.data.api.Channel;
+
+public class InputBannerViewV2 extends InputBannerViewBase
+ implements TvTransitionManager.TransitionLayout {
+ private static final String TAG = "InputBannerViewV2";
+
+ private TextView mInputLabelTextView;
+ public InputBannerViewV2(Context context) {
+ super(context);
+ }
+
+ public InputBannerViewV2(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public InputBannerViewV2(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mInputLabelTextView = findViewById(R.id.input_label);
+ }
+
+ @Override
+ public void updateLabel() {
+ MainActivity mainActivity = (MainActivity) getContext();
+ Channel channel = mainActivity.getCurrentChannel();
+ if (channel == null || !channel.isPassthrough()) {
+ return;
+ }
+
+ TvInputInfo input =
+ mainActivity.getTvInputManagerHelper().getTvInputInfo(channel.getInputId());
+ if (input == null) {
+ Log.e(TAG, "unable to get TvInputInfo of id " + channel.getInputId());
+ return;
+ }
+
+ updateInputLabel(input);
+ }
+
+ private void updateInputLabel(TvInputInfo input) {
+ CharSequence customLabel = input.loadCustomLabel(getContext());
+ CharSequence label = input.loadLabel(getContext());
+
+ if (customLabel == null) {
+ mInputLabelTextView.setText(label);
+ } else {
+ String inputLabel = getResources().getString(
+ R.string.input_banner_v2_input_label_format, label, customLabel);
+ mInputLabelTextView.setText(inputLabel);
+ }
+
+ }
+}
diff --git a/src/com/android/tv/ui/TunableTvView.java b/src/com/android/tv/ui/TunableTvView.java
index 3ac841c2..76fb0a12 100644
--- a/src/com/android/tv/ui/TunableTvView.java
+++ b/src/com/android/tv/ui/TunableTvView.java
@@ -1017,6 +1017,12 @@ public class TunableTvView extends FrameLayout implements StreamInfo, TunableTvV
return;
}
mBlockScreenView.setVisibility(VISIBLE);
+ if (shouldShowEmptyInputStatusBlock()){
+ mBlockScreenView.setEmptyInputStatusInputInfo(mInputInfo);
+ mBlockScreenView.setEmptyInputStatusBlockVisibility(true);
+ } else {
+ mBlockScreenView.setEmptyInputStatusBlockVisibility(false);
+ }
if (mTvIAppView != null) {
mTvIAppView.setVisibility(INVISIBLE);
}
@@ -1255,6 +1261,13 @@ public class TunableTvView extends FrameLayout implements StreamInfo, TunableTvV
}
}
+ private boolean shouldShowEmptyInputStatusBlock() {
+ return TvFeatures.USE_GTV_LIVETV_V2.isEnabled(getContext()) &&
+ (mVideoUnavailableReason == TvInputManager.VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL ||
+ mVideoUnavailableReason ==
+ CommonConstants.VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED);
+ }
+
private boolean isBundledInput() {
return mInputInfo != null
&& mInputInfo.getType() == TvInputInfo.TYPE_TUNER
diff --git a/src/com/android/tv/ui/TvOverlayManager.java b/src/com/android/tv/ui/TvOverlayManager.java
index 19af23b9..dc4a27a8 100644
--- a/src/com/android/tv/ui/TvOverlayManager.java
+++ b/src/com/android/tv/ui/TvOverlayManager.java
@@ -49,6 +49,7 @@ import com.android.tv.common.ui.setup.SetupFragment;
import com.android.tv.common.ui.setup.SetupMultiPaneFragment;
import com.android.tv.data.ChannelDataManager;
import com.android.tv.data.ProgramDataManager;
+import com.android.tv.data.StreamInfo;
import com.android.tv.dialog.DvrHistoryDialogFragment;
import com.android.tv.dialog.FullscreenDialogFragment;
import com.android.tv.dialog.HalfSizedDialogFragment;
@@ -212,6 +213,7 @@ public class TvOverlayManager implements AccessibilityStateChangeListener {
private final SideFragmentManager mSideFragmentManager;
private final ProgramGuide mProgramGuide;
private final ChannelBannerView mChannelBannerView;
+ private final InputBannerViewBase mInputBannerView;
private final KeypadChannelSwitchView mKeypadChannelSwitchView;
private final SelectInputView mSelectInputView;
private final ProgramGuideSearchFragment mSearchFragment;
@@ -237,7 +239,7 @@ public class TvOverlayManager implements AccessibilityStateChangeListener {
TvOptionsManager optionsManager,
KeypadChannelSwitchView keypadChannelSwitchView,
ChannelBannerView channelBannerView,
- InputBannerView inputBannerView,
+ InputBannerViewBase inputBannerView,
SelectInputView selectInputView,
ViewGroup sceneContainer,
ProgramGuideSearchFragment searchFragment,
@@ -253,6 +255,7 @@ public class TvOverlayManager implements AccessibilityStateChangeListener {
mInputManager = tvInputManager;
mTvView = tvView;
mChannelBannerView = channelBannerView;
+ mInputBannerView = inputBannerView;
mKeypadChannelSwitchView = keypadChannelSwitchView;
mSelectInputView = selectInputView;
mSearchFragment = searchFragment;
@@ -875,6 +878,12 @@ public class TvOverlayManager implements AccessibilityStateChangeListener {
}
}
+ public void updateInputBannerIfNeeded(StreamInfo info) {
+ if (mTransitionManager.isInputBannerActive()) {
+ mInputBannerView.onStreamInfoUpdated(info);
+ }
+ }
+
@TvOverlayType
private int convertSceneToOverlayType(@SceneType int sceneType) {
switch (sceneType) {
diff --git a/src/com/android/tv/ui/TvTransitionManager.java b/src/com/android/tv/ui/TvTransitionManager.java
index f60337f1..579fcfce 100644
--- a/src/com/android/tv/ui/TvTransitionManager.java
+++ b/src/com/android/tv/ui/TvTransitionManager.java
@@ -56,7 +56,7 @@ public class TvTransitionManager extends TransitionManager {
private final MainActivity mMainActivity;
private final ViewGroup mSceneContainer;
private final ChannelBannerView mChannelBannerView;
- private final InputBannerView mInputBannerView;
+ private final InputBannerViewBase mInputBannerView;
private final KeypadChannelSwitchView mKeypadChannelSwitchView;
private final SelectInputView mSelectInputView;
private final FrameLayout mEmptyView;
@@ -78,7 +78,7 @@ public class TvTransitionManager extends TransitionManager {
MainActivity mainActivity,
ViewGroup sceneContainer,
ChannelBannerView channelBannerView,
- InputBannerView inputBannerView,
+ InputBannerViewBase inputBannerView,
KeypadChannelSwitchView keypadChannelSwitchView,
SelectInputView selectInputView) {
mMainActivity = mainActivity;
@@ -159,6 +159,10 @@ public class TvTransitionManager extends TransitionManager {
return mCurrentScene != null && mCurrentScene == mSelectInputScene;
}
+ public boolean isInputBannerActive() {
+ return mCurrentScene != null && mCurrentScene == mInputBannerScene;
+ }
+
public void setListener(Listener listener) {
mListener = listener;
}
diff --git a/src/com/android/tv/util/SetupUtils.java b/src/com/android/tv/util/SetupUtils.java
index aaee1047..858114d5 100644
--- a/src/com/android/tv/util/SetupUtils.java
+++ b/src/com/android/tv/util/SetupUtils.java
@@ -63,6 +63,8 @@ public class SetupUtils {
// Recognized inputs means that the user already knows the inputs are installed.
private static final String PREF_KEY_RECOGNIZED_INPUTS = "recognized_inputs";
private static final String PREF_KEY_IS_FIRST_TUNE = "is_first_tune";
+ // Whether to mark new channels to browsable.
+ private static final boolean MARK_NEW_CHANNELS_BROWSABLE = false;
private final Context mContext;
private final SharedPreferences mSharedPreferences;
@@ -132,11 +134,11 @@ public class SetupUtils {
boolean browsableChanged = false;
for (Channel channel : manager.getChannelList()) {
if (channel.getInputId().equals(inputId)) {
- if (!channel.isBrowsable()) {
+ if (!channel.isBrowsable() && MARK_NEW_CHANNELS_BROWSABLE) {
manager.updateBrowsable(channel.getId(), true, true);
browsableChanged = true;
}
- if (firstChannelForInput == null) {
+ if (firstChannelForInput == null && channel.isBrowsable()) {
firstChannelForInput = channel;
}
}
@@ -154,9 +156,15 @@ public class SetupUtils {
});
}
- /** Marks the channels in newly installed inputs browsable. */
+ /** Marks the channels in newly installed inputs browsable if enabled. */
@UiThread
- public void markNewChannelsBrowsable() {
+ public void markNewChannelsBrowsableIfEnabled() {
+ // TODO(b/288499376): Handle browsable field for channels added outside Live TV app in a
+ // better way.
+ if (!MARK_NEW_CHANNELS_BROWSABLE) {
+ return;
+ }
+
Set<String> newInputsWithChannels = new HashSet<>();
TvSingletons singletons = TvSingletons.getSingletons(mContext);
TvInputManagerHelper tvInputManagerHelper = singletons.getTvInputManagerHelper();