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

Commit 1a5e756a authored by Todd Poynor's avatar Todd Poynor Committed by Ruchi Kandoi
Browse files

power: android-battery: leave full/not-charging status when charger re-sensed



If charger was connected and a charge source change event occurs such that
the charger is still connected (or a different charge source connected),
do not overwrite an existing state such as full or not-charging.  Only
switch from discharging to charging on a charge source change event.

Change-Id: I1b841c8f3a92bf15074999e18b17d1d19ce028d7
Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
parent f5f4cedc
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -399,8 +399,18 @@ static void android_bat_charger_work(struct work_struct *work)
		break;
	case CHARGE_SOURCE_USB:
	case CHARGE_SOURCE_AC:
		/*
		 * If charging status indicates a charger was already
		 * connected prior to this and a non-charging status is
		 * set, leave the status alone.
		 */
		if (battery->charging_status ==
		    POWER_SUPPLY_STATUS_DISCHARGING ||
		    battery->charging_status == POWER_SUPPLY_STATUS_UNKNOWN) {
			battery->charging_status = POWER_SUPPLY_STATUS_CHARGING;
			android_bat_enable_charging(battery, true);
		}

		break;
	default:
		pr_err("%s: Invalid charger type\n", __func__);