Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c7f9195 authored by Fenglin Wu's avatar Fenglin Wu Committed by Steve Kondik
Browse files

healthd: charger: Turn off charging animation by power key event

Currently, the charging animation can be turned on by power key event. Add
support to make charging animation can be turned off by power key event.

Change-Id: Icc8101ae3d4fd777efedeff10ca535a9e6e7a57d
parent 0fa95189
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -594,6 +594,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;

@@ -620,8 +621,16 @@ 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) {
                if (!batt_anim->run) {
                    request_suspend(false);
                kick_animation(charger->batt_anim);
                    kick_animation(batt_anim);
                } else {
                    reset_animation(batt_anim);
                    charger->next_screen_transition = -1;
                    gr_fb_blank(true);
                    if (charger->charger_connected)
                        request_suspend(true);
                }
            }
        }
    }