OSDN Git Service

Fix alarms with negative or very large wakup times.
authorJeff Brown <jeffbrown@google.com>
Wed, 31 Mar 2010 22:29:40 +0000 (15:29 -0700)
committerJeff Brown <jeffbrown@google.com>
Wed, 31 Mar 2010 22:38:08 +0000 (15:38 -0700)
commit11c5f1a65d6c495cc60f9f15d408c776baed9f73
tree1a82c873340eabb636e04091c0fd59be3b271984
parent966fcb81eece9096040ccc185bb662335d3964cf
Fix alarms with negative or very large wakup times.

When the wakeup time is negative, the kernel /dev/alarm driver
never triggers the alarm.  This can cause alarms to back up in the
priority queue since an alarm at the head with a negative wakup time
will never be triggered.  Now we use 0 as the wakup time which causes
an immediate triggering.

When the wakeup time is very large, it is possible for a numeric
overflow to occur when converting the timestamp from milliseconds
since epoch to nanoseconds.  This has been fixed by avoiding the
intermediate conversion in the JNI call so that overflow cannot
occur.

Bug: b/2558820
Change-Id: I4f5b4646a04090cc749a9fc5d3982a68402954ef
services/java/com/android/server/AlarmManagerService.java
services/jni/com_android_server_AlarmManagerService.cpp