diff options
author | Greg Hackmann <ghackmann@google.com> | 2013-12-17 10:15:33 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-12-17 10:15:33 -0800 |
commit | 060ae1db7bba39cb8171f4267b5de9538f1ab440 (patch) | |
tree | 209b2156ca7eee0ca134cbc57bd69c85d54d94ef /services/java/com/android | |
parent | 3545433d052769417dcdd70bc59fbf31f9925ba4 (diff) | |
parent | eb0ca2b7bfd70fbbf2bd730b1c431faac21d0416 (diff) | |
download | frameworks_base-060ae1db7bba39cb8171f4267b5de9538f1ab440.zip frameworks_base-060ae1db7bba39cb8171f4267b5de9538f1ab440.tar.gz frameworks_base-060ae1db7bba39cb8171f4267b5de9538f1ab440.tar.bz2 |
am eb0ca2b7: Merge "Add timerfd backend to AlarmManagerService"
* commit 'eb0ca2b7bfd70fbbf2bd730b1c431faac21d0416':
Add timerfd backend to AlarmManagerService
Diffstat (limited to 'services/java/com/android')
-rw-r--r-- | services/java/com/android/server/AlarmManagerService.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java index 5ae9a6d..2e1b0af 100644 --- a/services/java/com/android/server/AlarmManagerService.java +++ b/services/java/com/android/server/AlarmManagerService.java @@ -99,7 +99,7 @@ class AlarmManagerService extends IAlarmManager.Stub { private Object mLock = new Object(); - private int mDescriptor; + private long mNativeData; private long mNextWakeup; private long mNextNonWakeup; private int mBroadcastRefCount = 0; @@ -464,7 +464,7 @@ class AlarmManagerService extends IAlarmManager.Stub { public AlarmManagerService(Context context) { mContext = context; - mDescriptor = init(); + mNativeData = init(); mNextWakeup = mNextNonWakeup = 0; // We have to set current TimeZone info to kernel @@ -493,7 +493,7 @@ class AlarmManagerService extends IAlarmManager.Stub { mClockReceiver.scheduleDateChangedEvent(); mUninstallReceiver = new UninstallReceiver(); - if (mDescriptor != -1) { + if (mNativeData != 0) { mWaitThread.start(); } else { Slog.w(TAG, "Failed to open alarm driver. Falling back to a handler."); @@ -502,7 +502,7 @@ class AlarmManagerService extends IAlarmManager.Stub { protected void finalize() throws Throwable { try { - close(mDescriptor); + close(mNativeData); } finally { super.finalize(); } @@ -702,7 +702,7 @@ class AlarmManagerService extends IAlarmManager.Stub { // Update the kernel timezone information // Kernel tracks time offsets as 'minutes west of GMT' int gmtOffset = zone.getOffset(System.currentTimeMillis()); - setKernelTimezone(mDescriptor, -(gmtOffset / 60000)); + setKernelTimezone(mNativeData, -(gmtOffset / 60000)); } TimeZone.setDefault(null); @@ -796,7 +796,7 @@ class AlarmManagerService extends IAlarmManager.Stub { private void setLocked(int type, long when) { - if (mDescriptor != -1) + if (mNativeData != 0) { // The kernel never triggers alarms with negative wakeup times // so we ensure they are positive. @@ -809,7 +809,7 @@ class AlarmManagerService extends IAlarmManager.Stub { alarmNanoseconds = (when % 1000) * 1000 * 1000; } - set(mDescriptor, type, alarmSeconds, alarmNanoseconds); + set(mNativeData, type, alarmSeconds, alarmNanoseconds); } else { @@ -1014,11 +1014,11 @@ class AlarmManagerService extends IAlarmManager.Stub { } } - private native int init(); - private native void close(int fd); - private native void set(int fd, int type, long seconds, long nanoseconds); - private native int waitForAlarm(int fd); - private native int setKernelTimezone(int fd, int minuteswest); + private native long init(); + private native void close(long nativeData); + private native void set(long nativeData, int type, long seconds, long nanoseconds); + private native int waitForAlarm(long nativeData); + private native int setKernelTimezone(long nativeData, int minuteswest); private void triggerAlarmsLocked(ArrayList<Alarm> triggerList, long nowELAPSED, long nowRTC) { // batches are temporally sorted, so we need only pull from the @@ -1158,7 +1158,7 @@ class AlarmManagerService extends IAlarmManager.Stub { while (true) { - int result = waitForAlarm(mDescriptor); + int result = waitForAlarm(mNativeData); triggerList.clear(); @@ -1340,7 +1340,7 @@ class AlarmManagerService extends IAlarmManager.Stub { // daylight savings information. TimeZone zone = TimeZone.getTimeZone(SystemProperties.get(TIMEZONE_PROPERTY)); int gmtOffset = zone.getOffset(System.currentTimeMillis()); - setKernelTimezone(mDescriptor, -(gmtOffset / 60000)); + setKernelTimezone(mNativeData, -(gmtOffset / 60000)); scheduleDateChangedEvent(); } } |