"Android Deep Exploration" Vol. 1 nineth note 1314 Wang Ning

Source: Internet
Author: User

Nineth Chapter

This chapter mainly studies HAL. The hardware abstraction Layer of Android is the encapsulation of the Linux kernel driver, providing the interface upwards, shielding the implementation details of the lower level. The hardware support is divided into two layers, one layer in the user space, one layer in the kernel space, where the hardware abstraction layer runs in the user space, and the Linux kernel driver runs in the kernel space. added HAL for LED driver

Step 1 , write Linux Drivers

" writing linux drivers "is nonsense from the show, but if you want to add HAL to the Linux driver , and want to protect sensitive data as much as possible. Linux - driven code needs to be as concise as possible to put business logic into hallibrary .

Step 2 : Write the HAL Library

The HAL library is an ordinary Linux Library. so ) file. However, this type of library file has an interface. Implemented by hal_module_info_ SYM variables. the Service Library locates the HAL Library by the ID defined in this interface .

Step 3 : Write the Service Library

Service Libraryis alsoLinux Library. Service Libraryit can be normal.Linux Library, or it can be notThe Library. In this chapter,LEDThe driver example willService libratγand criminalI Librarytogether. In other words,Service Libraryis thatJNI Library.In fact, this step is in addition toCICimplementation of the item *. solibrary file, you should also include aJavathe service management classes written(ServiceManager). ServiceManageris calledService Library. andAPKprogram will callServiceManagerClass meter AccessService Library.

"Android Deep Exploration" Vol. 1 nineth note 1314 Wang Ning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.