Skip to content

Commit

Permalink
Consider "undefined" device lock state equal to "unlocked"
Browse files Browse the repository at this point in the history
When lipstick is restarted and device lock is not in use, ui ends
up showing lock screen instead of home. This happens initial
device lock = "undefined" is interpreted by mce as "locked".

Equate "undefined" device lock state with "unlocked" instead.

[mce] Consider "undefined" device lock state equal to "unlocked". Fixes JB#24138
  • Loading branch information
spiiroin committed Oct 31, 2014
1 parent 983eb6b commit a14dbcf
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tklock.c
Expand Up @@ -529,11 +529,39 @@ static void tklock_datapipe_system_state_cb(gconstpointer data)
/** Device lock is active; assume false */
static bool device_lock_active = false;

/** Device lock states */
enum
{
/** Device lock is not active */
DEVICE_LOCK_UNLOCKED = 0,

/** Device lock is active */
DEVICE_LOCK_LOCKED = 1,

/** Initial startup value; from mce p.o.v. equals not active */
DEVICE_LOCK_UNDEFINED = 2,
} device_lock_state_t;

/** Push device lock state value into device_lock_active_pipe datapipe
*/
static void tklock_datapipe_set_device_lock_active(int state)
{
bool locked = (state != 0);
bool locked = true;

switch( state ) {
case DEVICE_LOCK_UNLOCKED:
case DEVICE_LOCK_UNDEFINED:
locked = false;
break;

case DEVICE_LOCK_LOCKED:
break;

default:
mce_log(LL_WARN, "unknown device lock state=%d; assuming locked",
state);
break;
}

if( device_lock_active != locked ) {
mce_log(LL_DEVEL, "device lock state = %s", locked ? "locked" : "unlocked");
Expand Down

0 comments on commit a14dbcf

Please sign in to comment.