diff --git a/fs/timerfd.c b/fs/timerfd.c index de8e736bbf7bb..492fb46fa40e4 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -415,6 +415,15 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); + // disabling alarms for android on x86 platforms + // doing it in a way that won't cause errors in frameworks/base/apex/jobscheduler/service/jni/com_android_server_alarm_AlarmManagerService.cpp + if(clockid == CLOCK_REALTIME_ALARM){ + clockid = CLOCK_REALTIME; + } + if(clockid == CLOCK_BOOTTIME_ALARM){ + clockid = CLOCK_BOOTTIME; + } + if ((flags & ~TFD_CREATE_FLAGS) || (clockid != CLOCK_MONOTONIC && clockid != CLOCK_REALTIME && diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index ed3c4a9543982..d682a1423449c 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -498,6 +498,12 @@ static int common_timer_create(struct k_itimer *new_timer) static int do_timer_create(clockid_t which_clock, struct sigevent *event, timer_t __user *created_timer_id) { + if(which_clock == CLOCK_REALTIME_ALARM){ + which_clock = CLOCK_REALTIME; + } + if(which_clock == CLOCK_BOOTTIME_ALARM){ + which_clock = CLOCK_BOOTTIME; + } const struct k_clock *kc = clockid_to_kclock(which_clock); struct k_itimer *new_timer; int error, new_timer_id;