Skip to content

Commit

Permalink
charger: press power key to turn off charging animation
Browse files Browse the repository at this point in the history
When charging animation is on, press power key to turn it off.

CRs-Fixed: 535893
Change-Id: Iaac536351426a09cb23c6d77ff3229a8901aaf70
  • Loading branch information
Xu Kai authored and hyperb1iss committed Oct 7, 2013
1 parent 55a9140 commit 6c2f036
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions charger/charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ static void set_next_key_check(struct charger *charger,

static void process_key(struct charger *charger, int code, int64_t now)
{
struct animation *batt_anim = charger->batt_anim;
struct key_state *key = &charger->keys[code];
int64_t next_key_check;

Expand All @@ -948,8 +949,17 @@ static void process_key(struct charger *charger, int code, int64_t now)
} else {
/* if the power key got released, force screen state cycle */
if (key->pending) {
request_suspend(false);
kick_animation(charger->batt_anim);
if (!batt_anim->run) {
request_suspend(false);
kick_animation(charger->batt_anim);
} else {
reset_animation(batt_anim);
charger->next_screen_transition = -1;
gr_fb_blank(true);
set_backlight(false);
if (charger->num_supplies_online > 0)
request_suspend(true);
}
}
}
} else {
Expand Down

0 comments on commit 6c2f036

Please sign in to comment.