Skip to content

Commit

Permalink
[tklock] Exit from LPM on device unlock. JB#42145
Browse files Browse the repository at this point in the history
While devicelock UI does not really support unlocking via fingerprint from
LPM display state, it still activates fingerprint scanner and unlocks the
device when fingerprint is identified. But there is no unlock feedback
(vibration) and LPM stays on screen - which can be confusing and/or leave
the device unlocked accidentally.

As a workaround: When MCE sees device getting unlocked in LPM state,
execute unlock feedback and exit LPM state.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Aug 15, 2018
1 parent cd122e2 commit bee58a8
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions tklock.c
Expand Up @@ -604,6 +604,12 @@ static int tklock_ui_notified = -1; // does not match bool values
/** System state; is undefined at bootup, can't assume anything */
static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF;

/** Display state; undefined initially, can't assume anything */
static display_state_t display_state_curr = MCE_DISPLAY_UNDEF;

/** Next Display state; undefined initially, can't assume anything */
static display_state_t display_state_next = MCE_DISPLAY_UNDEF;

/** Change notifications for system_state
*/
static void tklock_datapipe_system_state_cb(gconstpointer data)
Expand Down Expand Up @@ -690,8 +696,28 @@ static void tklock_datapipe_devicelock_state_cb(gconstpointer data)
break;
}

if( devicelock_state == DEVICELOCK_STATE_LOCKED )
switch( devicelock_state ) {
case DEVICELOCK_STATE_LOCKED:
tklock_autolock_on_devlock_trigger();
break;
case DEVICELOCK_STATE_UNLOCKED:
if( display_state_next == MCE_DISPLAY_LPM_ON ) {
/* Devicelock ui keeps fingerprint scanner active in LPM state
* and unlocks device on identify, but omits unlock feedback
* and leaves the display state as-is.
*
* As a workaround, execute unlock feedback from mce and
* exit from LPM by removing tklock submode.
*/
datapipe_exec_output_triggers(&ngfd_event_request_pipe,
"unlock_device",
USE_INDATA);
mce_rem_submode_int32(MCE_SUBMODE_TKLOCK);
}
break;
default:
break;
}

EXIT:
return;
Expand Down Expand Up @@ -809,12 +835,6 @@ static void tklock_datapipe_shutting_down_cb(gconstpointer data)
return;
}

/** Display state; undefined initially, can't assume anything */
static display_state_t display_state_curr = MCE_DISPLAY_UNDEF;

/** Next Display state; undefined initially, can't assume anything */
static display_state_t display_state_next = MCE_DISPLAY_UNDEF;

/** Autorelock trigger: assume disabled */
static autorelock_t autorelock_trigger = AUTORELOCK_NO_TRIGGERS;

Expand Down

0 comments on commit bee58a8

Please sign in to comment.