mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-22 04:05:31 -04:00
universal7885: parts-hidl: Refactor code and impl smartcharge
This commit is contained in:
parent
5f6bde3d2b
commit
2e0da038da
27 changed files with 407 additions and 200 deletions
|
|
@ -7,6 +7,7 @@ hidl_interface {
|
||||||
"IFlashBrightness.hal",
|
"IFlashBrightness.hal",
|
||||||
"IDisplayConfigs.hal",
|
"IDisplayConfigs.hal",
|
||||||
"ISwapOnData.hal",
|
"ISwapOnData.hal",
|
||||||
|
"ISmartCharge.hal"
|
||||||
],
|
],
|
||||||
interfaces: ["android.hidl.base@1.0"],
|
interfaces: ["android.hidl.base@1.0"],
|
||||||
gen_java: false,
|
gen_java: false,
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
package vendor.eureka.hardware.parts@1.0;
|
package vendor.eureka.hardware.parts@1.0;
|
||||||
|
|
||||||
interface IBatteryStats {
|
interface IBatteryStats {
|
||||||
getBatteryStats(SysfsType stats) generates (int32_t result);
|
getBatteryStats(BatterySys stats) generates (int32_t result);
|
||||||
setBatteryWritable(SysfsType stats, Number value);
|
setBatteryWritable(BatterySys stats, Status value);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,5 @@
|
||||||
package vendor.eureka.hardware.parts@1.0;
|
package vendor.eureka.hardware.parts@1.0;
|
||||||
|
|
||||||
interface IDisplayConfigs {
|
interface IDisplayConfigs {
|
||||||
writeDisplay(Number enable, Display type);
|
writeDisplay(Status enable, DisplaySys type);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
package vendor.eureka.hardware.parts@1.0;
|
package vendor.eureka.hardware.parts@1.0;
|
||||||
|
|
||||||
interface IFlashBrightness {
|
interface IFlashBrightness {
|
||||||
setFlashlightWritable(Value value);
|
setFlashlightWritable(int32_t value);
|
||||||
setFlashlightEnable(Number enable);
|
setFlashlightEnable(Status enable);
|
||||||
readFlashlightstats(Device device) generates (int32_t value);
|
readFlashlightstats(bool s2mu106) generates (int32_t value);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (C) 2021 Eureka Team
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
package vendor.eureka.hardware.parts@1.0;
|
||||||
|
|
||||||
|
interface ISmartCharge {
|
||||||
|
start();
|
||||||
|
stop();
|
||||||
|
setConfig(int32_t limit, int32_t restart);
|
||||||
|
getLimitCnt() generates (int32_t cnt);
|
||||||
|
getRestartCnt() generates (int32_t cnt);
|
||||||
|
};
|
||||||
|
|
@ -18,4 +18,7 @@ interface ISwapOnData {
|
||||||
setSwapSize(int32_t size /* Size in megabytes */);
|
setSwapSize(int32_t size /* Size in megabytes */);
|
||||||
setSwapOn();
|
setSwapOn();
|
||||||
setSwapOff();
|
setSwapOff();
|
||||||
|
removeSwapFile();
|
||||||
|
getSwapOnResult() generates (bool result);
|
||||||
|
isMutexLocked() generates (bool islocked);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,11 @@ cc_binary {
|
||||||
"Display.cpp",
|
"Display.cpp",
|
||||||
"Swap.cpp",
|
"Swap.cpp",
|
||||||
"SwapHelpers.cpp",
|
"SwapHelpers.cpp",
|
||||||
|
"SmartChargingImpl.cpp",
|
||||||
|
"SmartCharge.cpp",
|
||||||
"service.cpp",
|
"service.cpp",
|
||||||
],
|
],
|
||||||
|
cflags: ["-Wno-thread-safety-negative"],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libhidlbase",
|
"libhidlbase",
|
||||||
"libutils",
|
"libutils",
|
||||||
|
|
|
||||||
|
|
@ -17,95 +17,58 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include "CachedClass.h"
|
||||||
|
#include "BatteryConstants.h"
|
||||||
|
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
|
static BatteryStats *kCached = nullptr;
|
||||||
|
|
||||||
|
static inline const char* BatterySysToPath (parts::V1_0::BatterySys type) {
|
||||||
|
switch (type) {
|
||||||
|
case BatterySys::CAPACITY_MAX:
|
||||||
|
return BATTERY_CAPACITY_MAX;
|
||||||
|
case BatterySys::TEMP:
|
||||||
|
return BATTERY_TEMP;
|
||||||
|
case BatterySys::CAPACITY_CURRENT:
|
||||||
|
return BATTERY_CAPACITY_CURRENT;
|
||||||
|
case BatterySys::CURRENT:
|
||||||
|
return BATTERY_CURRENT;
|
||||||
|
case BatterySys::FASTCHARGE:
|
||||||
|
return BATTERY_FASTCHARGE;
|
||||||
|
case BatterySys::CHARGE:
|
||||||
|
return BATTERY_CHARGE;
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Methods from ::android::hardware::battery::V1_0::IBattery follow.
|
// Methods from ::android::hardware::battery::V1_0::IBattery follow.
|
||||||
Return<int32_t> BatteryStats::getBatteryStats(parts::V1_0::SysfsType stats) {
|
Return<int32_t> BatteryStats::getBatteryStats(parts::V1_0::BatterySys stats) {
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
std::string filename;
|
|
||||||
switch (stats) {
|
|
||||||
case SysfsType::CAPACITY_MAX:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/charge_full";
|
|
||||||
break;
|
|
||||||
case SysfsType::TEMP:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/batt_temp";
|
|
||||||
break;
|
|
||||||
case SysfsType::CAPACITY_CURRENT:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/capacity";
|
|
||||||
break;
|
|
||||||
case SysfsType::CURRENT:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/current_now";
|
|
||||||
break;
|
|
||||||
case SysfsType::FASTCHARGE:
|
|
||||||
filename = "/sys/class/sec/switch/afc_disable";
|
|
||||||
break;
|
|
||||||
case SysfsType::CHARGE:
|
|
||||||
filename =
|
|
||||||
"/sys/devices/platform/battery/power_supply/battery/batt_slate_mode";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
filename = "";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
std::string value;
|
std::string value;
|
||||||
int32_t intvalue;
|
file.open(BatterySysToPath(stats));
|
||||||
file.open(filename);
|
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
getline(file, value);
|
getline(file, value);
|
||||||
file.close();
|
file.close();
|
||||||
std::stringstream val(value);
|
return stoi(value);
|
||||||
val >> intvalue;
|
|
||||||
return intvalue;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> BatteryStats::setBatteryWritable(parts::V1_0::SysfsType stats,
|
Return<void> BatteryStats::setBatteryWritable(parts::V1_0::BatterySys stats,
|
||||||
parts::V1_0::Number value) {
|
parts::V1_0::Status value) {
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
std::string filename;
|
|
||||||
bool FastCharge = false;
|
bool FastCharge = false;
|
||||||
switch (stats) {
|
|
||||||
case SysfsType::CAPACITY_MAX:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/charge_full";
|
|
||||||
break;
|
|
||||||
case SysfsType::TEMP:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/batt_temp";
|
|
||||||
break;
|
|
||||||
case SysfsType::CAPACITY_CURRENT:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/capacity";
|
|
||||||
break;
|
|
||||||
case SysfsType::CURRENT:
|
|
||||||
filename = "/sys/devices/platform/battery/power_supply/battery/current_now";
|
|
||||||
break;
|
|
||||||
case SysfsType::FASTCHARGE:
|
|
||||||
filename = "/sys/class/sec/switch/afc_disable";
|
|
||||||
FastCharge = true;
|
|
||||||
break;
|
|
||||||
case SysfsType::CHARGE:
|
|
||||||
filename =
|
|
||||||
"/sys/devices/platform/battery/power_supply/battery/batt_slate_mode";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
filename = "";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (FastCharge)
|
if (FastCharge)
|
||||||
seteuid(ANDROID_SYSTEM_UID);
|
seteuid(ANDROID_SYSTEM_UID);
|
||||||
file.open(filename);
|
file.open(BatterySysToPath(stats));
|
||||||
int write;
|
file << static_cast<int32_t>(value);
|
||||||
if (value == Number::ENABLE) {
|
|
||||||
write = 1;
|
|
||||||
} else {
|
|
||||||
write = 0;
|
|
||||||
}
|
|
||||||
file << write;
|
|
||||||
file.close();
|
file.close();
|
||||||
if (FastCharge)
|
if (FastCharge)
|
||||||
seteuid(ANDROID_ROOT_UID);
|
seteuid(ANDROID_ROOT_UID);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
IBatteryStats *BatteryStats::getInstance(void) { return new BatteryStats(); }
|
IBatteryStats *BatteryStats::getInstance(void) { USE_CACHED(kCached); }
|
||||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,13 @@
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
using ::android::hardware::hidl_array;
|
|
||||||
using ::android::hardware::hidl_memory;
|
|
||||||
using ::android::hardware::hidl_string;
|
|
||||||
using ::android::hardware::hidl_vec;
|
|
||||||
using ::android::hardware::Return;
|
using ::android::hardware::Return;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
struct BatteryStats : public IBatteryStats {
|
struct BatteryStats : public IBatteryStats {
|
||||||
// Methods from ::vendor::eureka::hardware::parts::V1_0::IBatteryStats follow.
|
// Methods from ::vendor::eureka::hardware::parts::V1_0::IBatteryStats follow.
|
||||||
Return<int32_t> getBatteryStats(SysfsType stats) override;
|
Return<int32_t> getBatteryStats(BatterySys stats) override;
|
||||||
Return<void> setBatteryWritable(SysfsType stats, Number value) override;
|
Return<void> setBatteryWritable(BatterySys stats, Status value) override;
|
||||||
|
|
||||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||||
static IBatteryStats *getInstance(void);
|
static IBatteryStats *getInstance(void);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
constexpr const char* BATTERY_CAPACITY_MAX = "/sys/devices/platform/battery/power_supply/battery/charge_full";
|
||||||
|
constexpr const char* BATTERY_TEMP = "/sys/devices/platform/battery/power_supply/battery/batt_temp";
|
||||||
|
constexpr const char* BATTERY_CAPACITY_CURRENT = "/sys/devices/platform/battery/power_supply/battery/capacity";
|
||||||
|
constexpr const char* BATTERY_CURRENT = "/sys/devices/platform/battery/power_supply/battery/current_now";
|
||||||
|
constexpr const char* BATTERY_FASTCHARGE = "/sys/class/sec/switch/afc_disable";
|
||||||
|
constexpr const char* BATTERY_CHARGE = "/sys/devices/platform/battery/power_supply/battery/batt_slate_mode";
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
template <class C>
|
||||||
|
static inline C *cachedClass(C* cached) {
|
||||||
|
if (cached != nullptr) {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
cached = new C();
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define USE_CACHED(cache) \
|
||||||
|
({ \
|
||||||
|
return cachedClass((cache)); \
|
||||||
|
})
|
||||||
|
|
||||||
|
|
@ -16,19 +16,23 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include "CachedClass.h"
|
||||||
|
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
Return<void> DisplayConfigs::writeDisplay(parts::V1_0::Number enable,
|
static DisplayConfigs *kCached;
|
||||||
parts::V1_0::Display type) {
|
|
||||||
|
Return<void> DisplayConfigs::writeDisplay(parts::V1_0::Status enable,
|
||||||
|
parts::V1_0::DisplaySys type) {
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
std::string writevalue;
|
std::string writevalue;
|
||||||
if (type == Display::DOUBLE_TAP) {
|
if (type == DisplaySys::DOUBLE_TAP) {
|
||||||
writevalue = "aot_enable";
|
writevalue = "aot_enable";
|
||||||
} else if (type == Display::GLOVE_MODE) {
|
} else if (type == DisplaySys::GLOVE_MODE) {
|
||||||
writevalue = "glove_mode";
|
writevalue = "glove_mode";
|
||||||
}
|
}
|
||||||
writevalue += ",";
|
writevalue += ",";
|
||||||
if (enable == Number::ENABLE) {
|
if (enable == Status::ENABLE) {
|
||||||
writevalue += "1";
|
writevalue += "1";
|
||||||
} else {
|
} else {
|
||||||
writevalue += "0";
|
writevalue += "0";
|
||||||
|
|
@ -40,6 +44,6 @@ Return<void> DisplayConfigs::writeDisplay(parts::V1_0::Number enable,
|
||||||
}
|
}
|
||||||
|
|
||||||
IDisplayConfigs *DisplayConfigs::getInstance(void) {
|
IDisplayConfigs *DisplayConfigs::getInstance(void) {
|
||||||
return new DisplayConfigs();
|
USE_CACHED(kCached);
|
||||||
}
|
}
|
||||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||||
|
|
|
||||||
|
|
@ -21,17 +21,13 @@
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
using ::android::hardware::hidl_array;
|
|
||||||
using ::android::hardware::hidl_memory;
|
|
||||||
using ::android::hardware::hidl_string;
|
|
||||||
using ::android::hardware::hidl_vec;
|
|
||||||
using ::android::hardware::Return;
|
using ::android::hardware::Return;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
struct DisplayConfigs : public IDisplayConfigs {
|
struct DisplayConfigs : public IDisplayConfigs {
|
||||||
// Methods from ::vendor::eureka::hardware::parts::V1_0::IDisplayConfigs
|
// Methods from ::vendor::eureka::hardware::parts::V1_0::IDisplayConfigs
|
||||||
// follow.
|
// follow.
|
||||||
Return<void> writeDisplay(Number enable, Display type);
|
Return<void> writeDisplay(Status enable, DisplaySys type);
|
||||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||||
static IDisplayConfigs *getInstance(void);
|
static IDisplayConfigs *getInstance(void);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,21 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include "CachedClass.h"
|
||||||
|
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
|
static FlashBrightness *kCached;
|
||||||
|
|
||||||
// Methods from ::android::hardware::parts::V1_0::IFlashLight follow.
|
// Methods from ::android::hardware::parts::V1_0::IFlashLight follow.
|
||||||
Return<void> FlashBrightness::setFlashlightEnable(parts::V1_0::Number enable) {
|
Return<void> FlashBrightness::setFlashlightEnable(parts::V1_0::Status enable) {
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
std::string writevalue;
|
std::string writevalue;
|
||||||
switch (enable) {
|
switch (enable) {
|
||||||
case Number::ENABLE:
|
case Status::ENABLE:
|
||||||
writevalue = "1";
|
writevalue = "1";
|
||||||
break;
|
break;
|
||||||
case Number::DISABLE:
|
case Status::DISABLE:
|
||||||
writevalue = "0";
|
writevalue = "0";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -39,38 +43,32 @@ Return<void> FlashBrightness::setFlashlightEnable(parts::V1_0::Number enable) {
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> FlashBrightness::setFlashlightWritable(parts::V1_0::Value value) {
|
Return<void> FlashBrightness::setFlashlightWritable(int32_t value) {
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
std::string writevalue = std::to_string((int)value);
|
std::string writevalue = std::to_string(value);
|
||||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||||
file << writevalue;
|
file << writevalue;
|
||||||
file.close();
|
file.close();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<int32_t>
|
Return<int32_t> FlashBrightness::readFlashlightstats(bool s2mu106) {
|
||||||
FlashBrightness::readFlashlightstats(parts::V1_0::Device device) {
|
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
std::string value;
|
std::string value;
|
||||||
int32_t intvalue;
|
|
||||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
getline(file, value);
|
getline(file, value);
|
||||||
file.close();
|
file.close();
|
||||||
std::stringstream val(value);
|
if (s2mu106) {
|
||||||
val >> intvalue;
|
return stoi(value);
|
||||||
if (device == Device::A10) {
|
} else {
|
||||||
return intvalue;
|
return stoi(value) / 21;
|
||||||
} else if (device == Device::NOTA10) {
|
|
||||||
return intvalue / 21;
|
|
||||||
}
|
}
|
||||||
// Never Here
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFlashBrightness *FlashBrightness::getInstance(void) {
|
IFlashBrightness *FlashBrightness::getInstance(void) {
|
||||||
return new FlashBrightness();
|
USE_CACHED(kCached);
|
||||||
}
|
}
|
||||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||||
|
|
|
||||||
|
|
@ -21,19 +21,15 @@
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
using ::android::hardware::hidl_array;
|
|
||||||
using ::android::hardware::hidl_memory;
|
|
||||||
using ::android::hardware::hidl_string;
|
|
||||||
using ::android::hardware::hidl_vec;
|
|
||||||
using ::android::hardware::Return;
|
using ::android::hardware::Return;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
struct FlashBrightness : public IFlashBrightness {
|
struct FlashBrightness : public IFlashBrightness {
|
||||||
// Methods from ::vendor::eureka::hardware::parts::V1_0::IFlashBrightness
|
// Methods from ::vendor::eureka::hardware::parts::V1_0::IFlashBrightness
|
||||||
// follow.
|
// follow.
|
||||||
Return<void> setFlashlightEnable(Number enable);
|
Return<void> setFlashlightEnable(Status enable);
|
||||||
Return<void> setFlashlightWritable(Value value);
|
Return<void> setFlashlightWritable(int32_t value);
|
||||||
Return<int32_t> readFlashlightstats(Device device);
|
Return<int32_t> readFlashlightstats(bool s2mu106);
|
||||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||||
static IFlashBrightness *getInstance(void);
|
static IFlashBrightness *getInstance(void);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
// Copyright (C) 2021 Eureka Team
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
#include "SmartCharge.h"
|
||||||
|
#include "SmartChargingImpl.h"
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include "CachedClass.h"
|
||||||
|
|
||||||
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
|
static SmartCharge *kCached;
|
||||||
|
static SmartChargeImpl *kInst = nullptr;
|
||||||
|
|
||||||
|
static int limit = 0;
|
||||||
|
static int restart = 0;
|
||||||
|
|
||||||
|
static int limit_stat = 0;
|
||||||
|
static int restart_stat = 0;
|
||||||
|
|
||||||
|
Return<void> SmartCharge::start(void) {
|
||||||
|
if (limit == 0 || restart == 0)
|
||||||
|
return Void();
|
||||||
|
kInst = new SmartChargeImpl(limit, restart);
|
||||||
|
kInst->start();
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> SmartCharge::stop(void) {
|
||||||
|
if (kInst != nullptr) {
|
||||||
|
kInst->stop();
|
||||||
|
limit_stat += kInst->charge_limit_cnt;
|
||||||
|
restart_stat += kInst->restart_cnt;
|
||||||
|
delete kInst;
|
||||||
|
kInst = nullptr;
|
||||||
|
}
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> SmartCharge::setConfig(int32_t limit_user, int32_t restart_user) {
|
||||||
|
limit = limit_user;
|
||||||
|
restart = restart_user;
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<int32_t> SmartCharge::getLimitCnt(void) {
|
||||||
|
return limit_stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<int32_t> SmartCharge::getRestartCnt(void) {
|
||||||
|
return restart_stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
ISmartCharge *SmartCharge::getInstance(void) {
|
||||||
|
USE_CACHED(kCached);
|
||||||
|
}
|
||||||
|
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright (C) 2021 Eureka Team
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <hidl/MQDescriptor.h>
|
||||||
|
#include <hidl/Status.h>
|
||||||
|
#include <vendor/eureka/hardware/parts/1.0/ISmartCharge.h>
|
||||||
|
|
||||||
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
|
using ::android::sp;
|
||||||
|
using ::android::hardware::Return;
|
||||||
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
|
struct SmartCharge : public ISmartCharge {
|
||||||
|
// Methods from ::vendor::eureka::hardware::parts::V1_0::ISmartCharge
|
||||||
|
// follow.
|
||||||
|
Return<void> start(void);
|
||||||
|
Return<void> stop(void);
|
||||||
|
Return<void> setConfig(int32_t limit, int32_t restart);
|
||||||
|
Return<int32_t> getLimitCnt(void);
|
||||||
|
Return<int32_t> getRestartCnt(void);
|
||||||
|
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||||
|
static ISmartCharge *getInstance(void);
|
||||||
|
};
|
||||||
|
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
#include "SmartChargingImpl.h"
|
||||||
|
#include <thread>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
|
static std::thread *monitor;
|
||||||
|
static bool shouldRun = false;
|
||||||
|
|
||||||
|
SmartChargeImpl::SmartChargeImpl(int limit, int restart) : limit_percent(limit), restart_percent(restart) {
|
||||||
|
charge_limit_cnt = 0;
|
||||||
|
restart_cnt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void battery_monitor(const int limit_percent, const int restart_percent,
|
||||||
|
int *charge_limit_cnt, int *restart_cnt) {
|
||||||
|
while (shouldRun) {
|
||||||
|
auto batt = stoi(readFile(BATTERY_CAPACITY_CURRENT));
|
||||||
|
if (batt >= limit_percent) {
|
||||||
|
disableSysfs(BATTERY_CHARGE);
|
||||||
|
*charge_limit_cnt += 1;
|
||||||
|
} else if (batt <= restart_percent) {
|
||||||
|
enableSysfs(BATTERY_CHARGE);
|
||||||
|
*restart_cnt += 1;
|
||||||
|
}
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmartChargeImpl::start(void) {
|
||||||
|
shouldRun = true;
|
||||||
|
monitor = new std::thread(battery_monitor, limit_percent,
|
||||||
|
restart_percent, &charge_limit_cnt, &restart_cnt);
|
||||||
|
monitor->join();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmartChargeImpl::stop(void) {
|
||||||
|
shouldRun = false;
|
||||||
|
monitor = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include "BatteryConstants.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
|
class SmartChargeImpl {
|
||||||
|
public:
|
||||||
|
SmartChargeImpl(int limit, int restart);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
|
||||||
|
int charge_limit_cnt;
|
||||||
|
int restart_cnt;
|
||||||
|
private:
|
||||||
|
const int limit_percent;
|
||||||
|
const int restart_percent;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void disableSysfs(const char* path) {
|
||||||
|
const std::string pathcpp = std::string(path);
|
||||||
|
std::ofstream file;
|
||||||
|
file.open(pathcpp);
|
||||||
|
if (file.is_open()) {
|
||||||
|
file << 0;
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void enableSysfs(const char* path) {
|
||||||
|
const std::string pathcpp = std::string(path);
|
||||||
|
std::ofstream file;
|
||||||
|
file.open(pathcpp);
|
||||||
|
if (file.is_open()) {
|
||||||
|
file << 1;
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline std::string readFile(const char* path) {
|
||||||
|
const std::string pathcpp = std::string(path);
|
||||||
|
std::ifstream file;
|
||||||
|
file.open(pathcpp);
|
||||||
|
std::string result;
|
||||||
|
if (file.is_open()) {
|
||||||
|
getline(file, result);
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
@ -16,33 +16,69 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/swap.h>
|
#include <sys/swap.h>
|
||||||
#include <stdio.h>
|
#include <unistd.h>
|
||||||
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
|
#include "CachedClass.h"
|
||||||
|
|
||||||
static int mSwapSize = 100;
|
static int mSwapSize = 100;
|
||||||
extern int mkswap (std::string filename);
|
extern int mkswap (const char *filename);
|
||||||
extern void mkfile(int filesize, std::string name);
|
extern void mkfile(int filesize, const char *name);
|
||||||
|
|
||||||
static std::string SWAP_PATH = "/data/swap/swapfile";
|
constexpr const char* SWAP_PATH = "/data/swap/swapfile";
|
||||||
|
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
|
static SwapOnData *kCached = nullptr;
|
||||||
|
|
||||||
|
static std::mutex thread_lock;
|
||||||
|
|
||||||
|
static bool swapOnRes = false;
|
||||||
|
|
||||||
Return<void> SwapOnData::setSwapSize(int32_t size) {
|
Return<void> SwapOnData::setSwapSize(int32_t size) {
|
||||||
mSwapSize = size;
|
mSwapSize = size;
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> SwapOnData::setSwapOn() {
|
Return<void> SwapOnData::removeSwapFile(void) {
|
||||||
mkfile(mSwapSize * 10, SWAP_PATH);
|
const std::lock_guard<std::mutex> lock(thread_lock);
|
||||||
mkswap(SWAP_PATH);
|
std::remove(SWAP_PATH);
|
||||||
swapon(SWAP_PATH.c_str(), (10 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK);
|
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mkfile_swapon_thread(void) {
|
||||||
|
const std::lock_guard<std::mutex> lock(thread_lock);
|
||||||
|
if (access(SWAP_PATH, F_OK) == 0) {
|
||||||
|
mkfile(mSwapSize * 10, SWAP_PATH);
|
||||||
|
mkswap(SWAP_PATH);
|
||||||
|
}
|
||||||
|
int res = swapon(SWAP_PATH, (10 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK);
|
||||||
|
swapOnRes = res == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> SwapOnData::setSwapOn() {
|
||||||
|
const std::lock_guard<std::mutex> lock(thread_lock);
|
||||||
|
std::thread mkswapfile(mkfile_swapon_thread);
|
||||||
|
mkswapfile.join();
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swapoff_thread(void) {
|
||||||
|
const std::lock_guard<std::mutex> lock(thread_lock);
|
||||||
|
swapoff(SWAP_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
Return<void> SwapOnData::setSwapOff() {
|
Return<void> SwapOnData::setSwapOff() {
|
||||||
swapoff(SWAP_PATH.c_str());
|
std::thread swapoff(swapoff_thread);
|
||||||
remove(SWAP_PATH.c_str());
|
swapoff.join();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
Return<bool> SwapOnData::getSwapOnResult(void) { return swapOnRes; }
|
||||||
|
|
||||||
|
Return<bool> SwapOnData::isMutexLocked() { return !thread_lock.try_lock(); }
|
||||||
|
|
||||||
|
ISwapOnData *SwapOnData::getInstance(void) {
|
||||||
|
USE_CACHED(kCached);
|
||||||
|
}
|
||||||
|
|
||||||
ISwapOnData *SwapOnData::getInstance(void) { return new SwapOnData(); }
|
|
||||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,6 @@
|
||||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||||
|
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
using ::android::hardware::hidl_array;
|
|
||||||
using ::android::hardware::hidl_memory;
|
|
||||||
using ::android::hardware::hidl_string;
|
|
||||||
using ::android::hardware::hidl_vec;
|
|
||||||
using ::android::hardware::Return;
|
using ::android::hardware::Return;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
|
|
@ -32,8 +28,11 @@ struct SwapOnData : public ISwapOnData {
|
||||||
// Methods from ::vendor::eureka::hardware::parts::V1_0::ISwapOnData
|
// Methods from ::vendor::eureka::hardware::parts::V1_0::ISwapOnData
|
||||||
// follow.
|
// follow.
|
||||||
Return<void> setSwapSize(int32_t size);
|
Return<void> setSwapSize(int32_t size);
|
||||||
Return<void> setSwapOn();
|
Return<void> setSwapOn(void);
|
||||||
Return<void> setSwapOff();
|
Return<void> removeSwapFile(void);
|
||||||
|
Return<void> setSwapOff(void);
|
||||||
|
Return<bool> getSwapOnResult(void);
|
||||||
|
Return<bool> isMutexLocked(void);
|
||||||
// Methods from ::android::hidl::base::V2_0::IBase follow.
|
// Methods from ::android::hidl::base::V2_0::IBase follow.
|
||||||
static ISwapOnData *getInstance(void);
|
static ISwapOnData *getInstance(void);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ struct linux_swap_header {
|
||||||
u_int32_t padding[117];
|
u_int32_t padding[117];
|
||||||
u_int32_t badpages[1];
|
u_int32_t badpages[1];
|
||||||
};
|
};
|
||||||
void mkfile(int filesize, std::string name){
|
void mkfile(int filesize, const char* path){
|
||||||
std::vector<char> empty(1024, 0);
|
std::vector<char> empty(1024, 0);
|
||||||
std::ofstream ofs(name, std::ios::binary | std::ios::out);
|
std::ofstream ofs(std::string(path), std::ios::binary | std::ios::out);
|
||||||
|
|
||||||
for(int i = 0; i < 1024 * filesize; i++)
|
for(int i = 0; i < 1024 * filesize; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -32,14 +32,14 @@ void mkfile(int filesize, std::string name){
|
||||||
#define MAGIC_SWAP_HEADER "SWAPSPACE2"
|
#define MAGIC_SWAP_HEADER "SWAPSPACE2"
|
||||||
#define MAGIC_SWAP_HEADER_LEN 10
|
#define MAGIC_SWAP_HEADER_LEN 10
|
||||||
#define MIN_PAGES 10
|
#define MIN_PAGES 10
|
||||||
int mkswap(std::string filename) {
|
int mkswap(const char* filename) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
off_t swap_size;
|
off_t swap_size;
|
||||||
int pagesize;
|
int pagesize;
|
||||||
struct linux_swap_header sw_hdr;
|
struct linux_swap_header sw_hdr;
|
||||||
fd = open(filename.c_str(), O_WRONLY | O_CLOEXEC);
|
fd = open(filename, O_WRONLY | O_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
err = errno;
|
err = errno;
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,13 @@
|
||||||
#include <vendor/eureka/hardware/parts/1.0/IDisplayConfigs.h>
|
#include <vendor/eureka/hardware/parts/1.0/IDisplayConfigs.h>
|
||||||
#include <vendor/eureka/hardware/parts/1.0/IFlashBrightness.h>
|
#include <vendor/eureka/hardware/parts/1.0/IFlashBrightness.h>
|
||||||
#include <vendor/eureka/hardware/parts/1.0/ISwapOnData.h>
|
#include <vendor/eureka/hardware/parts/1.0/ISwapOnData.h>
|
||||||
|
#include <vendor/eureka/hardware/parts/1.0/ISmartCharge.h>
|
||||||
|
|
||||||
#include "Battery.h"
|
#include "Battery.h"
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "FlashLight.h"
|
#include "FlashLight.h"
|
||||||
#include "Swap.h"
|
#include "Swap.h"
|
||||||
|
#include "SmartCharge.h"
|
||||||
|
|
||||||
using android::sp;
|
using android::sp;
|
||||||
using android::hardware::configureRpcThreadpool;
|
using android::hardware::configureRpcThreadpool;
|
||||||
|
|
@ -36,56 +38,33 @@ using vendor::eureka::hardware::parts::V1_0::IDisplayConfigs;
|
||||||
using vendor::eureka::hardware::parts::V1_0::IFlashBrightness;
|
using vendor::eureka::hardware::parts::V1_0::IFlashBrightness;
|
||||||
using vendor::eureka::hardware::parts::V1_0::ISwapOnData;
|
using vendor::eureka::hardware::parts::V1_0::ISwapOnData;
|
||||||
using vendor::eureka::hardware::parts::V1_0::SwapOnData;
|
using vendor::eureka::hardware::parts::V1_0::SwapOnData;
|
||||||
|
using vendor::eureka::hardware::parts::V1_0::ISmartCharge;
|
||||||
|
using vendor::eureka::hardware::parts::V1_0::SmartCharge;
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
static inline int registerAsService(C kClass) {
|
||||||
|
int ret = -1;
|
||||||
|
if (kClass != nullptr) {
|
||||||
|
ret = kClass->registerAsService();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int ret;
|
|
||||||
android::sp<IBatteryStats> mBatteryService = BatteryStats::getInstance();
|
android::sp<IBatteryStats> mBatteryService = BatteryStats::getInstance();
|
||||||
android::sp<IFlashBrightness> mFlashLightService =
|
android::sp<IFlashBrightness> mFlashLightService = FlashBrightness::getInstance();
|
||||||
FlashBrightness::getInstance();
|
|
||||||
android::sp<IDisplayConfigs> mDisplayService = DisplayConfigs::getInstance();
|
android::sp<IDisplayConfigs> mDisplayService = DisplayConfigs::getInstance();
|
||||||
android::sp<ISwapOnData> mSwapService = SwapOnData::getInstance();
|
android::sp<ISwapOnData> mSwapService = SwapOnData::getInstance();
|
||||||
|
android::sp<ISmartCharge> mSmartChargeService = SmartCharge::getInstance();
|
||||||
|
|
||||||
configureRpcThreadpool(4, true /*callerWillJoin*/);
|
configureRpcThreadpool(4, true /*callerWillJoin*/);
|
||||||
|
|
||||||
if (mBatteryService != nullptr) {
|
registerAsService(mBatteryService);
|
||||||
ret = mBatteryService->registerAsService();
|
registerAsService(mFlashLightService);
|
||||||
if (ret != 0) {
|
registerAsService(mDisplayService);
|
||||||
ALOGE("Can't register instance of Battery HAL, nullptr");
|
registerAsService(mSwapService);
|
||||||
} else {
|
registerAsService(mSmartChargeService);
|
||||||
ALOGI("registered Battery HAL");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ALOGE("Can't create instance of Battery HAL, nullptr");
|
|
||||||
}
|
|
||||||
if (mFlashLightService != nullptr) {
|
|
||||||
ret = mFlashLightService->registerAsService();
|
|
||||||
if (ret != 0) {
|
|
||||||
ALOGE("Can't register instance of FlashLight HAL, nullptr");
|
|
||||||
} else {
|
|
||||||
ALOGI("registered FlashLight HAL");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ALOGE("Can't create instance of FlashLight HAL, nullptr");
|
|
||||||
}
|
|
||||||
if (mDisplayService != nullptr) {
|
|
||||||
ret = mDisplayService->registerAsService();
|
|
||||||
if (ret != 0) {
|
|
||||||
ALOGE("Can't register instance of Display HAL, nullptr");
|
|
||||||
} else {
|
|
||||||
ALOGI("registered Display HAL");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ALOGE("Can't create instance of Display HAL, nullptr");
|
|
||||||
}
|
|
||||||
if (mSwapService != nullptr) {
|
|
||||||
ret = mSwapService->registerAsService();
|
|
||||||
if (ret != 0) {
|
|
||||||
ALOGE("Can't register instance of Swap HAL, nullptr");
|
|
||||||
} else {
|
|
||||||
ALOGI("registered Swap HAL");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ALOGE("Can't create instance of Swap HAL, nullptr");
|
|
||||||
}
|
|
||||||
joinRpcThreadpool();
|
joinRpcThreadpool();
|
||||||
|
|
||||||
return -1; // should never get here
|
return -1; // should never get here
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ service parts-hal /system/bin/vendor.eureka.hardware.parts@1.0-service
|
||||||
interface vendor.eureka.hardware.parts@1.0::IDisplayConfigs default
|
interface vendor.eureka.hardware.parts@1.0::IDisplayConfigs default
|
||||||
interface vendor.eureka.hardware.parts@1.0::IFlashBrightness default
|
interface vendor.eureka.hardware.parts@1.0::IFlashBrightness default
|
||||||
interface vendor.eureka.hardware.parts@1.0::ISwapOnData default
|
interface vendor.eureka.hardware.parts@1.0::ISwapOnData default
|
||||||
|
interface vendor.eureka.hardware.parts@1.0::ISmartCharge default
|
||||||
class hal
|
class hal
|
||||||
user root
|
user root
|
||||||
group root
|
group root
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,9 @@
|
||||||
<name>ISwapOnData</name>
|
<name>ISwapOnData</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
|
<interface>
|
||||||
|
<name>ISmartCharge</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
package vendor.eureka.hardware.parts@1.0;
|
package vendor.eureka.hardware.parts@1.0;
|
||||||
|
|
||||||
enum SysfsType : int32_t {
|
enum BatterySys : int32_t {
|
||||||
CAPACITY_MAX,
|
CAPACITY_MAX,
|
||||||
TEMP,
|
TEMP,
|
||||||
CAPACITY_CURRENT,
|
CAPACITY_CURRENT,
|
||||||
|
|
@ -23,30 +23,12 @@ enum SysfsType : int32_t {
|
||||||
CHARGE,
|
CHARGE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Display : int32_t {
|
enum DisplaySys : int32_t {
|
||||||
DOUBLE_TAP,
|
DOUBLE_TAP,
|
||||||
GLOVE_MODE,
|
GLOVE_MODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Number : int32_t {
|
enum Status : int32_t {
|
||||||
ENABLE = 1,
|
ENABLE = 1,
|
||||||
DISABLE = 0,
|
DISABLE = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Device : int32_t {
|
|
||||||
A10,
|
|
||||||
NOTA10,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Value : int32_t {
|
|
||||||
ONEUI = 1,
|
|
||||||
TWOUI,
|
|
||||||
THREEUI,
|
|
||||||
FOURUI,
|
|
||||||
FIVEUI,
|
|
||||||
SIXUI,
|
|
||||||
SEVENUI,
|
|
||||||
EIGHTUI,
|
|
||||||
NINEUI,
|
|
||||||
TENUI = 10,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@ vendor.eureka.hardware.parts::IBatteryStats u:object_r:hal_parts_hwservice:s0
|
||||||
vendor.eureka.hardware.parts::IFlashBrightness u:object_r:hal_parts_hwservice:s0
|
vendor.eureka.hardware.parts::IFlashBrightness u:object_r:hal_parts_hwservice:s0
|
||||||
vendor.eureka.hardware.parts::IDisplayConfigs u:object_r:hal_parts_hwservice:s0
|
vendor.eureka.hardware.parts::IDisplayConfigs u:object_r:hal_parts_hwservice:s0
|
||||||
vendor.eureka.hardware.parts::ISwapOnData u:object_r:hal_parts_hwservice:s0
|
vendor.eureka.hardware.parts::ISwapOnData u:object_r:hal_parts_hwservice:s0
|
||||||
|
vendor.eureka.hardware.parts::ISmartCharge u:object_r:hal_parts_hwservice:s0
|
||||||
# FMRadio
|
# FMRadio
|
||||||
vendor.eureka.hardware.fmradio::IFMRadio u:object_r:hal_fmradio_hwservice:s0
|
vendor.eureka.hardware.fmradio::IFMRadio u:object_r:hal_fmradio_hwservice:s0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue