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