首先在./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驱动程序。