universal7885: Move folders to subfolders

Change-Id: I109b02201607d12209180c7cf3356b4e2e3d7ce6
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2022-03-31 21:58:33 +09:00
commit 8cc7aca046
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
89 changed files with 0 additions and 0 deletions

View file

@ -1,3 +0,0 @@
hidl_package_root{
name: "vendor.eureka",
}

View file

@ -1,12 +0,0 @@
hidl_interface {
name: "vendor.eureka.hardware.fmradio@1.0",
root: "vendor.eureka",
srcs: [
"types.hal",
"IFMRadio.hal",
],
interfaces: [
"android.hidl.base@1.0",
],
gen_java: true,
}

View file

@ -1,20 +0,0 @@
// 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.fmradio@1.0;
interface IFMRadio {
setManualFreq(float freq);
adjustFreqByStep(Direction dir);
};

View file

@ -1,20 +0,0 @@
// 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.fmradio@1.0;
enum Direction : int32_t {
UP,
DOWN,
};

View file

@ -1,13 +0,0 @@
hidl_interface {
name: "vendor.eureka.hardware.fmradio@1.1",
root: "vendor.eureka",
srcs: [
"types.hal",
"IFMRadio.hal",
],
interfaces: [
"android.hidl.base@1.0",
"vendor.eureka.hardware.fmradio@1.0",
],
gen_java: true,
}

View file

@ -1,22 +0,0 @@
// 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.fmradio@1.1;
import @1.0::IFMRadio;
interface IFMRadio extends @1.0::IFMRadio {
getFreqFromSysfs() generates (int32_t freq);
isAvailable() generates (Status status);
};

View file

@ -1,20 +0,0 @@
// 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.fmradio@1.1;
enum Status : int32_t {
YES,
NO,
};

View file

@ -1,14 +0,0 @@
hidl_interface {
name: "vendor.eureka.hardware.fmradio@1.2",
root: "vendor.eureka",
srcs: [
"types.hal",
"IFMRadio.hal",
],
interfaces: [
"android.hidl.base@1.0",
"vendor.eureka.hardware.fmradio@1.1",
"vendor.eureka.hardware.fmradio@1.0",
],
gen_java: true,
}

View file

@ -1,22 +0,0 @@
// 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.fmradio@1.2;
import @1.1::IFMRadio;
interface IFMRadio extends @1.1::IFMRadio {
setChannelSpacing(Space space);
getChannelSpacing() generates (Space space);
};

View file

@ -1,21 +0,0 @@
// FIXME: your file license if you have one
cc_binary {
name: "vendor.eureka.hardware.fmradio@1.2-service",
relative_install_path: "hw",
proprietary: true,
srcs: [
"FMRadio.cpp",
"service.cpp",
],
shared_libs: [
"libhidlbase",
"libutils",
"liblog",
"vendor.eureka.hardware.fmradio@1.0",
"vendor.eureka.hardware.fmradio@1.1",
"vendor.eureka.hardware.fmradio@1.2",
],
init_rc: [ "vendor.eureka.hardware.fmradio@1.2-service.rc" ],
vintf_fragments: [ "vendor.eureka.hardware.fmradio@1.2.xml" ],
}

View file

@ -1,80 +0,0 @@
// 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 "FMRadio.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <sys/types.h>
#include <sys/stat.h>
static int mChannelSpacing = 3;
namespace vendor::eureka::hardware::fmradio::V1_2 {
Return<void> FMRadio::setManualFreq(float freq) {
std::ofstream file;
file.open("/sys/devices/virtual/s610_radio/s610_radio/radio_freq_ctrl");
file << freq * 1000;
file.close();
return Void();
}
Return<void> FMRadio::adjustFreqByStep(fmradio::V1_0::Direction dir) {
std::ofstream file;
std::string value = "";
if (dir == V1_0::Direction::UP){
value = "1 " + std::to_string(mChannelSpacing * 10);
} else if (dir == V1_0::Direction::DOWN){
value = "0 " + std::to_string(mChannelSpacing * 10);
}
file.open("/sys/devices/virtual/s610_radio/s610_radio/radio_freq_seek");
file << value;
file.close();
return Void();
}
Return<V1_1::Status> FMRadio::isAvailable(){
struct stat info;
if(stat("/sys/devices/virtual/s610_radio/s610_radio/", &info ) != 0) {
return V1_1::Status::NO;
} else {
return V1_1::Status::YES;
}
}
Return<void> FMRadio::setChannelSpacing(V1_2::Space space){
mChannelSpacing = (int) space;
return Void();
}
Return<int32_t> FMRadio::getFreqFromSysfs(){
std::ifstream file;
std::string value;
file.open("/sys/devices/virtual/s610_radio/s610_radio/radio_freq_ctrl");
std::getline(file, value);
file.close();
return std::stoi(value);
}
Return<V1_2::Space> FMRadio::getChannelSpacing(){
switch (mChannelSpacing) {
case 1: return V1_2::Space::CHANNEL_SPACING_10HZ;
case 2: return V1_2::Space::CHANNEL_SPACING_20HZ;
case 3: return V1_2::Space::CHANNEL_SPACING_30HZ;
case 4: return V1_2::Space::CHANNEL_SPACING_40HZ;
case 5: return V1_2::Space::CHANNEL_SPACING_50HZ;
default: return V1_2::Space::CHANNEL_SPACING_30HZ;
}
}
IFMRadio* FMRadio::getInstance(void) {
return new FMRadio();
}
} // namespace vendor::eureka::hardware::fmradio::V1_0

