Skip to content

Commit

Permalink
[powerkey] Do not bypass lockscreen if proximity sensor is covered. F…
Browse files Browse the repository at this point in the history
…ixes JB#32668

By default powerkey presses are acted on regardless of the proximity
sensor state. This can cause problems especially if powerkey is
configured to bypass lockscreen.

Do not allow "tkunlock" powerkey action to be taken while proximity
sensor is in covered state. This way users can alway unblank the
display even if the proximity sensor is covered, but touch interaction
is needed to get access to applications.
  • Loading branch information
spiiroin committed Oct 6, 2015
1 parent e5dac14 commit cea48ef
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions powerkey.c
Expand Up @@ -637,6 +637,9 @@ pwrkey_action_tklock(void)
static void
pwrkey_action_tkunlock(void)
{
cover_state_t proximity_sensor_state =
datapipe_get_gint(proximity_sensor_pipe);

display_state_t target = datapipe_get_gint(display_state_next_pipe);

/* Only unlock if we are in/entering fully powered on display state */
Expand All @@ -650,6 +653,16 @@ pwrkey_action_tkunlock(void)
}

lock_state_t request = LOCK_OFF;

/* Even if powerkey actions are allowed to work while proximity
* sensor is covered, we must not deactivatie the lockscreen */
if( proximity_sensor_state != COVER_OPEN ) {
mce_log(LL_DEBUG, "Proximity sensor %s; rejecting tklock=%s",
proximity_state_repr(proximity_sensor_state),
lock_state_repr(request));
goto EXIT;
}

mce_log(LL_DEBUG, "Requesting tklock=%s", lock_state_repr(request));
execute_datapipe(&tk_lock_pipe,
GINT_TO_POINTER(request),
Expand Down

0 comments on commit cea48ef

Please sign in to comment.