Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Do not activate lockscreen during display power down
When simultaneous display blanking and ui locking occurs (e.g. power
key press), the lockscreen related animations get activated during
display power down.

Delay tklock indication broadcast until display power down has been
finished.

[mce] Do not activate lockscreen during display power down. Contributes to JB#29213
  • Loading branch information
spiiroin committed May 29, 2015
1 parent df11e33 commit e4c9607
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tklock.c
Expand Up @@ -265,6 +265,13 @@ static void tklock_sysfs_probe(void);

// dbus ipc with systemui

static void tklock_ui_notify_rethink_wakelock(void);
static bool tklock_ui_notify_must_be_delayed(void);
static gboolean tklock_ui_notify_end_cb(gpointer data);
static gboolean tklock_ui_notify_beg_cb(gpointer data);
static void tklock_ui_notify_schdule(void);
static void tklock_ui_notify_cancel(void);

static void tklock_ui_eat_event(void);
static void tklock_ui_open(void);
static void tklock_ui_close(void);
Expand Down Expand Up @@ -746,6 +753,9 @@ static void tklock_datapipe_display_state_cb(gconstpointer data)
tklock_proxlock_rethink();

tklock_evctrl_rethink();

tklock_ui_notify_schdule();

EXIT:
return;
}
Expand Down Expand Up @@ -786,6 +796,8 @@ static void tklock_datapipe_display_state_next_cb(gconstpointer data)

tklock_lpmui_pre_transition_actions();

tklock_ui_notify_schdule();

EXIT:
return;

Expand Down Expand Up @@ -4234,6 +4246,33 @@ static void tklock_ui_notify_rethink_wakelock(void)
return;
}

static bool tklock_ui_notify_must_be_delayed(void)
{
bool delay = false;

/* We do not want to send tklock changes during display power
* off sequence as those might trigger lockscreen related
* animations at UI side */

if( display_state == MCE_DISPLAY_POWER_DOWN ) {
/* Powering down the display for any reason */
delay = true;
}
else if( display_state != display_state_next ) {
switch( display_state_next ) {
case MCE_DISPLAY_OFF:
case MCE_DISPLAY_LPM_OFF:
/* Making transition to a blanked display state */
delay = true;
break;
default:
break;
}
}

return delay;
}

static gboolean tklock_ui_notify_end_cb(gpointer data)
{
(void) data;
Expand All @@ -4259,6 +4298,9 @@ static gboolean tklock_ui_notify_beg_cb(gpointer data)

tklock_ui_notify_beg_id = 0;

if( tklock_ui_notify_must_be_delayed() )
goto EXIT;

bool current = tklock_datapipe_have_tklock_submode();

if( tklock_ui_notified == current )
Expand Down Expand Up @@ -4312,10 +4354,15 @@ static void tklock_ui_notify_schdule(void)
g_source_remove(tklock_ui_notify_end_id),
tklock_ui_notify_end_id = 0;
}

if( tklock_ui_notify_must_be_delayed() )
goto EXIT;

if( !tklock_ui_notify_beg_id ) {
tklock_ui_notify_beg_id = g_idle_add(tklock_ui_notify_beg_cb, 0);
}

EXIT:
tklock_ui_notify_rethink_wakelock();
}

Expand Down

0 comments on commit e4c9607

Please sign in to comment.