View file

@ -1,44 +0,0 @@
// 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/fmradio/1.2/IFMRadio.h>
namespace vendor::eureka::hardware::fmradio::V1_2 {
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;
struct FMRadio : public IFMRadio {
// Methods from ::vendor::eureka::hardware::fmradio::V1_0::IFMRadio follow.
Return<void> setManualFreq(float freq);
Return<void> adjustFreqByStep(V1_0::Direction dir);
// Methods from ::vendor::eureka::hardware::fmradio::V1_1::IFMRadio follow.
Return<V1_1::Status> isAvailable();
Return<int32_t> getFreqFromSysfs();
// Methods from ::vendor::eureka::hardware::fmradio::V1_2::IFMRadio follow.
Return<void> setChannelSpacing(V1_2::Space space);
Return<V1_2::Space> getChannelSpacing();
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IFMRadio* getInstance(void);
};
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,47 +0,0 @@
// 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.
#define LOG_TAG "vendor.eureka.hardware.fmradio@1.2-service"
#include <vendor/eureka/hardware/fmradio/1.2/IFMRadio.h>
#include <hidl/LegacySupport.h>
#include "FMRadio.h"
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using vendor::eureka::hardware::fmradio::V1_2::FMRadio;
using vendor::eureka::hardware::fmradio::V1_2::IFMRadio;
int main() {
int ret;
android::sp<IFMRadio> mFMService = FMRadio::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (mFMService != nullptr) {
ret = mFMService->registerAsService();
if (ret != 0) {
ALOGE("Can't register instance of FMRadio HAL, nullptr");
} else {
ALOGI("registered FMRadio HAL");
}
} else {
ALOGE("Can't create instance of FMRadio HAL, nullptr");
}
joinRpcThreadpool();
return -1; // should never get here
}

View file

@ -1,7 +0,0 @@
service vendor.fm-hal /vendor/bin/hw/vendor.eureka.hardware.fmradio@1.2-service
interface vendor.eureka.hardware.fmradio@1.0::IFMRadio default
interface vendor.eureka.hardware.fmradio@1.1::IFMRadio default
interface vendor.eureka.hardware.fmradio@1.2::IFMRadio default
class hal
user root
group root

View file

@ -1,11 +0,0 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.eureka.hardware.fmradio</name>
<transport>hwbinder</transport>
<version>1.2</version>
<interface>
<name>IFMRadio</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View file

@ -1,23 +0,0 @@
// 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.fmradio@1.2;
enum Space : int32_t {
CHANNEL_SPACING_10HZ = 1,
CHANNEL_SPACING_20HZ,
CHANNEL_SPACING_30HZ,
CHANNEL_SPACING_40HZ,
CHANNEL_SPACING_50HZ = 5,
};

View file

@ -1,13 +0,0 @@
hidl_interface {
name: "vendor.eureka.hardware.parts@1.0",
root: "vendor.eureka",
srcs: [
"types.hal",
"IBattery.hal",
"IFlashLight.hal",
"IGpu.hal",
"ISELinux.hal",
],
interfaces: [ "android.hidl.base@1.0" ],
gen_java: true,
}

View file

@ -1,20 +0,0 @@
// 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 IBattery {
getBatteryStats(SysfsType stats) generates (int32_t result);
setBatteryWritable(SysfsType stats, Number value) generates (int32_t result);
};

