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

Skip to content
Commit b76aa50f authored by James Lemieux's avatar James Lemieux
Browse files

Fix alarm not firing in memory-pressure situations

Bug: 25846551

The original form of the code that fires an alarm is:
AlarmManager -> BroadcastReceiver -> Service.

The new form of the code that fires an alarm is:
AlarmManager -> Service.

Evidence exists that the system lowmemorykiller may elect to kill the
clock app after BroadcastReceiver.onReceive(...) completes but before
Service.onStartCommand(...) begins. When this occurs, the results are
disastrous as the clock fails to fire at the appropriate time.

To remove this possibility, all alarm state changes are delivered to the
Service. The methods that manipulate database state within
BroadcastReceiver have been made public and static and are called
directly from the Service to perform the same work as before. If the
alarm state transition is to the FIRING state, the AlarmService also
performs the work of posting the firing notification in the foreground.
All of this occurs during the handling of a single Intent on the same
thread within the service which should no longer provide
lowmemorykiller with any opportunities to prevent the firing of an alarm
by killing the clock app.

Change-Id: I3629a5b725a758f680f41611939a5bbeec23238a
parent 0dd0cac6
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