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

Commit a7cb6377 authored by Mao Jinlong's avatar Mao Jinlong Committed by Rashed Abdel-Tawab
Browse files

DeskClock : Improve the priority of power off alarm broadcast

If device power off before power off alarm action is received, power
off alarm value will not be set to rtc. Then this function will not
work. So set power off alarm broadcast to foreground action to make
it be received in time.

CRs-Fixed: 2075052
Change-Id: I6750565396fc79d98e102d2e6515963f3ef978c8
parent fc0792e3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1014,6 +1014,7 @@ public final class AlarmStateManager extends BroadcastReceiver {
    private static void setPowerOffAlarm(Context context, AlarmInstance instance) {
         LogUtils.i("Set next power off alarm : instance id "+ instance.mId);
         Intent intent = new Intent(ACTION_SET_POWEROFF_ALARM);
         intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
         intent.setPackage(POWER_OFF_ALARM_PACKAGE);
         intent.putExtra(TIME, instance.getAlarmTime().getTimeInMillis());
         context.sendBroadcast(intent);
@@ -1021,6 +1022,7 @@ public final class AlarmStateManager extends BroadcastReceiver {

    private static void cancelPowerOffAlarm(Context context, AlarmInstance instance) {
         Intent intent = new Intent(ACTION_CANCEL_POWEROFF_ALARM);
         intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
         intent.putExtra(TIME, instance.getAlarmTime().getTimeInMillis());
         intent.setPackage(POWER_OFF_ALARM_PACKAGE);
         context.sendBroadcast(intent);