Example usage for android.media.tv TvContract buildChannelUriForPassthroughInput

List of usage examples for android.media.tv TvContract buildChannelUriForPassthroughInput

Introduction

In this page you can find the example usage for android.media.tv TvContract buildChannelUriForPassthroughInput.

Prototype

public static Uri buildChannelUriForPassthroughInput(String inputId) 

Source Link

Document

Build a special channel URI intended to be used with pass-through inputs.

Usage

From source file:com.android.tv.MainActivity.java

private void resumeTvIfNeeded() {
    if (DEBUG)//from ww w .  j  a va 2s. c  o m
        Log.d(TAG, "resumeTvIfNeeded()");
    if (!mTvView.isPlaying() || mInitChannelUri != null
            || (mShouldTuneToTunerChannel && mChannelTuner.isCurrentChannelPassthrough())) {
        if (TvContract.isChannelUriForPassthroughInput(mInitChannelUri)) {
            // The target input may not be ready yet, especially, just after screen on.
            String inputId = mInitChannelUri.getPathSegments().get(1);
            TvInputInfo input = mTvInputManagerHelper.getTvInputInfo(inputId);
            if (input == null) {
                input = mTvInputManagerHelper.getTvInputInfo(mParentInputIdWhenScreenOff);
                if (input == null) {
                    SoftPreconditions.checkState(false, TAG, "Input disappear." + input);
                    finish();
                } else {
                    mInitChannelUri = TvContract.buildChannelUriForPassthroughInput(input.getId());
                }
            }
        }
        mParentInputIdWhenScreenOff = null;
        startTv(mInitChannelUri);
        mInitChannelUri = null;
    }
    // Make sure TV app has the main TV view to handle the case that TvView is used in other
    // application.
    restoreMainTvView();
    mTvView.setBlockScreenType(getDesiredBlockScreenType());
}