mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-02-01 07:50:47 +00:00
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
54 lines
1.4 KiB
C++
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
|