profiles/battery: Reset battery value cache on disconnect
authorSonny Sasaka <sonnysasaka@chromium.org>
Tue, 30 Mar 2021 18:38:35 +0000 (11:38 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:35 +0000 (19:08 +0530)
Due to cache in batt object, bluetoothd fails to update publish the
battery value after reconnection when the battery value does not change
compared to before reconnection. We should reset the battery percentage
cache on disconnect.

Reviewed-by: Alain Michaud <alainm@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
profiles/battery/battery.c

index 81f849d..176d127 100644 (file)
@@ -75,6 +75,7 @@ static void batt_free(struct batt *batt)
 static void batt_reset(struct batt *batt)
 {
        batt->attr = NULL;
+       batt->percentage = -1;
        gatt_db_unref(batt->db);
        batt->db = NULL;
        bt_gatt_client_unref(batt->client);