mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-22 04:05:31 -04:00
universal7885: parts-hidl: Use libFileIO
- Also fix compile errors
This commit is contained in:
parent
840e252b72
commit
3e5e571267
15 changed files with 150 additions and 210 deletions
|
|
@ -1,7 +1,9 @@
|
|||
cc_library_shared {
|
||||
name: "libfileio",
|
||||
srcs: ["FileIO.cpp"],
|
||||
include_dirs: ["include"],
|
||||
cppflags: ["-fexceptions"],
|
||||
local_include_dirs: ["include"],
|
||||
export_include_dirs: ["include"],
|
||||
shared_libs: ["liblog"],
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,14 @@ int readline(const char *path) {
|
|||
try {
|
||||
return stoi(value);
|
||||
} catch (std::invalid_argument const &ex) {
|
||||
ALOGE("%s: stoi(): invalid argument: for %s", __func__, value);
|
||||
ALOGE("%s: stoi(): invalid argument: for %s", __func__, value.c_str());
|
||||
} catch (std::out_of_range const &ex) {
|
||||
ALOGE("%s: stoi(): out of range: for %s", __func__, value);
|
||||
ALOGE("%s: stoi(): out of range: for %s", __func__, value.c_str());
|
||||
}
|
||||
return EXIT_ERR;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void writeline(const char *path, const T data) {
|
||||
void writeline(const char *path, const std::string& data) {
|
||||
std::ofstream file;
|
||||
file.open(path);
|
||||
ALOGD("%s: Opening %s", __func__, path);
|
||||
|
|
@ -45,4 +44,8 @@ void writeline(const char *path, const T data) {
|
|||
ALOGE("%s: Failed to open %s", __func__, path);
|
||||
}
|
||||
|
||||
void writeline(const char *path, const int data) {
|
||||
writeline(path, std::to_string(data));
|
||||
}
|
||||
|
||||
} // namespace FileIO
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace FileIO {
|
||||
int readline(const char *path);
|
||||
|
||||
template <typename T>
|
||||
void writeline(const char *path, const T data);
|
||||
void writeline(const char *path, const std::string& data);
|
||||
void writeline(const char *path, const int data);
|
||||
} // namespace FileIO
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ cc_binary {
|
|||
"libhidlbase",
|
||||
"libutils",
|
||||
"liblog",
|
||||
"libfileio",
|
||||
"vendor.eureka.hardware.parts@1.0",
|
||||
],
|
||||
init_rc: ["vendor.eureka.hardware.parts@1.0-service.rc"],
|
||||
|
|
|
|||
|
|
@ -12,61 +12,53 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "Battery.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <unistd.h>
|
||||
#include "CachedClass.h"
|
||||
|
||||
#include "Battery.h"
|
||||
#include "BatteryConstants.h"
|
||||
#include "CachedClass.h"
|
||||
|
||||
#include <FileIO.h>
|
||||
|
||||
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 "";
|
||||
}
|
||||
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.
|
||||
Return<int32_t> BatteryStats::getBatteryStats(parts::V1_0::BatterySys stats) {
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
file.open(BatterySysToPath(stats));
|
||||
if (file.is_open()) {
|
||||
getline(file, value);
|
||||
file.close();
|
||||
return stoi(value);
|
||||
}
|
||||
return -1;
|
||||
return FileIO::readline(BatterySysToPath(stats));
|
||||
}
|
||||
|
||||
Return<void> BatteryStats::setBatteryWritable(parts::V1_0::BatterySys stats,
|
||||
parts::V1_0::Status value) {
|
||||
std::ofstream file;
|
||||
bool FastCharge = false;
|
||||
if (FastCharge)
|
||||
seteuid(ANDROID_SYSTEM_UID);
|
||||
file.open(BatterySysToPath(stats));
|
||||
file << static_cast<int32_t>(value);
|
||||
file.close();
|
||||
|
||||
FileIO::writeline(BatterySysToPath(stats), static_cast<int32_t>(value));
|
||||
|
||||
if (FastCharge)
|
||||
seteuid(ANDROID_ROOT_UID);
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
#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";
|
||||
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";
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
template <class C>
|
||||
static inline C *cachedClass(C* cached) {
|
||||
if (cached != nullptr) {
|
||||
return cached;
|
||||
}
|
||||
cached = new C();
|
||||
return cached;
|
||||
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)); \
|
||||
})
|
||||
|
||||
#define USE_CACHED(cache) ({ return cachedClass((cache)); })
|
||||
|
|
|
|||
|
|
@ -13,18 +13,20 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "Display.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include "CachedClass.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <FileIO.h>
|
||||
|
||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||
|
||||
static DisplayConfigs *kCached;
|
||||
|
||||
constexpr const char *SEC_TSP_CMD = "/sys/class/sec/tsp/cmd";
|
||||
|
||||
Return<void> DisplayConfigs::writeDisplay(parts::V1_0::Status enable,
|
||||
parts::V1_0::DisplaySys type) {
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
if (type == DisplaySys::DOUBLE_TAP) {
|
||||
writevalue = "aot_enable";
|
||||
|
|
@ -37,13 +39,9 @@ Return<void> DisplayConfigs::writeDisplay(parts::V1_0::Status enable,
|
|||
} else {
|
||||
writevalue += "0";
|
||||
}
|
||||
file.open("/sys/class/sec/tsp/cmd");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
FileIO::writeline(SEC_TSP_CMD, writevalue);
|
||||
return Void();
|
||||
}
|
||||
|
||||
IDisplayConfigs *DisplayConfigs::getInstance(void) {
|
||||
USE_CACHED(kCached);
|
||||
}
|
||||
IDisplayConfigs *DisplayConfigs::getInstance(void) { USE_CACHED(kCached); }
|
||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||
|
|
|
|||
|
|
@ -13,62 +13,35 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "FlashLight.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include "CachedClass.h"
|
||||
|
||||
#include <FileIO.h>
|
||||
|
||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||
|
||||
static FlashBrightness *kCached;
|
||||
|
||||
constexpr const char *TORCH_ENABLE =
|
||||
"/sys/class/camera/flash/torch_brightness_lvl_enable";
|
||||
constexpr const char *TORCH_LVL =
|
||||
"/sys/class/camera/flash/torch_brightness_lvl";
|
||||
|
||||
// Methods from ::android::hardware::parts::V1_0::IFlashLight follow.
|
||||
Return<void> FlashBrightness::setFlashlightEnable(parts::V1_0::Status enable) {
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
switch (enable) {
|
||||
case Status::ENABLE:
|
||||
writevalue = "1";
|
||||
break;
|
||||
case Status::DISABLE:
|
||||
writevalue = "0";
|
||||
break;
|
||||
default:
|
||||
writevalue = "";
|
||||
break;
|
||||
}
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl_enable");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
FileIO::writeline(TORCH_ENABLE, static_cast<int32_t>(enable));
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> FlashBrightness::setFlashlightWritable(int32_t value) {
|
||||
std::ofstream file;
|
||||
std::string writevalue = std::to_string(value);
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
FileIO::writeline(TORCH_LVL, value);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<int32_t> FlashBrightness::readFlashlightstats(bool s2mu106) {
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||
if (file.is_open()) {
|
||||
getline(file, value);
|
||||
file.close();
|
||||
if (s2mu106) {
|
||||
return stoi(value);
|
||||
} else {
|
||||
return stoi(value) / 21;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
return s2mu106 ? FileIO::readline(TORCH_LVL) / 21
|
||||
: FileIO::readline(TORCH_LVL);
|
||||
}
|
||||
|
||||
IFlashBrightness *FlashBrightness::getInstance(void) {
|
||||
USE_CACHED(kCached);
|
||||
}
|
||||
IFlashBrightness *FlashBrightness::getInstance(void) { USE_CACHED(kCached); }
|
||||
|
||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "SmartCharge.h"
|
||||
#include "CachedClass.h"
|
||||
#include "SmartChargingImpl.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include "CachedClass.h"
|
||||
|
||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||
|
||||
|
|
@ -55,15 +55,9 @@ Return<void> SmartCharge::setConfig(int32_t limit_user, int32_t restart_user) {
|
|||
return Void();
|
||||
}
|
||||
|
||||
Return<int32_t> SmartCharge::getLimitCnt(void) {
|
||||
return limit_stat;
|
||||
}
|
||||
Return<int32_t> SmartCharge::getLimitCnt(void) { return limit_stat; }
|
||||
|
||||
Return<int32_t> SmartCharge::getRestartCnt(void) {
|
||||
return restart_stat;
|
||||
}
|
||||
Return<int32_t> SmartCharge::getRestartCnt(void) { return restart_stat; }
|
||||
|
||||
ISmartCharge *SmartCharge::getInstance(void) {
|
||||
USE_CACHED(kCached);
|
||||
}
|
||||
ISmartCharge *SmartCharge::getInstance(void) { USE_CACHED(kCached); }
|
||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||
|
|
|
|||
|
|
@ -1,41 +1,43 @@
|
|||
#include "SmartChargingImpl.h"
|
||||
#include <thread>
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
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;
|
||||
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));
|
||||
}
|
||||
static void battery_monitor(const int limit_percent, const int restart_percent,
|
||||
int *charge_limit_cnt, int *restart_cnt) {
|
||||
while (shouldRun) {
|
||||
auto batt = FileIO::readline(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();
|
||||
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;
|
||||
}
|
||||
shouldRun = false;
|
||||
monitor = nullptr;
|
||||
}
|
||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||
|
|
|
|||
|
|
@ -1,53 +1,30 @@
|
|||
#include "BatteryConstants.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <FileIO.h>
|
||||
|
||||
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;
|
||||
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;
|
||||
const int limit_percent;
|
||||
const int restart_percent;
|
||||
};
|
||||
|
||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||
|
||||
static inline void disableSysfs(const char *path) {
|
||||
FileIO::writeline(path, 0);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
static inline void enableSysfs(const char *path) { FileIO::writeline(path, 1); }
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "Swap.h"
|
||||
#include "CachedClass.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sys/swap.h>
|
||||
#include <unistd.h>
|
||||
#include <mutex>
|
||||
#include <sys/swap.h>
|
||||
#include <thread>
|
||||
#include "CachedClass.h"
|
||||
#include <unistd.h>
|
||||
|
||||
static int mSwapSize = 100;
|
||||
extern int mkswap (const char *filename);
|
||||
extern int mkswap(const char *filename);
|
||||
extern void mkfile(int filesize, const char *name);
|
||||
|
||||
constexpr const char* SWAP_PATH = "/data/swap/swapfile";
|
||||
constexpr const char *SWAP_PATH = "/data/swap/swapfile";
|
||||
|
||||
namespace vendor::eureka::hardware::parts::V1_0 {
|
||||
|
||||
|
|
@ -52,7 +52,8 @@ static void mkfile_swapon_thread(void) {
|
|||
mkfile(mSwapSize * 10, SWAP_PATH);
|
||||
mkswap(SWAP_PATH);
|
||||
}
|
||||
int res = swapon(SWAP_PATH, (10 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK);
|
||||
int res =
|
||||
swapon(SWAP_PATH, (10 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK);
|
||||
swapOnRes = res == 0;
|
||||
}
|
||||
|
||||
|
|
@ -77,8 +78,6 @@ 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) { USE_CACHED(kCached); }
|
||||
|
||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <fcntl.h>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fcntl.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/swap.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
/* XXX This needs to be obtained from kernel headers. See b/9336527 */
|
||||
struct linux_swap_header {
|
||||
|
|
@ -20,19 +20,18 @@ struct linux_swap_header {
|
|||
u_int32_t padding[117];
|
||||
u_int32_t badpages[1];
|
||||
};
|
||||
void mkfile(int filesize, const char* path){
|
||||
std::vector<char> empty(1024, 0);
|
||||
std::ofstream ofs(std::string(path), std::ios::binary | std::ios::out);
|
||||
void mkfile(int filesize, const char *path) {
|
||||
std::vector<char> empty(1024, 0);
|
||||
std::ofstream ofs(std::string(path), std::ios::binary | std::ios::out);
|
||||
|
||||
for(int i = 0; i < 1024 * filesize; i++)
|
||||
{
|
||||
ofs.write(&empty[0], empty.size());
|
||||
}
|
||||
for (int i = 0; i < 1024 * filesize; i++) {
|
||||
ofs.write(&empty[0], empty.size());
|
||||
}
|
||||
}
|
||||
#define MAGIC_SWAP_HEADER "SWAPSPACE2"
|
||||
#define MAGIC_SWAP_HEADER_LEN 10
|
||||
#define MIN_PAGES 10
|
||||
int mkswap(const char* filename) {
|
||||
int mkswap(const char *filename) {
|
||||
int err = 0;
|
||||
int fd;
|
||||
ssize_t len;
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@
|
|||
#include <vendor/eureka/hardware/parts/1.0/IBatteryStats.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/ISwapOnData.h>
|
||||
#include <vendor/eureka/hardware/parts/1.0/ISmartCharge.h>
|
||||
#include <vendor/eureka/hardware/parts/1.0/ISwapOnData.h>
|
||||
|
||||
#include "Battery.h"
|
||||
#include "Display.h"
|
||||
#include "FlashLight.h"
|
||||
#include "Swap.h"
|
||||
#include "SmartCharge.h"
|
||||
#include "Swap.h"
|
||||
|
||||
using android::sp;
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
|
|
@ -36,13 +36,12 @@ using vendor::eureka::hardware::parts::V1_0::FlashBrightness;
|
|||
using vendor::eureka::hardware::parts::V1_0::IBatteryStats;
|
||||
using vendor::eureka::hardware::parts::V1_0::IDisplayConfigs;
|
||||
using vendor::eureka::hardware::parts::V1_0::IFlashBrightness;
|
||||
using vendor::eureka::hardware::parts::V1_0::ISwapOnData;
|
||||
using vendor::eureka::hardware::parts::V1_0::SwapOnData;
|
||||
using vendor::eureka::hardware::parts::V1_0::ISmartCharge;
|
||||
using vendor::eureka::hardware::parts::V1_0::ISwapOnData;
|
||||
using vendor::eureka::hardware::parts::V1_0::SmartCharge;
|
||||
using vendor::eureka::hardware::parts::V1_0::SwapOnData;
|
||||
|
||||
template <class C>
|
||||
static inline int registerAsService(C kClass) {
|
||||
template <class C> static inline int registerAsService(C kClass) {
|
||||
int ret = -1;
|
||||
if (kClass != nullptr) {
|
||||
ret = kClass->registerAsService();
|
||||
|
|
@ -52,7 +51,8 @@ static inline int registerAsService(C kClass) {
|
|||
|
||||
int main() {
|
||||
android::sp<IBatteryStats> mBatteryService = BatteryStats::getInstance();
|
||||
android::sp<IFlashBrightness> mFlashLightService = FlashBrightness::getInstance();
|
||||
android::sp<IFlashBrightness> mFlashLightService =
|
||||
FlashBrightness::getInstance();
|
||||
android::sp<IDisplayConfigs> mDisplayService = DisplayConfigs::getInstance();
|
||||
android::sp<ISwapOnData> mSwapService = SwapOnData::getInstance();
|
||||
android::sp<ISmartCharge> mSmartChargeService = SmartCharge::getInstance();
|
||||
|
|
|
|||
Loading…
Reference in a new issue