mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 11:55:31 -04:00
universal7885: parts-aidl: Run clang-format on smartcharge impl
This commit is contained in:
parent
5aab0c64ed
commit
f2228a093e
2 changed files with 13 additions and 9 deletions
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
#include "SmartCharge.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <FileIO.h>
|
||||
#include "BatteryConstants.h"
|
||||
#include <FileIO.h>
|
||||
#include <chrono>
|
||||
|
||||
namespace aidl::vendor::eureka::hardware::parts {
|
||||
|
||||
|
|
@ -24,20 +24,23 @@ void SmartCharge::battery_monitor(void) {
|
|||
while (kShouldRun) {
|
||||
auto batt = FileIO::readline(BATTERY_CAPACITY_CURRENT);
|
||||
if (batt >= limit) {
|
||||
if (kTookAction) goto sleep;
|
||||
if (kTookAction)
|
||||
goto sleep;
|
||||
FileIO::writeline(BATTERY_CHARGE, 1);
|
||||
kTookAction = true;
|
||||
limit_stat += 1;
|
||||
} else if (batt <= restart) {
|
||||
if (kTookAction) goto sleep;
|
||||
if (kTookAction)
|
||||
goto sleep;
|
||||
FileIO::writeline(BATTERY_CHARGE, 0);
|
||||
kTookAction = true;
|
||||
restart_stat += 1;
|
||||
} else {
|
||||
if (!kTookAction) goto sleep;
|
||||
if (!kTookAction)
|
||||
goto sleep;
|
||||
kTookAction = false;
|
||||
}
|
||||
sleep:
|
||||
sleep:
|
||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||
}
|
||||
}
|
||||
|
|
@ -48,7 +51,7 @@ sleep:
|
|||
EX_ILLEGAL_ARGUMENT, "Start called without configuring.");
|
||||
|
||||
kShouldRun = true;
|
||||
monitor_th = new std::thread([this] {battery_monitor();});
|
||||
monitor_th = new std::thread([this] { battery_monitor(); });
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
namespace aidl::vendor::eureka::hardware::parts {
|
||||
|
||||
struct SmartCharge : public BnSmartCharge {
|
||||
public:
|
||||
public:
|
||||
// Methods from ::aidl::vendor::eureka::hardware::parts::ISmartCharge
|
||||
// follow.
|
||||
::ndk::ScopedAStatus start(void);
|
||||
|
|
@ -28,7 +28,8 @@ struct SmartCharge : public BnSmartCharge {
|
|||
::ndk::ScopedAStatus setConfig(int32_t limit, int32_t restart);
|
||||
::ndk::ScopedAStatus getLimitCnt(int32_t *_aidl_return);
|
||||
::ndk::ScopedAStatus getRestartCnt(int32_t *_aidl_return);
|
||||
private:
|
||||
|
||||
private:
|
||||
int limit;
|
||||
int restart;
|
||||
int limit_stat;
|
||||
|
|
|
|||
Loading…
Reference in a new issue