rtc关机闹钟6 AlarmManagerService研究
这个是
private void setLocked(int type, long when) {
if (mNativeData != 0) {
// The kernel never triggers alarms with negative wakeup times
// so we ensure they are positive.
long alarmSeconds, alarmNanoseconds;
if (when < 0) {
alarmSeconds = 0;
alarmNanoseconds = 0;
} else {
alarmSeconds = when / 1000;
alarmNanoseconds = (when % 1000) * 1000 * 1000;
}
set(mNativeData, type, alarmSeconds, alarmNanoseconds);
} else {
Message msg = Message.obtain();
msg.what = ALARM_EVENT;
mHandler.removeMessages(ALARM_EVENT);
mHandler.sendMessageAtTime(msg, when);
}
}
setLocked()内部会调用native函数set():
- private native void set(int fd, int type, long seconds, long nanoseconds);
重新设置“实体闹钟”的激发时间。这个函数内部会调用ioctl()和底层打交道。具体代码可参考frameworks/base/services/jni/com_android_server_AlarmManagerService.cpp文件:
- static void android_server_AlarmManagerService_set(JNIEnv* env, jobject obj, jint fd,
- jint type, jlong seconds, jlong nanoseconds)
- {
- struct timespec ts;
- ts.tv_sec = seconds;
- ts.tv_nsec = nanoseconds;
- int result = ioctl(fd, ANDROID_ALARM_SET(type), &ts);
- if (result < )
- {
- ALOGE("Unable to set alarm to %lld.%09lld: %s\n", seconds, nanoseconds, strerror(errno));
- }
- }
rtc关机闹钟6 AlarmManagerService研究的更多相关文章
- rtc关机闹钟5 AlarmManager研究
AlarmManager研究 侯 亮 转自 http://blog.csdn.net/codefly/article/details/17058425 1.概述 在Android系统中,闹钟和唤醒功能 ...
- rtc关机闹钟4 AlarmManagerService.java
vim base/services/core/java/com/android/server/AlarmManagerService.java AlarmManager 调用 IAlarmManage ...
- rtc关机闹钟3 IAlarmManager
vim framework/base/core/java/android/app/IAlarmManager.aidl import android.app.AlarmManager;import a ...
- rtc 关机闹钟1 app层
private static void enableAlertPowerOn(Context context, final Alarm alarm, final long atTimeInMillis ...
- rtc关机闹钟7 jni层 com_android_server_AlarmManagerService
frameworks/base/services/core/jni/com_android_server_AlarmManagerService.cpp int AlarmImplAlarmDrive ...
- rtc关机闹钟2 Alarm manager
public void set(int type, long triggerAtMillis, long windowMillis, long intervalMillis, PendingInten ...
- C语言中时钟编程
目录 C语言中时钟编程 1. 文章目的 2.基本概念 2.1 UTC时间 2.2 UNIX纪元时间 2.3 格林威治时间 (GMT) 3.时间转换 3.1 asctime函数 3.2 ctime函数 ...
- 【原创】STM32低功耗模式及中断唤醒(基于BMI160及RTC)的研究
预研目标 六轴静止时,终端进入低功耗模式:六轴震动时,终端正常工作模式,从而极大减少非工作时的电流消耗. 解决方案 机器静止时,依据六轴算法,CPU进入休眠(停止)模式:机器工作时,触发六轴中断唤醒C ...
- S3C2440上RTC时钟驱动开发实例讲解(转载)
嵌入式Linux之我行,主要讲述和总结了本人在学习嵌入式linux中的每个步骤.一为总结经验,二希望能给想入门嵌入式Linux的朋友提供方便.如有错误之处,谢请指正. 共享资源,欢迎转载:http:/ ...
随机推荐
- ReactiveCocoa的使用方法
http://www.open-open.com/lib/view/open1440060663129.html best praticse https://github.com/ReactiveCo ...
- js获取页面及个元素高度、宽度
网页可见区域宽: document.body.clientWidth; 网页可见区域高: document.body.clientHeight; 网页可见区域宽: document.body.offs ...
- 线性空间光照(即Gamma)
在渲染管线中正确使用Gamma校正是决定渲染效果的一个非常重要的因素,现在商业引擎包括很多国内引擎都已经是在线性空间计算光照.当然也包括我们之前公司设计的引擎.关于gamma校正的定义可以查看wiki ...
- Baseline模板管理
SQL> alter session set NLS_DATE_FORMAT= 'yyyy-mm-dd hh24:mi:ss'; 创建单一基线模板: SQL> exec dbms_work ...
- oracle pl sql 解锁表
select p.spid,a.serial#, c.object_name,b.session_id,b.oracle_username,b.os_user_name from v$pr ...
- JAVA字符串的GZIP压缩解压缩
package com.gzip; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import ...
- j2ee ehcache
Ehcache is an open source, standards-based cache that boosts performance, offloads your database, an ...
- Aspectj是什么
转载自:http://www.cnblogs.com/sunwke/articles/2568875.html 网上出现了很多讲解 AspectJ 的资料,但大多是从讲解 AspectJ 语法开始,然 ...
- Uploadify在MVC中使用方法案例(上传单张图片)
在View视图中: <link href="/Scripts/uploadify-v3.2.1/uploadify.css" rel="stylesheet&quo ...
- word - 如何让 图片任意移动
选中图片, 设置图片的自动换行 为四周环绕型