InstrumentClusterRenderingService 使用解析

InstrumentClusterRenderingService 使用解析


InstrumentClusterRenderingService

InstrumentClusterRenderingService類爲Android Car下car-lib目錄下的api接口。主要是提供儀表盤渲染效果的服務。但是這個類使用的API解釋得比較複雜,所以這裏單獨做一下解析。

首先,該類處於Car API目錄下,屬於直接提供給APP使用的接口,同時在Car-Service中也存在一個極爲類似的類InstrumentClusterService,該類處於Car SERVICE層中,與android 原生中ANDROID SYSTEM SERVICES 同層級,並相互調用。

解析相關類

那麼我們先來看google是怎麼解釋得。首先是InstrumentClusterRenderingService
,官方的解釋文檔

 * A service that used for interaction between Car Service and Instrument Cluster. Car Service may
 * provide internal navigation binder interface to Navigation App and all notifications will be
 * eventually land in the {@link NavigationRenderer} returned by {@link #getNavigationRenderer()}.
 *
 * <p>To extend this class, you must declare the service in your manifest file with
 * the {@code android.car.permission.BIND_INSTRUMENT_CLUSTER_RENDERER_SERVICE} permission
 * <pre>
 * &lt;service android:name=".MyInstrumentClusterService"
 *          android:permission="android.car.permission.BIND_INSTRUMENT_CLUSTER_RENDERER_SERVICE">
 * &lt;/service></pre>
 * <p>Also, you will need to register this service in the following configuration file:
 * {@code packages/services/Car/service/res/values/config.xml}

翻譯一下意思:

InstrumentClusterRenderingService用於Car Service和汽車組合儀表之間的交互。Car Service將爲導航應用提供內部導航代理接口,並且所有的通知將展示在NavigationRenderer上,並且通過getNavigationRenderer()可以返回對應的NavigationRenderer。繼承該類時,需要在manifest文件下聲明該service,並且需要獲取android.car.permission.BIND_INSTRUMENT_CLUSTER_RENDERER_SERVICE權限,獲取方式:
<service android:name=".MyInstrumentClusterService" android:permission="android.car.permission.BIND_INSTRUMENT_CLUSTER_RENDERER_SERVICE">
service>
並且,你將需要在以下目錄:packages/services/Car/service/res/values/config.xml註冊該服務。

可以看出該類主要用途在於實現Car service層與Car API層中儀表模塊的交互,並處理儀表相關的通知功能。

其次,InstrumentClusterService類,先看官方解釋

Service responsible for interaction with car's instrument cluster.

翻譯過來就是:

負責與汽車儀表盤交互的服務。

也就是說此類主要是服務提供,實現Car service層相關功能。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章