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

Skip to content
Commit 8a7af5a9 authored by Luofan Chen's avatar Luofan Chen
Browse files

ChargingControl: Decouple charging control and main logic

The existing Hardware Abstraction Layer (HAL) supports two distinct
control modes: TOGGLE and DEADLINE, each offering unique capabilities.
For instance, the TOGGLE mode allows for control over both charging
time and limit, while the DEADLINE mode only enables control over the
charging time. Managing these separate logic streams within a single
ChargingControlController class complicates the development process.

This commit separates the specific charging control logic — determining
what to send to the HAL—from the primary logic. The charging control
module now offers providers tailored to each HAL-supported charging
control mode, allowing for limit control, time control, or both. When
required, the ChargingControlController invokes these specific providers.

This commit also saparates other parts, like notifications, from the
main logic, to a saparate class.

This separation simplifies the codebase. Moreover, when introducing a new
mode in the HAL, developers only need to implement the corresponding
provider's logic based on the mode's capabilities. And minimal changes
are needed in the primary logic.

Change-Id: Ie40020c2df4141d4aa6385c8f5565821af942755
parent 8709a3a5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment