Revert "up-daemon: Handle the AC is online but the battery is discharging"

The commit being reverted introduces the bug #306 by claiming external
power is not available when the device battery begins to discharge for
any reason.

We fix this issue by reverting to the old behaviour of reporting
external power being available as long as it's online. We then fix
issue #276 via alternative means.

Resolves: #306

This reverts commit 9d754d8b2f.
This commit is contained in:
initramfs 2025-04-08 20:14:36 +00:00
parent 707af75194
commit 51b30dae8b
No known key found for this signature in database
GPG key ID: 0BF5E22B0D6B4C3B

View file

@ -372,15 +372,12 @@ up_daemon_get_on_ac_local (UpDaemon *daemon, gboolean *has_ac)
gboolean ret;
gboolean result = FALSE;
gboolean online;
UpDaemonPrivate *priv;
UpDevice *device;
GPtrArray *array;
if (has_ac)
*has_ac = FALSE;
priv = up_daemon_get_instance_private (daemon);
/* ask each device */
array = up_device_list_get_array (daemon->priv->power_devices);
for (i=0; i<array->len; i++) {
@ -393,14 +390,6 @@ up_daemon_get_on_ac_local (UpDaemon *daemon, gboolean *has_ac)
break;
}
}
/* if battery is discharging and AC is online, return FALSE
since a low power charger maybe plugged to the system */
if (priv->kind == UP_DEVICE_KIND_BATTERY &&
priv->state == UP_DEVICE_STATE_DISCHARGING &&
online)
result = FALSE;
g_ptr_array_unref (array);
return result;
}