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

Commit 9a11aaab authored by Ruchi Kandoi's avatar Ruchi Kandoi
Browse files

Charger: Improve screen on/off scenarios



In charger-mode, power off/on screen as required, for efficient
charging.
Turn on screen on power-key press rather than on key-release.
On charge-cable removal, kick animation to show the correct battery
level.

Change-Id: I74eaf8681466c44dbd76a820adf154053e0fc43a
Signed-off-by: default avatarPavan Kumar S <pavan.kumar.s@intel.com>
Signed-off-by: default avatarJenny TC <jenny.tc@intel.com>
Signed-off-by: default avatarYong Yao <yong.yao@intel.com>
parent a84b1f64
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -537,11 +537,16 @@ static void process_key(struct charger *charger, int code, int64_t now)
                 * make sure we wake up at the right-ish time to check
                 */
                set_next_key_check(charger, key, POWER_ON_KEY_TIME);

               /* Turn on the display and kick animation on power-key press
                * rather than on key release
                */
                kick_animation(charger->batt_anim);
                request_suspend(false);
            }
        } else {
            /* if the power key got released, force screen state cycle */
            if (key->pending) {
                request_suspend(false);
                kick_animation(charger->batt_anim);
            }
        }
@@ -564,6 +569,11 @@ static void handle_power_supply_state(struct charger *charger, int64_t now)
        return;

    if (!charger->charger_connected) {

        /* Last cycle would have stopped at the extreme top of battery-icon
         * Need to show the correct level corresponding to capacity.
         */
        kick_animation(charger->batt_anim);
        request_suspend(false);
        if (charger->next_pwr_check == -1) {
            charger->next_pwr_check = now + UNPLUGGED_SHUTDOWN_TIME;