6.2, the Android hardware Access service to write system code

Source: Internet
Author: User

1. Implement the interface file to the app, and the interface file is obtained when the application query obtains the service.

Using Aidl (Android Interface Definition Language) to implement the Iledservice.java interface

Define Iledservice.aidl

Interface Iledservice

{

int Iedctrl (int which,int status);

}

Put Iledservice.aidl in the compiled Android system source directory: Frameworks/base/core/java/android/os directory, while modifying frameworks/ Base of the Android.mk file, which is the makefile file, the other subdirectories do not have android.mk files: Follow the other add Aidl file add a sentence:

Core/java/android/os/iledservice.aidl\

Then execute it under the Frameworks/base directory: MMM. (This command will help us generate the Iledservice.java file, while executing the MMM command if the Android system has been successfully compiled)

The results of the compilation will be placed in the out directory and searched under the Out directory: "Find-name" Iledservice.java "

App if used: Iledservice iledservice;

Iledservice = Iledservice. Stub.asinterface (Servicemanager.getservice ("led"));

Then call Iledservice.iedctrl (); This method will send the service request to Ledservice.java

2. Realize Ledservice.java

6.2, the Android hardware Access service to write system code

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.