OSDN Git Service

Add timerfd backend to AlarmManagerService
authorGreg Hackmann <ghackmann@google.com>
Tue, 10 Dec 2013 00:56:53 +0000 (16:56 -0800)
committerGreg Hackmann <ghackmann@google.com>
Tue, 17 Dec 2013 00:23:51 +0000 (16:23 -0800)
commita1d6f92f34adb499565c9513235227a308e90221
tree1a15daa9d12d40c38689f183564db57445857df9
parent32b4c0779ea3a0149b31a1340513e9e0a6897b5f
Add timerfd backend to AlarmManagerService

On devices without /dev/alarm, use a new backend based on timerfd.
timerfd has near-equivalent syscalls for the /dev/alarm ioctls we care
about, with two key differences:

1) /dev/alarm uses one fd for all clocks, while timerfd needs one fd per
clock type.

AlarmManagerService addresses this by replacing the fd (int) with an
opaque pointer (long) to the backend-specific state.

2) When the RTC changes, the /dev/alarm WAIT ioctl always returns, while
timerfd cancels (and signals events) only on specially-flagged RTC
timerfds.

The timerfd backend masks this by creating an extraneous RTC timerfd,
specifically so there's always something to signal on RTC changes.

Change-Id: I5aef867748298610347f6e1479dd8bf569495832
Signed-off-by: Greg Hackmann <ghackmann@google.com>
services/java/com/android/server/AlarmManagerService.java
services/jni/com_android_server_AlarmManagerService.cpp