HAL know how

What is HAL?

HAL is short for Hardware abstraction Layer. This is a concept designed by Google to avoid the short of open source which vendors or driver company wanna not open source.

What for?

HAL defines a standard APIs for hardware vendors to implement

Tow generations of HAL

  • The old version : Android OS 7 and below.
  • The newest version : Android OS 8 and higher.

The Newest HAL : Dynamically Available HALs

Android 9 supports the dynamic shutdown of Android hardware subsystems when they are not in use or not needed.
For example, when a user is not using Wi-Fi, the Wi-Fi subsystems should not be taking up memory, power, or other system resources. In earlier versions of Android, HALs/drivers were kept open on Android devices for the entire duration an Android phone was booted.

Change to HAL

# some init.rc script associated with the HAL
    service vendor.some-service-name /vendor/bin/hw/some-binary-service
    # init language extension, provides information of what service is served
    # if multiple interfaces are served, they can be specified one on each line
    interface android.hardware.light@2.0::ILight default
    # restarted if hwservicemanager dies
    # would also cause the hal to start early during boot if disabled wasn't set
    class hal
    # will not be restarted if it exits until it is requested to be restarted
    oneshot
    # will only be started when requested
    disabled
    # ... other properties

Automatic lifecycles

HAL init

hwservicemanager tells init to start requested service ,with messages below

  • ctl.interface_start
  • ctl.interface_stop
  • ctl.interface_restart

HAL exit

  • Android 9: manually exit;
  • Android 10 and higher: Automatic lifecycles

to be continued >>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值