• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TvInputInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.media.tv.TvInputInfo的典型用法代码示例。如果您正苦于以下问题:Java TvInputInfo类的具体用法?Java TvInputInfo怎么用?Java TvInputInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TvInputInfo类属于android.media.tv包,在下文中一共展示了TvInputInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addSchedule

import android.media.tv.TvInputInfo; //导入依赖的package包/类
private ScheduledRecording addSchedule(Program program, long priority) {
    TvInputInfo input = Utils.getTvInputInfoForProgram(mAppContext, program);
    if (input == null) {
        Log.e(TAG, "Can't find input for program: " + program);
        return null;
    }
    ScheduledRecording schedule;
    SeriesRecording seriesRecording = getSeriesRecording(program);
    schedule = createScheduledRecordingBuilder(input.getId(), program)
            .setPriority(priority)
            .setSeriesRecordingId(seriesRecording == null ? SeriesRecording.ID_NOT_SET
                    : seriesRecording.getId())
            .build();
    mDataManager.addScheduledRecording(schedule);
    return schedule;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:17,代码来源:DvrManager.java


示例2: addSeriesRecording

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Adds a new series recording and schedules for the programs with the initial state.
 */
public SeriesRecording addSeriesRecording(Program selectedProgram,
        List<Program> programsToSchedule, @SeriesState int initialState) {
    Log.i(TAG, "Adding series recording for program " + selectedProgram + ", and schedules: "
            + programsToSchedule);
    if (!SoftPreconditions.checkState(mDataManager.isInitialized())) {
        return null;
    }
    TvInputInfo input = Utils.getTvInputInfoForProgram(mAppContext, selectedProgram);
    if (input == null) {
        Log.e(TAG, "Can't find input for program: " + selectedProgram);
        return null;
    }
    SeriesRecording seriesRecording = SeriesRecording.builder(input.getId(), selectedProgram)
            .setPriority(mScheduleManager.suggestNewSeriesPriority())
            .setState(initialState)
            .build();
    mDataManager.addSeriesRecording(seriesRecording);
    // The schedules for the recorded programs should be added not to create the schedule the
    // duplicate episodes.
    addRecordedProgramToSeriesRecording(seriesRecording);
    addScheduleToSeriesRecording(seriesRecording, programsToSchedule);
    return seriesRecording;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:27,代码来源:DvrManager.java


示例3: isChannelRecordable

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Returns {@code true} if the channel can be recorded.
 * <p>
 * Note that this method doesn't check the conflict of the schedule or available tuners.
 * This can be called from the UI before the schedules are loaded.
 */
public boolean isChannelRecordable(Channel channel) {
    if (!mDataManager.isDvrScheduleLoadFinished() || channel == null) {
        return false;
    }
    TvInputInfo info = Utils.getTvInputInfoForChannelId(mAppContext, channel.getId());
    if (info == null) {
        Log.w(TAG, "Could not find TvInputInfo for " + channel);
        return false;
    }
    if (!info.canRecord()) {
        return false;
    }
    Program program = TvApplication.getSingletons(mAppContext).getProgramDataManager()
            .getCurrentProgram(channel.getId());
    return program == null || !program.isRecordingProhibited();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:23,代码来源:DvrManager.java


示例4: onCreateView

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    Bundle args = getArguments();
    if (args != null) {
        mProgram = args.getParcelable(DvrHalfSizedDialogFragment.KEY_PROGRAM);
    }
    SoftPreconditions.checkArgument(mProgram != null);
    TvInputInfo input = Utils.getTvInputInfoForProgram(getContext(), mProgram);
    SoftPreconditions.checkNotNull(input);
    List<ScheduledRecording> conflicts = null;
    if (input != null) {
        conflicts = TvApplication.getSingletons(getContext()).getDvrManager()
                .getConflictingSchedules(mProgram);
    }
    if (conflicts == null) {
        conflicts = Collections.emptyList();
    }
    if (conflicts.isEmpty()) {
        dismissDialog();
    }
    setConflicts(conflicts);
    return super.onCreateView(inflater, container, savedInstanceState);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:25,代码来源:DvrConflictFragment.java


示例5: getConflictingSchedules

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Returns a sorted list of all scheduled recordings that will not be recorded if
 * this program is going to be recorded, with their priorities in decending order.
 * <p>
 * An empty list means there is no conflicts. If there is conflict, a priority higher than
 * the first recording in the returned list should be assigned to the new schedule of this
 * program to guarantee the program would be completely recorded.
 */
public List<ScheduledRecording> getConflictingSchedules(Program program) {
    SoftPreconditions.checkState(mInitialized, TAG, "Not initialized yet");
    SoftPreconditions.checkState(Program.isValid(program), TAG,
            "Program is invalid: " + program);
    SoftPreconditions.checkState(
            program.getStartTimeUtcMillis() < program.getEndTimeUtcMillis(), TAG,
            "Program duration is empty: " + program);
    if (!mInitialized || !Program.isValid(program)
            || program.getStartTimeUtcMillis() >= program.getEndTimeUtcMillis()) {
        return Collections.emptyList();
    }
    TvInputInfo input = Utils.getTvInputInfoForProgram(mContext, program);
    if (input == null || !input.canRecord() || input.getTunerCount() <= 0) {
        return Collections.emptyList();
    }
    return getConflictingSchedules(input, Collections.singletonList(
            ScheduledRecording.builder(input.getId(), program)
                    .setPriority(suggestHighestPriority())
                    .build()));
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:29,代码来源:DvrScheduleManager.java


示例6: getConflictingSchedulesForWatching

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Returns priority ordered list of all scheduled recordings that will not be recorded if
 * the user keeps watching this channel.
 * <p>
 * Note that if the user keeps watching the channel, the channel can be recorded.
 */
public List<ScheduledRecording> getConflictingSchedulesForWatching(long channelId) {
    SoftPreconditions.checkState(mInitialized, TAG, "Not initialized yet");
    SoftPreconditions.checkState(channelId != Channel.INVALID_ID, TAG, "Invalid channel ID");
    TvInputInfo input = Utils.getTvInputInfoForChannelId(mContext, channelId);
    SoftPreconditions.checkState(input != null, TAG, "Can't find input for channel ID: "
            + channelId);
    if (!mInitialized || channelId == Channel.INVALID_ID || input == null) {
        return Collections.emptyList();
    }
    List<ScheduledRecording> schedules = mInputScheduleMap.get(input.getId());
    if (schedules == null || schedules.isEmpty()) {
        return Collections.emptyList();
    }
    return getConflictingSchedulesForWatching(input.getId(), channelId,
            System.currentTimeMillis(), suggestNewPriority(), schedules, input.getTunerCount());
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:23,代码来源:DvrScheduleManager.java


示例7: scheduleRecordingSoon

import android.media.tv.TvInputInfo; //导入依赖的package包/类
private void scheduleRecordingSoon(ScheduledRecording schedule) {
    TvInputInfo input = Utils.getTvInputInfoForInputId(mContext, schedule.getInputId());
    if (input == null) {
        Log.e(TAG, "Can't find input for " + schedule);
        mDataManager.changeState(schedule, ScheduledRecording.STATE_RECORDING_FAILED);
        return;
    }
    if (!input.canRecord() || input.getTunerCount() <= 0) {
        Log.e(TAG, "TV input doesn't support recording: " + input);
        mDataManager.changeState(schedule, ScheduledRecording.STATE_RECORDING_FAILED);
        return;
    }
    InputTaskScheduler scheduler = mInputSchedulerMap.get(input.getId());
    if (scheduler == null) {
        scheduler = new InputTaskScheduler(mContext, input, mLooper, mChannelDataManager,
                mDvrManager, mDataManager, mSessionManager, mClock);
        mInputSchedulerMap.put(input.getId(), scheduler);
    }
    scheduler.addSchedule(schedule);
    if (mLastStartTimePendingMs < schedule.getStartTimeMs()) {
        mLastStartTimePendingMs = schedule.getStartTimeMs();
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:24,代码来源:Scheduler.java


示例8: onStart

import android.media.tv.TvInputInfo; //导入依赖的package包/类
private void onStart() {
    if (!mStarted) {
        mStarted = true;
        mCancelLoadTask = false;
        if (!PermissionUtils.hasAccessWatchedHistory(mContext)) {
            mWatchedHistoryManager = new WatchedHistoryManager(mContext);
            mWatchedHistoryManager.setListener(this);
            mWatchedHistoryManager.start();
        } else {
            mContext.getContentResolver().registerContentObserver(
                    TvContract.WatchedPrograms.CONTENT_URI, true, mContentObserver);
            mHandler.obtainMessage(MSG_UPDATE_WATCH_HISTORY,
                    TvContract.WatchedPrograms.CONTENT_URI)
                    .sendToTarget();
        }
        mTvInputManager = (TvInputManager) mContext.getSystemService(Context.TV_INPUT_SERVICE);
        mTvInputManager.registerCallback(mInternalCallback, mHandler);
        for (TvInputInfo input : mTvInputManager.getTvInputList()) {
            mInputs.add(input.getId());
        }
    }
    if (mChannelRecordMapLoaded) {
        mHandler.sendEmptyMessage(MSG_NOTIFY_CHANNEL_RECORD_MAP_LOADED);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:26,代码来源:RecommendationDataManager.java


示例9: compare

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public int compare(TvInputInfo lhs, TvInputInfo rhs) {
    boolean lhsIsNewInput = mSetupUtils.isNewInput(lhs.getId());
    boolean rhsIsNewInput = mSetupUtils.isNewInput(rhs.getId());
    if (lhsIsNewInput != rhsIsNewInput) {
        // New input first.
        return lhsIsNewInput ? -1 : 1;
    }
    if (!lhsIsNewInput) {
        // Checks only when the inputs are not new.
        boolean lhsSetupDone = mSetupUtils.isSetupDone(lhs.getId());
        boolean rhsSetupDone = mSetupUtils.isSetupDone(rhs.getId());
        if (lhsSetupDone != rhsSetupDone) {
            // An input which has not been setup comes first.
            return lhsSetupDone ? 1 : -1;
        }
    }
    return mInputManager.getDefaultTvInputInfoComparator().compare(lhs, rhs);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:20,代码来源:TvInputNewComparator.java


示例10: run

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public void run() {
    List<TvInputInfo> infoList = mTvInputManagerHelper.getTvInputInfos(false, false);
    int systemInputCount = 0;
    int nonSystemInputCount = 0;
    for (TvInputInfo info : infoList) {
        if (mTvInputManagerHelper.isSystemInput(info)) {
            systemInputCount++;
        } else {
            nonSystemInputCount++;
        }
    }
    ConfigurationInfo configurationInfo = new ConfigurationInfo(systemInputCount,
            nonSystemInputCount);
    mTracker.sendConfigurationInfo(configurationInfo);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:17,代码来源:SendConfigInfoRunnable.java


示例11: isAvailable

import android.media.tv.TvInputInfo; //导入依赖的package包/类
private boolean isAvailable() {
    if (!mPipInput.isAvailable()) {
        return false;
    }

    // If this input shares the same parent with the current main input, you cannot select
    // it. (E.g. two HDMI CEC devices that are connected to HDMI port 1 through an A/V
    // receiver.)
    PipInput pipInput = mPipInputManager.getPipInput(getMainActivity().getCurrentChannel());
    if (pipInput == null) {
        return false;
    }
    TvInputInfo mainInputInfo = pipInput.getInputInfo();
    TvInputInfo pipInputInfo = mPipInput.getInputInfo();
    return mainInputInfo == null || pipInputInfo == null
            || !TextUtils.equals(mainInputInfo.getId(), pipInputInfo.getId())
            && !TextUtils.equals(mainInputInfo.getParentId(), pipInputInfo.getParentId());
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:19,代码来源:PipInputSelectorFragment.java


示例12: updateLabel

import android.media.tv.TvInputInfo; //导入依赖的package包/类
public void updateLabel() {
    MainActivity mainActivity = (MainActivity) getContext();
    Channel channel = mainActivity.getCurrentChannel();
    if (channel == null || !channel.isPassthrough()) {
        return;
    }
    TvInputInfo input = mainActivity.getTvInputManagerHelper().getTvInputInfo(
            channel.getInputId());
    CharSequence customLabel = input.loadCustomLabel(getContext());
    CharSequence label = input.loadLabel(getContext());
    if (TextUtils.isEmpty(customLabel) || customLabel.equals(label)) {
        mInputLabelTextView.setText(label);
        mSecondaryInputLabelTextView.setVisibility(View.GONE);
    } else {
        mInputLabelTextView.setText(customLabel);
        mSecondaryInputLabelTextView.setText(label);
        mSecondaryInputLabelTextView.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:20,代码来源:InputBannerView.java


示例13: onInputAdded

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public void onInputAdded(String inputId) {
    if (DEBUG) Log.d(TAG, "onInputAdded " + inputId);
    if (isInBlackList(inputId)) {
        return;
    }
    TvInputInfo info = mTvInputManager.getTvInputInfo(inputId);
    if (info != null) {
        mInputMap.put(inputId, info);
        mInputStateMap.put(inputId, mTvInputManager.getInputState(inputId));
        mInputIdToPartnerInputMap.put(inputId, isPartnerInput(info));
    }
    mContentRatingsManager.update();
    for (TvInputCallback callback : mCallbacks) {
        callback.onInputAdded(inputId);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:18,代码来源:TvInputManagerHelper.java


示例14: start

import android.media.tv.TvInputInfo; //导入依赖的package包/类
public void start() {
    if (mStarted) {
        return;
    }
    if (DEBUG) Log.d(TAG, "start");
    mStarted = true;
    mTvInputManager.registerCallback(mInternalCallback, mHandler);
    mInputMap.clear();
    mInputStateMap.clear();
    mInputIdToPartnerInputMap.clear();
    for (TvInputInfo input : mTvInputManager.getTvInputList()) {
        if (DEBUG) Log.d(TAG, "Input detected " + input);
        String inputId = input.getId();
        if (isInBlackList(inputId)) {
            continue;
        }
        mInputMap.put(inputId, input);
        int state = mTvInputManager.getInputState(inputId);
        mInputStateMap.put(inputId, state);
        mInputIdToPartnerInputMap.put(inputId, isPartnerInput(input));
    }
    SoftPreconditions.checkState(mInputStateMap.size() == mInputMap.size(), TAG,
            "mInputStateMap not the same size as mInputMap");
    mContentRatingsManager.update();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:26,代码来源:TvInputManagerHelper.java


示例15: getPipInputSize

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Gets the size of inputs for PIP.
 *
 * <p>The hidden inputs are not counted.
 *
 * @param availableOnly If {@code true}, it counts only available PIP inputs. Please see {@link
 *        PipInput#isAvailable()} for the details of availability.
 */
public int getPipInputSize(boolean availableOnly) {
    int count = 0;
    for (PipInput pipInput : mPipInputMap.values()) {
        if (!pipInput.isHidden() && (!availableOnly || pipInput.mAvailable)) {
            ++count;
        }
        if (pipInput.isPassthrough()) {
            TvInputInfo info = pipInput.getInputInfo();
            // Do not count HDMI ports if a CEC device is directly connected to the port.
            if (info.getParentId() != null && !info.isConnectedToHdmiSwitch()) {
                --count;
            }
        }
    }
    return count;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:25,代码来源:PipInputManager.java


示例16: buildTunerInputInfo

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Builds tuner input's info.
 */
@Nullable
@TargetApi(Build.VERSION_CODES.N)
public static TvInputInfo buildTunerInputInfo(Context context, boolean fromBuiltInTuner) {
    int numOfDevices = TunerHal.getTunerCount(context);
    if (numOfDevices == 0) {
        return null;
    }
    TvInputInfo.Builder builder = new TvInputInfo.Builder(context, new ComponentName(context,
            TunerTvInputService.class));
    if (fromBuiltInTuner) {
        builder.setLabel(R.string.bt_app_name);
    } else {
        builder.setLabel(R.string.ut_app_name);
    }
    try {
        return builder.setCanRecord(CommonFeatures.DVR.isEnabled(context))
                .setTunerCount(numOfDevices)
                .build();
    } catch (NullPointerException e) {
        // TunerTvInputService is not enabled.
        return null;
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:27,代码来源:TunerInputInfoUtils.java


示例17: updateTunerInputInfo

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Updates tuner input's info.
 *
 * @param context {@link Context} instance
 */
public static void updateTunerInputInfo(Context context) {
    if (BuildCompat.isAtLeastN()) {
        if (DEBUG) Log.d(TAG, "updateTunerInputInfo()");
        TvInputInfo info = buildTunerInputInfo(context, isBuiltInTuner(context));
        if (info != null) {
            ((TvInputManager) context.getSystemService(Context.TV_INPUT_SERVICE))
                    .updateTvInputInfo(info);
            if (DEBUG) {
                Log.d(TAG, "TvInputInfo [" + info.loadLabel(context)
                        + "] updated: " + info.toString());
            }
        } else {
            if (DEBUG) {
                Log.d(TAG, "Updating tuner input's info failed. Input is not ready yet.");
            }
        }
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:24,代码来源:TunerInputInfoUtils.java


示例18: testAddSchedule_consecutiveUseLessSession

import android.media.tv.TvInputInfo; //导入依赖的package包/类
public void testAddSchedule_consecutiveUseLessSession() throws Exception {
    TvInputInfo input = createTvInputInfo(TUNER_COUNT_TWO);
    mScheduler.updateTvInputInfo(input);
    long startTimeMs = mFakeClock.currentTimeMillis();
    long endTimeMs = startTimeMs + TimeUnit.SECONDS.toMillis(1);
    long id = 0;
    mScheduler.handleAddSchedule(
            RecordingTestUtils.createTestRecordingWithIdAndPriorityAndPeriod(++id, CHANNEL_ID,
                    LOW_PRIORITY, startTimeMs, endTimeMs));
    mScheduler.handleBuildSchedule();
    startTimeMs = endTimeMs;
    endTimeMs = startTimeMs + TimeUnit.SECONDS.toMillis(1);
    mScheduler.handleAddSchedule(
            RecordingTestUtils.createTestRecordingWithIdAndPriorityAndPeriod(++id, CHANNEL_ID,
                    HIGH_PRIORITY, startTimeMs, endTimeMs));
    mScheduler.handleBuildSchedule();
    verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).times(1)).start();
    verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).never()).stop();
    // The second schedule should wait until the first one finishes rather than creating a new
    // session even though there are available tuners.
    assertTrue(mRecordingTasks.size() == 1);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:23,代码来源:InputTaskSchedulerTest.java


示例19: onCreate

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate SetupFragment");
    super.onCreate(savedInstanceState);

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(
            mSyncStatusChangedReceiver,
            new IntentFilter(SyncJobService.ACTION_SYNC_STATUS_CHANGED));

    mInputId = getActivity().getIntent().getStringExtra(TvInputInfo.EXTRA_INPUT_ID);
    new SetupRowTask().execute();
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:13,代码来源:RichSetupFragment.java


示例20: onGuidedActionClicked

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public void onGuidedActionClicked(GuidedAction action) {
    if (action.getId() == ACTION_ONLINE_STORE) {
        mParentFragment.onActionClick(ACTION_CATEGORY, (int) action.getId());
        return;
    }
    int index = (int) action.getId() - ACTION_INPUT_START;
    if (index >= 0) {
        TvInputInfo input = mInputs.get(index);
        Bundle params = new Bundle();
        params.putString(ACTION_PARAM_KEY_INPUT_ID, input.getId());
        mParentFragment.onActionClick(ACTION_CATEGORY, ACTION_SETUP_INPUT, params);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:15,代码来源:SetupSourcesFragment.java



注:本文中的android.media.tv.TvInputInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Hash类代码示例发布时间:2022-05-23
下一篇:
Java EcoreEList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap