universal7885: run clang-format based on system-clang-format

* On every *.cpp *.h files

Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2021-12-12 20:37:53 +09:00
commit 098179eabb
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
47 changed files with 1545 additions and 1709 deletions

View file

@ -13,96 +13,97 @@
// limitations under the License.
#include "Battery.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::battery::V1_0 {
// Methods from ::android::hardware::battery::V1_0::IBattery follow.
Return<int32_t> Battery::getBatteryStats(battery::V1_0::SysfsType stats) {
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;
int32_t intvalue;
file.open(filename);
if (file.is_open()) {
getline(file, value);
file.close();
std::stringstream val(value);
val >> intvalue;
return intvalue;
}
return -1;
}
Return<int32_t> Battery::setBatteryWritable(battery::V1_0::SysfsType stats, battery::V1_0::Number value) {
std::ofstream file;
std::string filename;
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) seteuid(ANDROID_SYSTEM_UID);
file.open(filename);
int write;
if (value == Number::ENABLE){
write = 1;
}else{
write = 0;
}
file << write;
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;
int32_t intvalue;
file.open(filename);
if (file.is_open()) {
getline(file, value);
file.close();
if(FastCharge) seteuid(ANDROID_ROOT_UID);
return 0;
std::stringstream val(value);
val >> intvalue;
return intvalue;
}
return -1;
}
IBattery *Battery::getInstance(void){
return new Battery();
Return<int32_t> Battery::setBatteryWritable(battery::V1_0::SysfsType stats,
battery::V1_0::Number value) {
std::ofstream file;
std::string filename;
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) seteuid(ANDROID_SYSTEM_UID);
file.open(filename);
int write;
if (value == Number::ENABLE) {
write = 1;
} else {
write = 0;
}
file << write;
file.close();
if (FastCharge) seteuid(ANDROID_ROOT_UID);
return 0;
}
} // namespace android::hardware::battery::implementation
IBattery* Battery::getInstance(void) {
return new Battery();
}
} // namespace vendor::eureka::hardware::battery::V1_0

View file

@ -14,22 +14,22 @@
#pragma once
#include <vendor/eureka/hardware/battery/1.0/IBattery.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/battery/1.0/IBattery.h>
#define ANDROID_SYSTEM_UID 1000
#define ANDROID_ROOT_UID 0
namespace vendor::eureka::hardware::battery::V1_0 {
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::Void;
using ::android::sp;
struct Battery : public IBattery {
// Methods from ::vendor::eureka::hardware::battery::V1_0::IBattery follow.
@ -38,6 +38,5 @@ struct Battery : public IBattery {
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IBattery* getInstance(void);
};
} // namespace android::hardware::battery::implementation
} // namespace vendor::eureka::hardware::battery::V1_0

View file

@ -12,38 +12,37 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#define LOG_TAG "vendor.eureka.hardware.battery@1.0-service"
#include <vendor/eureka/hardware/battery/1.0/IBattery.h>
#include <hidl/LegacySupport.h>
#include "Battery.h"
using vendor::eureka::hardware::battery::V1_0::IBattery;
using vendor::eureka::hardware::battery::V1_0::Battery;
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::sp;
using vendor::eureka::hardware::battery::V1_0::Battery;
using vendor::eureka::hardware::battery::V1_0::IBattery;
int main() {
int ret;
android::sp<IBattery> service = Battery::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->registerAsService();
if(ret != 0) {
ALOGE("Can't register instance of Battery HAL, nullptr");
}else{
ALOGI("registered Battery HAL");
}
} else {
ALOGE("Can't create instance of Battery HAL, nullptr");
}
joinRpcThreadpool();
return -1; // should never get here
int ret;
android::sp<IBattery> service = Battery::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->registerAsService();
if (ret != 0) {
ALOGE("Can't register instance of Battery HAL, nullptr");
} else {
ALOGI("registered Battery HAL");
}
} else {
ALOGE("Can't create instance of Battery HAL, nullptr");
}
joinRpcThreadpool();
return -1; // should never get here
}

View file

@ -13,98 +13,98 @@
// limitations under the License.
#include "Flashlight.h"
#include <iostream>
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::flashlight::V1_0 {
// Methods from ::android::hardware::flashlight::V1_0::IFlashlight follow.
Return<int32_t> Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable) {
std::ofstream file;
std::string writevalue;
switch (enable){
case Enable::ENABLE:
writevalue = "1";
break;
case Enable::DISABLE:
writevalue = "0";
break;
default:
writevalue = "";
break;
}
file.open("/sys/class/camera/flash/torch_brightness_lvl_enable");
file << writevalue;
file.close();
return 0;
std::ofstream file;
std::string writevalue;
switch (enable) {
case Enable::ENABLE:
writevalue = "1";
break;
case Enable::DISABLE:
writevalue = "0";
break;
default:
writevalue = "";
break;
}
file.open("/sys/class/camera/flash/torch_brightness_lvl_enable");
file << writevalue;
file.close();
return 0;
}
Return<int32_t> Flashlight::setFlashlightWritable(flashlight::V1_0::Number value) {
std::ofstream file;
std::string writevalue;
switch (value){
case Number::ONEUI:
writevalue = "1";
break;
case Number::TWOUI:
writevalue = "2";
break;
case Number::THREEUI:
writevalue = "3";
break;
case Number::FOURUI:
writevalue = "4";
break;
case Number::FIVEUI:
writevalue = "5";
break;
case Number::SIXUI:
writevalue = "6";
break;
case Number::SEVENUI:
writevalue = "7";
break;
case Number::EIGHTUI:
writevalue = "8";
break;
case Number::NINEUI:
writevalue = "9";
break;
case Number::TENUI:
writevalue = "10";
break;
default:
writevalue = "";
break;
}
file.open("/sys/class/camera/flash/torch_brightness_lvl");
file << writevalue;
file.close();
return 0;
std::ofstream file;
std::string writevalue;
switch (value) {
case Number::ONEUI:
writevalue = "1";
break;
case Number::TWOUI:
writevalue = "2";
break;
case Number::THREEUI:
writevalue = "3";
break;
case Number::FOURUI:
writevalue = "4";
break;
case Number::FIVEUI:
writevalue = "5";
break;
case Number::SIXUI:
writevalue = "6";
break;
case Number::SEVENUI:
writevalue = "7";
break;
case Number::EIGHTUI:
writevalue = "8";
break;
case Number::NINEUI:
writevalue = "9";
break;
case Number::TENUI:
writevalue = "10";
break;
default:
writevalue = "";
break;
}
file.open("/sys/class/camera/flash/torch_brightness_lvl");
file << writevalue;
file.close();
return 0;
}
Return<int32_t> Flashlight::readFlashlightstats(flashlight::V1_0::Device device) {
std::ifstream file;
std::string value;
int32_t intvalue;
file.open("/sys/class/camera/flash/torch_brightness_lvl");
if (file.is_open()) {
getline(file, value);
file.close();
std::stringstream val(value);
val >> intvalue;
if (device == Device::A10){
return intvalue;
}else if (device == Device::NOTA10){
return intvalue / 21;
}
// Never Here
return -1;
}
return -1;
std::ifstream file;
std::string value;
int32_t intvalue;
file.open("/sys/class/camera/flash/torch_brightness_lvl");
if (file.is_open()) {
getline(file, value);
file.close();
std::stringstream val(value);
val >> intvalue;
if (device == Device::A10) {
return intvalue;
} else if (device == Device::NOTA10) {
return intvalue / 21;
}
// Never Here
return -1;
}
return -1;
}
IFlashlight *Flashlight::getInstance(void){
return new Flashlight();
IFlashlight* Flashlight::getInstance(void) {
return new Flashlight();
}
} // namespace android::hardware::flashlight::implementation
} // namespace vendor::eureka::hardware::flashlight::V1_0

View file

@ -14,19 +14,19 @@
#pragma once
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
namespace vendor::eureka::hardware::flashlight::V1_0 {
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::Void;
using ::android::sp;
struct Flashlight : public IFlashlight {
// Methods from ::vendor::eureka::hardware::flashlight::V1_0::IFlashlight follow.
@ -35,6 +35,5 @@ struct Flashlight : public IFlashlight {
Return<int32_t> readFlashlightstats(Device device);
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IFlashlight* getInstance(void);
};
} // namespace android::hardware::flashlight::implementation
} // namespace vendor::eureka::hardware::flashlight::V1_0

View file

@ -12,38 +12,37 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#define LOG_TAG "vendor.eureka.hardware.flashlight@1.0-service"
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
#include <hidl/LegacySupport.h>
#include "Flashlight.h"
using vendor::eureka::hardware::flashlight::V1_0::IFlashlight;
using vendor::eureka::hardware::flashlight::V1_0::Flashlight;
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::sp;
using vendor::eureka::hardware::flashlight::V1_0::Flashlight;
using vendor::eureka::hardware::flashlight::V1_0::IFlashlight;
int main() {
int ret;
android::sp<IFlashlight> service = Flashlight::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->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");
}
joinRpcThreadpool();
return -1; // should never get here
int ret;
android::sp<IFlashlight> service = Flashlight::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->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");
}
joinRpcThreadpool();
return -1; // should never get here
}

View file

@ -13,41 +13,41 @@
// limitations under the License.
#include "Gpu.h"
#include <iostream>
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::gpu::V1_0 {
Return<int32_t> Gpu::setGpuWritable(gpu::V1_0::Enable enable) {
std::ofstream file;
std::string writevalue;
if (enable == Enable::ENABLE){
std::ofstream file;
std::string writevalue;
if (enable == Enable::ENABLE) {
writevalue = "1";
}else{
} else {
writevalue = "0";
}
file.open("/sys/devices/platform/11500000.mali/tmu");
file << writevalue;
file.close();
return 0;
}
file.open("/sys/devices/platform/11500000.mali/tmu");
file << writevalue;
file.close();
return 0;
}
Return<int32_t> Gpu::readGpustats(void) {
std::ifstream file;
std::string value;
int32_t intvalue;
file.open("/sys/devices/platform/11500000.mali/tmu");
if (file.is_open()) {
getline(file, value);
file.close();
std::stringstream val(value);
val >> intvalue;
return intvalue;
}
return -1;
std::ifstream file;
std::string value;
int32_t intvalue;
file.open("/sys/devices/platform/11500000.mali/tmu");
if (file.is_open()) {
getline(file, value);
file.close();
std::stringstream val(value);
val >> intvalue;
return intvalue;
}
return -1;
}
IGpu *Gpu::getInstance(void){
return new Gpu();
IGpu* Gpu::getInstance(void) {
return new Gpu();
}
} // namespace android::hardware::gpu::implementation
} // namespace vendor::eureka::hardware::gpu::V1_0

View file

@ -14,19 +14,19 @@
#pragma once
#include <vendor/eureka/hardware/gpu/1.0/IGpu.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/gpu/1.0/IGpu.h>
namespace vendor::eureka::hardware::gpu::V1_0 {
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::Void;
using ::android::sp;
struct Gpu : public IGpu {
// Methods from ::vendor::eureka::hardware::gpu::V1_0::IGpu follow.
@ -34,6 +34,5 @@ struct Gpu : public IGpu {
Return<int32_t> readGpustats(void);
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IGpu* getInstance(void);
};
} // namespace android::hardware::gpu::implementation
} // namespace vendor::eureka::hardware::gpu::V1_0

View file

@ -12,38 +12,37 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#define LOG_TAG "vendor.eureka.hardware.gpu@1.0-service"
#include <vendor/eureka/hardware/gpu/1.0/IGpu.h>
#include <hidl/LegacySupport.h>
#include "Gpu.h"
using vendor::eureka::hardware::gpu::V1_0::IGpu;
using vendor::eureka::hardware::gpu::V1_0::Gpu;
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::sp;
using vendor::eureka::hardware::gpu::V1_0::Gpu;
using vendor::eureka::hardware::gpu::V1_0::IGpu;
int main() {
int ret;
android::sp<IGpu> service = Gpu::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->registerAsService();
if(ret != 0) {
ALOGE("Can't register instance of Gpu HAL, nullptr");
}else{
ALOGI("registered Gpu HAL");
}
} else {
ALOGE("Can't create instance of Gpu HAL, nullptr");
}
joinRpcThreadpool();
return -1; // should never get here
int ret;
android::sp<IGpu> service = Gpu::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->registerAsService();
if (ret != 0) {
ALOGE("Can't register instance of Gpu HAL, nullptr");
} else {
ALOGI("registered Gpu HAL");
}
} else {
ALOGE("Can't create instance of Gpu HAL, nullptr");
}
joinRpcThreadpool();
return -1; // should never get here
}

View file

@ -13,41 +13,41 @@
// limitations under the License.
#include "SELinux.h"
#include <iostream>
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::security::selinux::V1_0 {
Return<int32_t> SELinux::setSELinuxWritable(selinux::V1_0::Enable enable) {
std::ofstream file;
std::string writevalue;
if (enable == Enable::ENABLE){
std::ofstream file;
std::string writevalue;
if (enable == Enable::ENABLE) {
writevalue = "1";
}else{
} else {
writevalue = "0";
}
file.open("/sys/fs/selinux/enforce");
file << writevalue;
file.close();
return 0;
}
file.open("/sys/fs/selinux/enforce");
file << writevalue;
file.close();
return 0;
}
Return<int32_t> SELinux::readSELinuxstats(void) {
std::ifstream file;
std::string value;
int32_t intvalue;
file.open("/sys/fs/selinux/enforce");
if (file.is_open()) {
getline(file, value);
file.close();
std::stringstream val(value);
val >> intvalue;
return intvalue;
}
return -1;
std::ifstream file;
std::string value;
int32_t intvalue;
file.open("/sys/fs/selinux/enforce");
if (file.is_open()) {
getline(file, value);
file.close();
std::stringstream val(value);
val >> intvalue;
return intvalue;
}
return -1;
}
ISELinux *SELinux::getInstance(void){
return new SELinux();
ISELinux* SELinux::getInstance(void) {
return new SELinux();
}
} // namespace android::security::selinux::implementation
} // namespace vendor::eureka::security::selinux::V1_0

View file

@ -14,19 +14,19 @@
#pragma once
#include <vendor/eureka/security/selinux/1.0/ISELinux.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <vendor/eureka/security/selinux/1.0/ISELinux.h>
namespace vendor::eureka::security::selinux::V1_0 {
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::Void;
using ::android::sp;
struct SELinux : public ISELinux {
// Methods from ::vendor::eureka::security::selinux::V1_0::ISELinux follow.
@ -34,6 +34,5 @@ struct SELinux : public ISELinux {
Return<int32_t> readSELinuxstats(void);
// Methods from ::android::hidl::base::V1_0::IBase follow.
static ISELinux* getInstance(void);
};
} // namespace android::security::selinux::implementation
} // namespace vendor::eureka::security::selinux::V1_0

View file

@ -12,38 +12,37 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#define LOG_TAG "vendor.eureka.security.selinux@1.0-service"
#include <vendor/eureka/security/selinux/1.0/ISELinux.h>
#include <hidl/LegacySupport.h>
#include "SELinux.h"
using vendor::eureka::security::selinux::V1_0::ISELinux;
using vendor::eureka::security::selinux::V1_0::SELinux;
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::sp;
using vendor::eureka::security::selinux::V1_0::ISELinux;
using vendor::eureka::security::selinux::V1_0::SELinux;
int main() {
int ret;
android::sp<ISELinux> service = SELinux::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->registerAsService();
if(ret != 0) {
ALOGE("Can't register instance of SELinux HAL, nullptr");
}else{
ALOGI("registered SELinux HAL");
}
} else {
ALOGE("Can't create instance of SELinux HAL, nullptr");
}
joinRpcThreadpool();
return -1; // should never get here
int ret;
android::sp<ISELinux> service = SELinux::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (service != nullptr) {
ret = service->registerAsService();
if (ret != 0) {
ALOGE("Can't register instance of SELinux HAL, nullptr");
} else {
ALOGI("registered SELinux HAL");
}
} else {
ALOGE("Can't create instance of SELinux HAL, nullptr");
}
joinRpcThreadpool();
return -1; // should never get here
}