View file

@ -1,21 +0,0 @@
// 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 IFlashLight {
setFlashlightWritable(Value value) generates (int32_t result);
setFlashlightEnable(Number enable) generates (int32_t result);
readFlashlightstats(Device device) generates (int32_t value);
};

View file

@ -1,20 +0,0 @@
// 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 IGpu {
setGpuWritable(Number enable) generates (int32_t result);
readGpustats() generates (int32_t value);
};

View file

@ -1,20 +0,0 @@
// 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 ISELinux {
setSELinuxWritable(Number enable) generates (int32_t result);
readSELinuxstats() generates (int32_t value);
};

View file

@ -1,22 +0,0 @@
// FIXME: your file license if you have one
cc_binary {
name: "vendor.eureka.hardware.parts@1.0-service",
relative_install_path: "hw",
proprietary: true,
srcs: [
"Battery.cpp",
"FlashLight.cpp",
"Gpu.cpp",
"SELinux.cpp",
"service.cpp",
],
shared_libs: [
"libhidlbase",
"libutils",
"liblog",
"vendor.eureka.hardware.parts@1.0",
],
init_rc: [ "vendor.eureka.hardware.parts@1.0-service.rc" ],
vintf_fragments: [ "vendor.eureka.hardware.parts@1.0.xml" ],
}

View file

