Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[tklock] Do not blank when dismissing alarm with side swipe. Fixes JB…
…#35239

When the device is locked and display wakes up due to alarm which is then
dismissed via side swipe, the ui makes transition from alarm ui to device
unlock view without going through the default lockscreen. This leaves
display state restore active and display can blank abruptly if the user
does not immediately start to type the lock code.

Disable display state restore if ui has been left at state where lockscreen
is active and interaction expected after linger time (not associated with
calls) finishes.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jun 2, 2017
1 parent a5653f7 commit a854b9a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tklock.c
Expand Up @@ -3249,6 +3249,7 @@ static void tklock_proxlock_rethink(void)
typedef struct
{
uiexctype_t mask;
uiexctype_t last;
display_state_t display;
bool tklock;
device_lock_state_t devicelock;
Expand All @@ -3264,6 +3265,7 @@ typedef struct
static exception_t exdata =
{
.mask = UIEXC_NONE,
.last = UIEXC_NONE,
.display = MCE_DISPLAY_UNDEF,
.tklock = false,
.devicelock = DEVICE_LOCK_UNDEFINED,
Expand Down Expand Up @@ -3380,6 +3382,12 @@ static void tklock_uiexcept_rethink(void)
goto EXIT;
}

/* Track states that have gotten topmost before linger */
if( active != UIEXC_LINGER )
exdata.last = UIEXC_NONE;
else if( active_prev != UIEXC_LINGER )
exdata.last = active_prev;

/* Special case: tklock changes during incoming calls */
if( exdata.tklock ) {
switch( call_state ) {
Expand Down Expand Up @@ -3597,6 +3605,7 @@ static void tklock_uiexcept_cancel(void)
}

exdata.mask = UIEXC_NONE;
exdata.last = UIEXC_NONE;
exdata.display = MCE_DISPLAY_UNDEF;
exdata.tklock = false;
exdata.devicelock = DEVICE_LOCK_UNDEFINED;
Expand Down Expand Up @@ -3676,6 +3685,28 @@ static gboolean tklock_uiexcept_linger_cb(gpointer aptr)
}

mce_log(LL_DEBUG, "linger timeout");

/* Disable state restore if lockscreen is active and interaction
* expected after linger. */
if( display_state_next == MCE_DISPLAY_ON &&
tklock_ui_enabled && interaction_expected ) {
if( exdata.last == UIEXC_CALL ) {
/* End of call is exception within exception because
* the call ui can be left on top of the lockscreen and
* there is no way to know whether that happened or not.
*
* Do not disable state restore and assume the linger
* time has been long enough for the user to have done
* significant enough actions during it to have disabled
* the state restore in other ways.
*/
}
else {
tklock_uiexcept_deny_state_restore(true,
"interaction during linger");
}
}

tklock_uiexcept_finish();

EXIT:
Expand Down

0 comments on commit a854b9a

Please sign in to comment.