歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

Android下rtc驅動調用流程

首先在./frameworks/base/core/java/Android/app/目錄下找到IAlarmManager.aidl

內容如下:

interfaceIAlarmManager {
    void set(int type, longtriggerAtTime, in PendingIntent operation);
  void setRepeating(int type, long triggerAtTime, long interval, inPendingIntent operation);
    voidsetInexactRepeating(int type, long triggerAtTime, long interval, inPendingIntent operation);
    void setTime(longmillis);
    void setTimeZone(String zone);
  void remove(in PendingIntent operation);
    voidcancelPoweroffAlarm(String name);
    booleanbootFromPoweroffAlarm();
}

 函數的具體實現在./frameworks/base/core/java/android/app/目錄下的·AlarmManager.java文件中,

部分內容如下:

publicvoid set(int type, long triggerAtMillis, PendingIntent operation){
        try {
          mService.set(type, triggerAtMillis, operation);
      } catch (RemoteException ex) {
      }
}
mService.set(type,triggerAtMillis,operation);函數實現文件為:frameworks/base/services/java/com/android/server/AlarmManagerService.java

部分內容如下:

 publicvoid set(int type, long triggerAtTime, PendingIntent operation) {

}

 privateclass AlarmThread extends Thread {

。。。。。。
。。。。。。
intresult = waitForAlarm(mDescriptor);

。。。。。。

。。。。。。

}

 privateclass AlarmThread extends Thread {
      public AlarmThread() {
 private class AlarmThread extendsThread {
        publicAlarmThread() {
 private class AlarmThread extends Thread{
        public AlarmThread(){
而waitForAlarn的實現文件為:frameworks/base/services/jni/com_android_server_AlarmManagerService.cpp

部分內容為:

staticJNINativeMethod sMethods[] = {
    /* name,signature, funcPtr */
      {"init", "()I",(void*)android_server_AlarmManagerService_init},
      {"close", "(I)V",(void*)android_server_AlarmManagerService_close},
      {"set", "(IIJJ)V",(void*)android_server_AlarmManagerService_set},
  {"waitForAlarm", "(I)I",(void*)android_server_AlarmManagerService_waitForAlarm},
  {"setKernelTimezone", "(II)I",(void*)android_server_AlarmManagerService_setKernelTimezone},
  {"bootFromAlarm", "(I)Z",(void*)android_server_AlarmManagerService_bootFromAlarm},
};

也就在這個文件中直接對linux的rtc驅動接口進行了直接操作,再往下就進入linux驅動程序。

Copyright © Linux教程網 All Rights Reserved