Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 38bf5146 authored by Greg Hackmann's avatar Greg Hackmann
Browse files

Move time setting code from SystemClock to AlarmManagerService



On devices using /dev/rtc instead of /dev/alarm, updating the
time-of-day clock and RTC are separate syscalls.  Hence the clock and
RTC could be left in inconsistent states if two threads called
SystemClock.setCurrentTimeMillis() simultaneously.

By moving this code into AlarmManagerService, we can put a global lock
around AlarmManagerService.setTime() and prevent the race condition.

Note that access to SystemClock.setCurrentTimeMillis() is now gated by
android.permission.SET_TIME, where before it was gated by filesystem
permissions (i.e., could the process write to /dev/alarm or /dev/rtc).

Change-Id: Ia34899a4cde983656305fd2ef466dfe908ed23c8
Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
parent 05cebdc2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment