Skip to content

Commit

Permalink
[state] Ignore alarms on shutdown when home is encrypted. Fixes JB#46072
Browse files Browse the repository at this point in the history
Normally dsme reboots to act-dead instead of shutting down when there
is an alarm that is about to ring in the next couple of minutes. This
does not make sense when home is encrypted and alarms can't be shown
in act-dead.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jun 12, 2019
1 parent 5dd2347 commit 1a3db09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .depend
Expand Up @@ -481,6 +481,7 @@ modules/startup.pic.o:\
modules/state.o:\
modules/state.c\
dsme/dsme-rd-mode.h\
dsme/utility.h\
include/dsme/logging.h\
include/dsme/modulebase.h\
include/dsme/modules.h\
Expand All @@ -496,6 +497,7 @@ modules/state.o:\
modules/state.pic.o:\
modules/state.c\
dsme/dsme-rd-mode.h\
dsme/utility.h\
include/dsme/logging.h\
include/dsme/modulebase.h\
include/dsme/modules.h\
Expand Down
8 changes: 6 additions & 2 deletions modules/state.c
Expand Up @@ -48,6 +48,7 @@
#include <dsme/state.h>

#include "../dsme/dsme-rd-mode.h"
#include "../dsme/utility.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -365,9 +366,12 @@ static dsme_state_t select_state(void)
/* favor normal shutdown over reboot over actdead */
if (shutdown_requested &&
(charger_state == CHARGER_DISCONNECTED) &&
!alarm_set)
(!alarm_set || dsme_home_is_encrypted()))
{
dsme_log(LOG_NOTICE, PFIX"Normal shutdown");
dsme_log(LOG_NOTICE, PFIX"Normal shutdown%s",
alarm_set
? " (alarm set, but ignored due to encrypted home)"
: "");
state = DSME_STATE_SHUTDOWN;
} else if (reboot_requested) {
dsme_log(LOG_NOTICE, PFIX"Reboot");
Expand Down

0 comments on commit 1a3db09

Please sign in to comment.