Skip to content

Commit

Permalink
[tklock] Do not deactivate lockscreen on mce restart. Fixes JB#44605
Browse files Browse the repository at this point in the history
Restarting mce while device is not locked leads to lockscreen getting
deactivated.

While the desirable behavior would be to always retain lockscreen
status over mce restarts, it is not possible with the currently
available ipc mechanisms.

Opt to potentially unnecessary lockscreen activation as a lesser evil.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Mar 8, 2019
1 parent 6538e19 commit de1f560
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tklock.c
Expand Up @@ -836,9 +836,30 @@ static void tklock_datapipe_lipstick_service_state_cb(gconstpointer data)
service_state_repr(prev),
service_state_repr(lipstick_service_state));

bool enable_tklock = false;

/* Tklock is applicable only when lipstick is running */
if( lipstick_service_state == SERVICE_STATE_RUNNING ) {
/* STOPPED -> RUNNING: Implies lipstick start / restart.
* In this case lockscreen status is decided by lipstick.
* We achieve tklock state synchronization by making a
* lockscreen deactivation request - which lipstick can
* then choose to honor or override.
*
* UNDEF -> RUNNING: Implies a mce restart while lipstick
* is running. What we would like to happen is that
* things stay exactly as they were. However there is
* no way to recover lockscreen state from lipstick.
* So in order to err on the safer side, we activate
* lockscreen to get tklock state in sync again.
*/
if( prev == SERVICE_STATE_UNDEF )
enable_tklock = true;
}

// force tklock ipc
tklock_ui_notified = -1;
tklock_ui_set_enabled(false);
tklock_ui_set_enabled(enable_tklock);

EXIT:
return;
Expand Down

0 comments on commit de1f560

Please sign in to comment.