@ -1,109 +0,0 @@
// 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 "Battery.h"
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::parts::V1_0 {
// Methods from ::android::hardware::battery::V1_0::IBattery follow.
Return<int32_t> Battery::getBatteryStats(parts::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(parts::V1_0::SysfsType stats,
parts::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;
}
IBattery* Battery::getInstance(void) {
return new Battery();
}
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,42 +0,0 @@
// 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/IBattery.h>
#define ANDROID_SYSTEM_UID 1000
#define ANDROID_ROOT_UID 0
namespace vendor::eureka::hardware::parts::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;
struct Battery : public IBattery {
// Methods from ::vendor::eureka::hardware::parts::V1_0::IBattery follow.
Return<int32_t> getBatteryStats(SysfsType stats) override;
Return<int32_t> setBatteryWritable(SysfsType stats, Number value) override;
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IBattery* getInstance(void);
};
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,110 +0,0 @@
// 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 "FlashLight.h"
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::parts::V1_0 {
// Methods from ::android::hardware::parts::V1_0::IFlashLight follow.
Return<int32_t> FlashLight::setFlashlightEnable(parts::V1_0::Number enable) {
std::ofstream file;
std::string writevalue;
switch (enable) {
case Number::ENABLE:
writevalue = "1";
break;
case Number::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(parts::V1_0::Value value) {
std::ofstream file;
std::string writevalue;
switch (value) {
case Value::ONEUI:
writevalue = "1";
break;
case Value::TWOUI:
writevalue = "2";
break;
case Value::THREEUI:
writevalue = "3";
break;
case Value::FOURUI:
writevalue = "4";
break;
case Value::FIVEUI:
writevalue = "5";
break;
case Value::SIXUI:
writevalue = "6";
break;
case Value::SEVENUI:
writevalue = "7";
break;
case Value::EIGHTUI:
writevalue = "8";
break;
case Value::NINEUI:
writevalue = "9";
break;
case Value::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(parts::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;
}
IFlashLight* FlashLight::getInstance(void) {
return new FlashLight();
}
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,39 +0,0 @@
// 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/IFlashLight.h>
namespace vendor::eureka::hardware::parts::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;
struct FlashLight : public IFlashLight {
// Methods from ::vendor::eureka::hardware::flashlight::V1_0::IFlashLight follow.
Return<int32_t> setFlashlightEnable(Number enable);
Return<int32_t> setFlashlightWritable(Value value);
Return<int32_t> readFlashlightstats(Device device);
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IFlashLight* getInstance(void);
};
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,53 +0,0 @@
// 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 "Gpu.h"
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::parts::V1_0 {
Return<int32_t> Gpu::setGpuWritable(parts::V1_0::Number enable) {
std::ofstream file;
std::string writevalue;
if (enable == Number::ENABLE) {
writevalue = "1";
} else {
writevalue = "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;
}
IGpu* Gpu::getInstance(void) {
return new Gpu();
}
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,38 +0,0 @@
// 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/IGpu.h>
namespace vendor::eureka::hardware::parts::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;
struct Gpu : public IGpu {
// Methods from ::vendor::eureka::hardware::parts::V1_0::IGpu follow.
Return<int32_t> setGpuWritable(Number enable);
Return<int32_t> readGpustats(void);
// Methods from ::android::hidl::base::V1_0::IBase follow.
static IGpu* getInstance(void);
};
} // namespace vendor::eureka::hardware::parss::V1_0

View file

@ -1,53 +0,0 @@
// 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 "SELinux.h"
#include <fstream>
#include <iostream>
#include <sstream>
namespace vendor::eureka::hardware::parts::V1_0 {
Return<int32_t> SELinux::setSELinuxWritable(parts::V1_0::Number enable) {
std::ofstream file;
std::string writevalue;
if (enable == Number::ENABLE) {
writevalue = "1";
} else {
writevalue = "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;
}
ISELinux* SELinux::getInstance(void) {
return new SELinux();
}
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,38 +0,0 @@
// 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/ISELinux.h>
namespace vendor::eureka::hardware::parts::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;
struct SELinux : public ISELinux {
// Methods from ::vendor::eureka::hardware::parts::V1_0::ISELinux follow.
Return<int32_t> setSELinuxWritable(Number enable);
Return<int32_t> readSELinuxstats(void);
// Methods from ::android::hidl::base::V1_0::IBase follow.
static ISELinux* getInstance(void);
};
} // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -1,92 +0,0 @@
// 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.
#define LOG_TAG "vendor.eureka.hardware.parts@1.0-service"
#include <vendor/eureka/hardware/parts/1.0/IBattery.h>
#include <vendor/eureka/hardware/parts/1.0/IFlashLight.h>
#include <vendor/eureka/hardware/parts/1.0/IGpu.h>
#include <vendor/eureka/hardware/parts/1.0/ISELinux.h>
#include <hidl/LegacySupport.h>
#include "Battery.h"
#include "FlashLight.h"
#include "Gpu.h"
#include "SELinux.h"
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using vendor::eureka::hardware::parts::V1_0::Battery;
using vendor::eureka::hardware::parts::V1_0::IBattery;
using vendor::eureka::hardware::parts::V1_0::FlashLight;
using vendor::eureka::hardware::parts::V1_0::IFlashLight;
using vendor::eureka::hardware::parts::V1_0::Gpu;
using vendor::eureka::hardware::parts::V1_0::IGpu;
using vendor::eureka::hardware::parts::V1_0::SELinux;
using vendor::eureka::hardware::parts::V1_0::ISELinux;
int main() {
int ret;
android::sp<IBattery> mBatteryService = Battery::getInstance();
android::sp<IFlashLight> mFlashLightService = FlashLight::getInstance();
android::sp<IGpu> mGPUService = Gpu::getInstance();
android::sp<ISELinux> mSEService = SELinux::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (mBatteryService != nullptr) {
ret = mBatteryService->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");
}
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 (mGPUService != nullptr) {
ret = mGPUService->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");
}
if (mSEService != nullptr) {
ret = mSEService->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
}

View file

@ -1,8 +0,0 @@
service vendor.parts-hal /vendor/bin/hw/vendor.eureka.hardware.parts@1.0-service
interface vendor.eureka.hardware.parts@1.0::IBattery default
interface vendor.eureka.hardware.parts@1.0::IGpu default
interface vendor.eureka.hardware.parts@1.0::IFlashLight default
interface vendor.eureka.hardware.parts@1.0::ISELinux default
class hal
user root
group root

View file

@ -1,23 +0,0 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.eureka.hardware.parts</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IBattery</name>
<instance>default</instance>
</interface>
<interface>
<name>IFlashLight</name>
<instance>default</instance>
</interface>
<interface>
<name>IGpu</name>
<instance>default</instance>
</interface>
<interface>
<name>ISELinux</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View file

@ -1,47 +0,0 @@
// 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;
enum SysfsType : int32_t {
CAPACITY_MAX,
TEMP,
CAPACITY_CURRENT,
CURRENT,
FASTCHARGE,
CHARGE,
};
enum Number : int32_t {
ENABLE = 1,
DISABLE = 0,
};
enum Device : int32_t {
A10,
NOTA10,
};
enum Value : int32_t {
ONEUI,
TWOUI,
THREEUI,
FOURUI,
FIVEUI,
SIXUI,
SEVENUI,
EIGHTUI,
NINEUI,
TENUI,
};