Tv Develop of Android TIF Study
来源:互联网 发布:无线访客网络设置 编辑:程序博客网 时间:2024/05/16 14:24
The article is mainly recording the following skills
–>Android TIF code Structure and flow
–>How to use TIF in Tv App
References:
http://blog.csdn.net/wangmxe/article/details/50528682
http://blog.csdn.net/zhudaozhuan/article/details/50849542
1: TIF architecture
1.1: TIF OverView
The Android TV Input Framework (TIF) simplifies the delivery of content to Android TV. The TIF provides a standard API for manufacturers to use in constructing input modules for controlling
Android TV.
The Android TV Input Framework includes a TV Input Manager and an example TV App that works with a special remote control to access builtin and IP tuner channels.
In all, the TV Input Framework consists of:
● TV Provider (com.android.providers.tv.TvProvider) a database of channels, programs and associated permissions
● TV Input Manager (android.media.tv.TvInputManager) brokers
communication between the TV Inputs and TV App
● TV Input an application provided by the OEM, Google or third parties to route content
● TV App (com.android.tv.TvActivity) the application provided by the OEM or Google for user interaction
● HDMICEC the technology to allow remote control of various devices over HDMI
1.2: TIF Directory Structure
1.3: TIF Main Class
- TvView: Displays TV contents. The TvView class provides a high level interface for applications to show TV programs from various TV sources that implement {@link TvInputService}
–>TvInputCallback: Callback used to receive various status updates on the {@link TvView} - TvInputManager: Central system API to the overall TV input framework (TIF) architecture, which arbitrates interaction between applications and the selected TV inputs.
–>SessionCallback: Interface used to receive the created session,
–>TvInputCallback: Callback used to monitor status of the TV input
–>Session: The Session provides the per-session functionality of TV inputs - TvInputManagerService: This class provides a system service that manages television inputs.
- TvInputService: all of the input device must inherit the class.The TvInputService class represents a TV input or source such as HDMI or built-in tuner which provides pass-through video or broadcast TV programs.
1.4: TIS init flow
2: how to use TIF
2.1: create session
{ mTvInputManager = (TvInputManager) getSystemService(Context.TV_INPUT_SERVICE); if (mTvInputManager != null) { observerCallback = new ObserverSessionCallback(); List inputlist = mTvInputManager.getTvInputList(); if (inputlist != null) { for (int i = 0; i < inputlist.size(); i++) { TvInputInfo tinfo = (TvInputInfo) inputlist.get(i); if ((tinfo.getType() == TvInputInfo.TYPE_TUNER) && (tinfo.getComponent().getPackageName().equals(ITVSessionContext.TUNERSERVICE_PKG_ID))) { tunerServiceId = tinfo.getId(); Log.d(tag, "TunerService ID = " + tunerServiceId); break; } } } if (mTvInputManager.getInputState(tunerServiceId) == TvInputManager.INPUT_STATE_CONNECTED) { Log.d(tag, "creating the session,waiting for call back"); mTvInputManager.createSession(tunerServiceId, observerCallback, mSessionHandler); } else { Log.d(tag, "input tuner not added yet,waiting for call back"); } } else { Log.d(tag, "Could not get system service TV_INPUT_SERVICE!!"); } }
2.2: inherit SessionCallback
public class ObserverSessionCallback extends SessionCallback { Session mySession = null; public void onSessionCreated(Session session) { Log.d(tag, "onSessionCreated "); if (session != null) { Log.d(tag, "Session creation successful"); mySession = session; String action = ITVSessionContext.APP_PRIVATE_COMMAND_SESSION_TYPE; Bundle bundle = new Bundle(); bundle.putString(ITVSessionContext.KEY_SESSION_TYPE, ITVSessionContext.SESSION_TYPE_MAIN_OBSERVER); mySession.sendAppPrivateCommand(action, bundle); } else { Log.d(tag, "Session creation failed"); } } public void onSessionReleased(Session session) { Log.d(tag, "onSessionReleased called"); mySession = null; mObserverSessionContext = null; } public void onChannelRetuned(Session session, Uri channelUri) { } public void onVideoUnavailable(Session session, int reason) { } public void onSessionEvent(Session session, String eventType, Bundle eventArgs) { Log.i(tag, "onSessionEvent " + this); if (eventType.equals(ITVSessionContext.EVENT_SESSION_CONTEXT_CREATED)) { IBinder binder = eventArgs.getBinder(ITVSessionContext.SESSION_CONTEXT); mObserverSessionContext = ITVSessionContext.instance.asInterface(binder); ObserverSessionContextCallbacks mainSessionContextCallbacks = new ObserverSessionContextCallbacks(); mObserverSessionContext.registerSessionContextCallbacks(mainSessionContextCallbacks); } } }
commit id: 98c0c6e7d5ffcefd0e939f6a5f2b40e30ee69cb2
- Tv Develop of Android TIF Study
- android TIF(Tv Input Framework)使用
- Android TV Input Framework(TIF)--1 概述
- Android TV Input Framework(TIF)--1 概述
- Tv App Develop of OAD Architecture
- Tv App Develop of TvServer Service
- Android TV Input Framework(TIF)--2 构建TV input list
- Android TV Input Framework(TIF)--3 显示Tv Input内容
- Android TV Input Framework(TIF)--2 构建TV input list
- Android TV Input Framework(TIF)--构建TV input list
- Android TV Input Framework(TIF)--显示Tv Input
- Android TV Study 1-1
- error of develop android
- Android TV框架 TIF(Android TV Input Framework)入门实践
- Develop necessary knowledge of Android system
- First day of android study
- android develop
- Android develop
- css水平居中的方法
- 动态加载fragment配合TabLayout
- 设计模式之适配器模式
- Linux下tar用法
- HDOJ.2955 Robberies (01背包+概率问题)
- Tv Develop of Android TIF Study
- Linux下安装Nginx
- window平台安装 MongoDB
- 关于问题 mysql"Access denied for user root@localhost" 的解决办法
- JavaWeb之Jsp的初次相识
- 剑指offer 面试题57 删除链表中重复的结点
- 《React-Native系列》 API模块之PixelRatio和Dimensions
- DOM笔记
- 3.2.3