Android O 前期预研之三:Android Vehicle HAL

###Android Automotive

Android Automotive 是Android Oreo中的一个新的特色功能,从AOSP的代码上来看,Android O中已经包含有了从Application到Framework 到HAL的整体框架,这一章节,我们简单的过以下Android Vehicle 的框架,以及重点看下 Vehicle HAL的东西。总体结构大约是以下这个样子:
这里写图片描述

上图的结构应该是Android Oreo当中比较通用的框架结构了,从Application 到Framework到HAL,跟之前的Android版本相比,之前Framework要不通过binder联系上一个Daemon,这个Daemon再去load 相关的HAL,要不就是这些Framework的service直接通过JNI去load 这些个HAL 库。而现在的Android Oreo则是Framework 与HAL之间直接采用HIDL来做联络沟通了。接下来我们从下往上的来把Android Vehicle的框架捋一下吧。首先来分析下Vehicle HAL,通过这个来复习并且实践下之前研究学习过的Android HIDL.

####Android Vehicle HAL
这里写图片描述

types.hal 定义的是一些数据结构,IVehicle.hal定义的是从Framework往HAL调用的接口,而IVehicleCallback.hal则是HAL往Framework 上报回调的接口。看起来还是挺清晰的吧。
而IVehicle.hal的接口也不是很多,

package [email protected];

import IVehicleCallback;

interface IVehicle {
  /**
   * Returns a list of all property configurations supported by this vehicle
   * HAL.
   */
  getAllPropConfigs() generates (vec<VehiclePropConfig> propConfigs);

  /**
   * Returns a list of property configurations for given properties.
   *
   * If requested VehicleProperty wasn't found it must return
   * StatusCode::INVALID_ARG, otherwise a list of vehicle property
   * configurations with StatusCode::OK
   */
  getPropConfigs(vec<int32_t> props)
          generates (StatusCode status, vec<VehiclePropConfig> propConfigs);

  /**
   * Get a vehicle property value.
   *
   * For VehiclePropertyChangeMode::STATIC properties, this method must always
   * return the same value always.
   * For VehiclePropertyChangeMode::ON_CHANGE properties, it must return the
   * latest available value.
   *
   * Some properties like AUDIO_VOLUME requires to pass additional data in
   * GET request in VehiclePropValue object.
   *
   * If there is no data available yet, which can happen during initial stage,
   * this call must return immediately with an error code of
   * StatusCode::TRY_AGAIN.
   */
  get(VehiclePropValue requestedPropValue)
          generates (StatusCode status, VehiclePropValue propValue);

  /**
   * Set a vehicle property value.
   *
   * Timestamp of data must be ignored for set operation.
   *
   * Setting some properties require having initial state available. If initial
   * data is not available yet this call must return StatusCode::TRY_AGAIN.
   * For a property with separate power control this call must return
   * StatusCode::NOT_AVAILABLE error if property is not powered on.
   */
  set(VehiclePropValue propValue) generates (StatusCode status);

  /**
   * Subscribes to property events.
   *
   * Clients must be able to subscribe to multiple properties at a time
   * depending on data provided in options argument.
   *
   * @param listener This client must be called on appropriate event.
   * @param options List of options to subscribe. SubscribeOption contains
   *                information such as property Id, area Id
  • 12
    点赞
  • 67
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值