Files
device_google_wahoo/health/LearnedCapacityBackupRestore.h
Jack Wu 282b3e3c9b healthd: fix the over estimated battery capacity
Overwrite the gauge capacity with the backup one if the gauge capacity
reset to nominal.

Test: fake /sys/class/power_supply/bms/charge_full to nominal and
      check if it can be restored from /persist/battery/qcom_charge_full
Bug: 158838006
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: I4b85dd5e0c3ca929044aa8776294b841db7214e1
2020-06-16 07:09:40 +00:00

54 lines
1.4 KiB
C++

/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
#define DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <string>
namespace device {
namespace google {
namespace wahoo {
namespace health {
class LearnedCapacityBackupRestore {
public:
LearnedCapacityBackupRestore();
void Restore();
void Backup();
private:
int sw_cap_;
int hw_cap_;
int nom_cap_;
void ReadFromStorage();
void SaveToStorage();
void ReadNominalCapacity();
void ReadFromSRAM();
void SaveToSRAM();
};
} // namespace health
} // namespace wahoo
} // namespace google
} // namespace device
#endif // #ifndef DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H