diff --git a/universal7885-common/interfaces/hardware/battery/1.0/default/Android.bp b/universal7885-common/interfaces/hardware/battery/1.0/default/Android.bp deleted file mode 100644 index 3fe3db0..0000000 --- a/universal7885-common/interfaces/hardware/battery/1.0/default/Android.bp +++ /dev/null @@ -1,17 +0,0 @@ -// FIXME: your file license if you have one - -cc_binary { - name: "vendor.eureka.hardware.battery@1.0-service", - relative_install_path: "hw", - proprietary: true, - srcs: [ - "Battery.cpp", - "service.cpp", - ], - shared_libs: [ - "libhidlbase", - "libutils", - "liblog", - "vendor.eureka.hardware.battery@1.0", - ], -} diff --git a/universal7885-common/interfaces/hardware/battery/1.0/default/service.cpp b/universal7885-common/interfaces/hardware/battery/1.0/default/service.cpp deleted file mode 100644 index f656465..0000000 --- a/universal7885-common/interfaces/hardware/battery/1.0/default/service.cpp +++ /dev/null @@ -1,48 +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.battery@1.0-service" - -#include - -#include - -#include "Battery.h" - -using android::sp; -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using vendor::eureka::hardware::battery::V1_0::Battery; -using vendor::eureka::hardware::battery::V1_0::IBattery; - -int main() { - int ret; - android::sp 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 -} diff --git a/universal7885-common/interfaces/hardware/battery/1.0/default/vendor.eureka.hardware.battery@1.0-service.rc b/universal7885-common/interfaces/hardware/battery/1.0/default/vendor.eureka.hardware.battery@1.0-service.rc deleted file mode 100644 index 721e17f..0000000 --- a/universal7885-common/interfaces/hardware/battery/1.0/default/vendor.eureka.hardware.battery@1.0-service.rc +++ /dev/null @@ -1,5 +0,0 @@ -service vendor.battery-hal /vendor/bin/hw/vendor.eureka.hardware.battery@1.0-service - interface vendor.eureka.hardware.battery@1.0::IBattery default - class hal - user root - group root diff --git a/universal7885-common/interfaces/hardware/battery/1.0/default/vendor.eureka.hardware.battery@1.0.xml b/universal7885-common/interfaces/hardware/battery/1.0/default/vendor.eureka.hardware.battery@1.0.xml deleted file mode 100644 index af50bb7..0000000 --- a/universal7885-common/interfaces/hardware/battery/1.0/default/vendor.eureka.hardware.battery@1.0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - vendor.eureka.hardware.battery - hwbinder - 1.0 - - IBattery - default - - - diff --git a/universal7885-common/interfaces/hardware/battery/1.0/types.hal b/universal7885-common/interfaces/hardware/battery/1.0/types.hal deleted file mode 100644 index b29acfc..0000000 --- a/universal7885-common/interfaces/hardware/battery/1.0/types.hal +++ /dev/null @@ -1,28 +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.battery@1.0; - -enum SysfsType : int32_t { - CAPACITY_MAX, - TEMP, - CAPACITY_CURRENT, - CURRENT, - FASTCHARGE, - CHARGE, -}; - -enum Number : int32_t { - ENABLE = 1, - DISABLE = 0, -}; diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/Android.bp b/universal7885-common/interfaces/hardware/flashlight/1.0/Android.bp deleted file mode 100644 index d7d6cf0..0000000 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/Android.bp +++ /dev/null @@ -1,10 +0,0 @@ -hidl_interface { - name: "vendor.eureka.hardware.flashlight@1.0", - root: "vendor.eureka", - srcs: [ - "types.hal", - "IFlashlight.hal", - ], - interfaces: [ "android.hidl.base@1.0" ], - gen_java: true, -} diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Android.bp b/universal7885-common/interfaces/hardware/flashlight/1.0/default/Android.bp deleted file mode 100644 index 6596a3d..0000000 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Android.bp +++ /dev/null @@ -1,19 +0,0 @@ -// FIXME: your file license if you have one - -cc_binary { - name: "vendor.eureka.hardware.flashlight@1.0-service", - relative_install_path: "hw", - proprietary: true, - srcs: [ - "Flashlight.cpp", - "service.cpp", - ], - shared_libs: [ - "libhidlbase", - "libutils", - "liblog", - "vendor.eureka.hardware.flashlight@1.0", - ], - init_rc: [ "vendor.eureka.hardware.flashlight@1.0-service.rc" ], - vintf_fragments: [ "vendor.eureka.hardware.flashlight@1.0.xml" ], -} diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/service.cpp b/universal7885-common/interfaces/hardware/flashlight/1.0/default/service.cpp deleted file mode 100644 index 7861ba1..0000000 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/service.cpp +++ /dev/null @@ -1,48 +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.flashlight@1.0-service" - -#include - -#include - -#include "Flashlight.h" - -using android::sp; -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using vendor::eureka::hardware::flashlight::V1_0::Flashlight; -using vendor::eureka::hardware::flashlight::V1_0::IFlashlight; - -int main() { - int ret; - android::sp 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 -} diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/vendor.eureka.hardware.flashlight@1.0-service.rc b/universal7885-common/interfaces/hardware/flashlight/1.0/default/vendor.eureka.hardware.flashlight@1.0-service.rc deleted file mode 100644 index 610da86..0000000 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/vendor.eureka.hardware.flashlight@1.0-service.rc +++ /dev/null @@ -1,5 +0,0 @@ -service vendor.flashlight-hal /vendor/bin/hw/vendor.eureka.hardware.flashlight@1.0-service - interface vendor.eureka.hardware.flashlight@1.0::IFlashlight default - class hal - user root - group root diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/vendor.eureka.hardware.flashlight@1.0.xml b/universal7885-common/interfaces/hardware/flashlight/1.0/default/vendor.eureka.hardware.flashlight@1.0.xml deleted file mode 100644 index a7b7d1a..0000000 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/vendor.eureka.hardware.flashlight@1.0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - vendor.eureka.hardware.flashlight - hwbinder - 1.0 - - IFlashlight - default - - - diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/Android.bp b/universal7885-common/interfaces/hardware/gpu/1.0/Android.bp deleted file mode 100644 index 3aa4c5d..0000000 --- a/universal7885-common/interfaces/hardware/gpu/1.0/Android.bp +++ /dev/null @@ -1,10 +0,0 @@ -hidl_interface { - name: "vendor.eureka.hardware.gpu@1.0", - root: "vendor.eureka", - srcs: [ - "types.hal", - "IGpu.hal", - ], - interfaces: [ "android.hidl.base@1.0" ], - gen_java: true, -} diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/Android.bp b/universal7885-common/interfaces/hardware/gpu/1.0/default/Android.bp deleted file mode 100644 index a226ce3..0000000 --- a/universal7885-common/interfaces/hardware/gpu/1.0/default/Android.bp +++ /dev/null @@ -1,19 +0,0 @@ -// FIXME: your file license if you have one - -cc_binary { - name: "vendor.eureka.hardware.gpu@1.0-service", - relative_install_path: "hw", - proprietary: true, - srcs: [ - "Gpu.cpp", - "service.cpp", - ], - shared_libs: [ - "libhidlbase", - "libutils", - "liblog", - "vendor.eureka.hardware.gpu@1.0", - ], - init_rc: [ "vendor.eureka.hardware.gpu@1.0-service.rc" ], - vintf_fragments: [ "vendor.eureka.hardware.gpu@1.0.xml" ], -} diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/service.cpp b/universal7885-common/interfaces/hardware/gpu/1.0/default/service.cpp deleted file mode 100644 index b52e00c..0000000 --- a/universal7885-common/interfaces/hardware/gpu/1.0/default/service.cpp +++ /dev/null @@ -1,48 +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.gpu@1.0-service" - -#include - -#include - -#include "Gpu.h" - -using android::sp; -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using vendor::eureka::hardware::gpu::V1_0::Gpu; -using vendor::eureka::hardware::gpu::V1_0::IGpu; - -int main() { - int ret; - android::sp 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 -} diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0-service.rc b/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0-service.rc deleted file mode 100644 index a301b27..0000000 --- a/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0-service.rc +++ /dev/null @@ -1,5 +0,0 @@ -service vendor.gpu-hal /vendor/bin/hw/vendor.eureka.hardware.gpu@1.0-service - interface vendor.eureka.hardware.gpu@1.0::IGpu default - class hal - user root - group root diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0.xml b/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0.xml deleted file mode 100644 index 5099cef..0000000 --- a/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - vendor.eureka.hardware.gpu - hwbinder - 1.0 - - IGpu - default - - - diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/types.hal b/universal7885-common/interfaces/hardware/gpu/1.0/types.hal deleted file mode 100644 index cadcf78..0000000 --- a/universal7885-common/interfaces/hardware/gpu/1.0/types.hal +++ /dev/null @@ -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.gpu@1.0; - -enum Enable : int32_t { - ENABLE, - DISABLE, -}; diff --git a/universal7885-common/interfaces/hardware/battery/1.0/Android.bp b/universal7885-common/interfaces/hardware/parts/1.0/Android.bp similarity index 60% rename from universal7885-common/interfaces/hardware/battery/1.0/Android.bp rename to universal7885-common/interfaces/hardware/parts/1.0/Android.bp index d6917b5..2f68103 100644 --- a/universal7885-common/interfaces/hardware/battery/1.0/Android.bp +++ b/universal7885-common/interfaces/hardware/parts/1.0/Android.bp @@ -1,9 +1,12 @@ hidl_interface { - name: "vendor.eureka.hardware.battery@1.0", + 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, diff --git a/universal7885-common/interfaces/hardware/battery/1.0/IBattery.hal b/universal7885-common/interfaces/hardware/parts/1.0/IBattery.hal similarity index 100% rename from universal7885-common/interfaces/hardware/battery/1.0/IBattery.hal rename to universal7885-common/interfaces/hardware/parts/1.0/IBattery.hal diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/IFlashlight.hal b/universal7885-common/interfaces/hardware/parts/1.0/IFlashLight.hal similarity index 79% rename from universal7885-common/interfaces/hardware/flashlight/1.0/IFlashlight.hal rename to universal7885-common/interfaces/hardware/parts/1.0/IFlashLight.hal index bc86bae..21dadb6 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/IFlashlight.hal +++ b/universal7885-common/interfaces/hardware/parts/1.0/IFlashLight.hal @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -package vendor.eureka.hardware.flashlight@1.0; +package vendor.eureka.hardware.parts@1.0; interface IFlashlight { - setFlashlightWritable(Number value) generates (int32_t result); - setFlashlightEnable(Enable enable) generates (int32_t result); + setFlashlightWritable(Value value) generates (int32_t result); + setFlashlightEnable(Number enable) generates (int32_t result); readFlashlightstats(Device device) generates (int32_t value); }; diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal b/universal7885-common/interfaces/hardware/parts/1.0/IGpu.hal similarity index 92% rename from universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal rename to universal7885-common/interfaces/hardware/parts/1.0/IGpu.hal index da4d910..8882c67 100644 --- a/universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal +++ b/universal7885-common/interfaces/hardware/parts/1.0/IGpu.hal @@ -15,6 +15,6 @@ package vendor.eureka.hardware.gpu@1.0; interface IGpu { - setGpuWritable(Enable enable) generates (int32_t result); + setGpuWritable(Number enable) generates (int32_t result); readGpustats() generates (int32_t value); }; diff --git a/universal7885-common/interfaces/security/selinux/1.0/ISELinux.hal b/universal7885-common/interfaces/hardware/parts/1.0/ISELinux.hal similarity index 91% rename from universal7885-common/interfaces/security/selinux/1.0/ISELinux.hal rename to universal7885-common/interfaces/hardware/parts/1.0/ISELinux.hal index e7a26a2..c618196 100644 --- a/universal7885-common/interfaces/security/selinux/1.0/ISELinux.hal +++ b/universal7885-common/interfaces/hardware/parts/1.0/ISELinux.hal @@ -15,6 +15,6 @@ package vendor.eureka.security.selinux@1.0; interface ISELinux { - setSELinuxWritable(Enable enable) generates (int32_t result); + setSELinuxWritable(Number enable) generates (int32_t result); readSELinuxstats() generates (int32_t value); }; diff --git a/universal7885-common/interfaces/hardware/parts/1.0/default/Android.bp b/universal7885-common/interfaces/hardware/parts/1.0/default/Android.bp new file mode 100644 index 0000000..42e2b88 --- /dev/null +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/Android.bp @@ -0,0 +1,22 @@ +// 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" ], +} diff --git a/universal7885-common/interfaces/hardware/battery/1.0/default/Battery.cpp b/universal7885-common/interfaces/hardware/parts/1.0/default/Battery.cpp similarity index 90% rename from universal7885-common/interfaces/hardware/battery/1.0/default/Battery.cpp rename to universal7885-common/interfaces/hardware/parts/1.0/default/Battery.cpp index 5bc53f7..8a325e9 100644 --- a/universal7885-common/interfaces/hardware/battery/1.0/default/Battery.cpp +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/Battery.cpp @@ -18,10 +18,10 @@ #include #include -namespace vendor::eureka::hardware::battery::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { // Methods from ::android::hardware::battery::V1_0::IBattery follow. -Return Battery::getBatteryStats(battery::V1_0::SysfsType stats) { +Return Battery::getBatteryStats(parts::V1_0::SysfsType stats) { std::ifstream file; std::string filename; switch (stats) { @@ -60,8 +60,8 @@ Return Battery::getBatteryStats(battery::V1_0::SysfsType stats) { return -1; } -Return Battery::setBatteryWritable(battery::V1_0::SysfsType stats, - battery::V1_0::Number value) { +Return Battery::setBatteryWritable(parts::V1_0::SysfsType stats, + parts::V1_0::Number value) { std::ofstream file; std::string filename; bool FastCharge = false; @@ -106,4 +106,4 @@ Return Battery::setBatteryWritable(battery::V1_0::SysfsType stats, IBattery* Battery::getInstance(void) { return new Battery(); } -} // namespace vendor::eureka::hardware::battery::V1_0 +} // namespace vendor::eureka::hardware::parts::V1_0 diff --git a/universal7885-common/interfaces/hardware/battery/1.0/default/Battery.h b/universal7885-common/interfaces/hardware/parts/1.0/default/Battery.h similarity index 83% rename from universal7885-common/interfaces/hardware/battery/1.0/default/Battery.h rename to universal7885-common/interfaces/hardware/parts/1.0/default/Battery.h index 13bc85e..948a2ae 100644 --- a/universal7885-common/interfaces/hardware/battery/1.0/default/Battery.h +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/Battery.h @@ -16,12 +16,12 @@ #include #include -#include +#include #define ANDROID_SYSTEM_UID 1000 #define ANDROID_ROOT_UID 0 -namespace vendor::eureka::hardware::battery::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { using ::android::sp; using ::android::hardware::hidl_array; @@ -32,11 +32,11 @@ using ::android::hardware::Return; using ::android::hardware::Void; struct Battery : public IBattery { - // Methods from ::vendor::eureka::hardware::battery::V1_0::IBattery follow. + // Methods from ::vendor::eureka::hardware::parts::V1_0::IBattery follow. Return getBatteryStats(SysfsType stats) override; Return setBatteryWritable(SysfsType stats, Number value) override; // Methods from ::android::hidl::base::V1_0::IBase follow. static IBattery* getInstance(void); }; -} // namespace vendor::eureka::hardware::battery::V1_0 +} // namespace vendor::eureka::hardware::parts::V1_0 diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.cpp b/universal7885-common/interfaces/hardware/parts/1.0/default/FlashLight.cpp similarity index 72% rename from universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.cpp rename to universal7885-common/interfaces/hardware/parts/1.0/default/FlashLight.cpp index 971f556..f40ee4f 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.cpp +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/FlashLight.cpp @@ -12,21 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "Flashlight.h" +#include "FlashLight.h" #include #include #include -namespace vendor::eureka::hardware::flashlight::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { -// Methods from ::android::hardware::flashlight::V1_0::IFlashlight follow. -Return Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable) { +// Methods from ::android::hardware::parts::V1_0::IFlashLight follow. +Return FlashLight::setFlashlightEnable(parts::V1_0::Number enable) { std::ofstream file; std::string writevalue; switch (enable) { - case Enable::ENABLE: + case Number::ENABLE: writevalue = "1"; break; - case Enable::DISABLE: + case Number::DISABLE: writevalue = "0"; break; default: @@ -39,38 +39,38 @@ Return Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable) return 0; } -Return Flashlight::setFlashlightWritable(flashlight::V1_0::Number value) { +Return FlashLight::setFlashlightWritable(parts::V1_0::Value value) { std::ofstream file; std::string writevalue; switch (value) { - case Number::ONEUI: + case Value::ONEUI: writevalue = "1"; break; - case Number::TWOUI: + case Value::TWOUI: writevalue = "2"; break; - case Number::THREEUI: + case Value::THREEUI: writevalue = "3"; break; - case Number::FOURUI: + case Value::FOURUI: writevalue = "4"; break; - case Number::FIVEUI: + case Value::FIVEUI: writevalue = "5"; break; - case Number::SIXUI: + case Value::SIXUI: writevalue = "6"; break; - case Number::SEVENUI: + case Value::SEVENUI: writevalue = "7"; break; - case Number::EIGHTUI: + case Value::EIGHTUI: writevalue = "8"; break; - case Number::NINEUI: + case Value::NINEUI: writevalue = "9"; break; - case Number::TENUI: + case Value::TENUI: writevalue = "10"; break; default: @@ -83,7 +83,7 @@ Return Flashlight::setFlashlightWritable(flashlight::V1_0::Number value return 0; } -Return Flashlight::readFlashlightstats(flashlight::V1_0::Device device) { +Return FlashLight::readFlashlightstats(parts::V1_0::Device device) { std::ifstream file; std::string value; int32_t intvalue; @@ -104,7 +104,7 @@ Return Flashlight::readFlashlightstats(flashlight::V1_0::Device device) return -1; } -IFlashlight* Flashlight::getInstance(void) { - return new Flashlight(); +IFlashlight* FlashLight::getInstance(void) { + return new FlashLight(); } -} // namespace vendor::eureka::hardware::flashlight::V1_0 +} // namespace vendor::eureka::hardware::parts::V1_0 diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.h b/universal7885-common/interfaces/hardware/parts/1.0/default/FlashLight.h similarity index 73% rename from universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.h rename to universal7885-common/interfaces/hardware/parts/1.0/default/FlashLight.h index bf16c42..b1a39e6 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.h +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/FlashLight.h @@ -16,9 +16,9 @@ #include #include -#include +#include -namespace vendor::eureka::hardware::flashlight::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { using ::android::sp; using ::android::hardware::hidl_array; @@ -28,12 +28,12 @@ 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 setFlashlightEnable(Enable enable); - Return setFlashlightWritable(Number value); +struct FlashLight : public IFlashLight { + // Methods from ::vendor::eureka::hardware::flashlight::V1_0::IFlashLight follow. + Return setFlashlightEnable(Number enable); + Return setFlashlightWritable(Value value); Return readFlashlightstats(Device device); // Methods from ::android::hidl::base::V1_0::IBase follow. - static IFlashlight* getInstance(void); + static IFlashLight* getInstance(void); }; -} // namespace vendor::eureka::hardware::flashlight::V1_0 +} // namespace vendor::eureka::hardware::parts::V1_0 diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.cpp b/universal7885-common/interfaces/hardware/parts/1.0/default/Gpu.cpp similarity index 86% rename from universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.cpp rename to universal7885-common/interfaces/hardware/parts/1.0/default/Gpu.cpp index 6677f96..021ef4f 100644 --- a/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.cpp +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/Gpu.cpp @@ -16,12 +16,12 @@ #include #include #include -namespace vendor::eureka::hardware::gpu::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { -Return Gpu::setGpuWritable(gpu::V1_0::Enable enable) { +Return Gpu::setGpuWritable(parts::V1_0::Number enable) { std::ofstream file; std::string writevalue; - if (enable == Enable::ENABLE) { + if (enable == Number::ENABLE) { writevalue = "1"; } else { writevalue = "0"; @@ -50,4 +50,4 @@ Return Gpu::readGpustats(void) { IGpu* Gpu::getInstance(void) { return new Gpu(); } -} // namespace vendor::eureka::hardware::gpu::V1_0 +} // namespace vendor::eureka::hardware::parts::V1_0 diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.h b/universal7885-common/interfaces/hardware/parts/1.0/default/Gpu.h similarity index 79% rename from universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.h rename to universal7885-common/interfaces/hardware/parts/1.0/default/Gpu.h index 3635602..29c4694 100644 --- a/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.h +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/Gpu.h @@ -16,9 +16,9 @@ #include #include -#include +#include -namespace vendor::eureka::hardware::gpu::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { using ::android::sp; using ::android::hardware::hidl_array; @@ -29,10 +29,10 @@ using ::android::hardware::Return; using ::android::hardware::Void; struct Gpu : public IGpu { - // Methods from ::vendor::eureka::hardware::gpu::V1_0::IGpu follow. - Return setGpuWritable(Enable enable); + // Methods from ::vendor::eureka::hardware::parts::V1_0::IGpu follow. + Return setGpuWritable(Number enable); Return readGpustats(void); // Methods from ::android::hidl::base::V1_0::IBase follow. static IGpu* getInstance(void); }; -} // namespace vendor::eureka::hardware::gpu::V1_0 +} // namespace vendor::eureka::hardware::parss::V1_0 diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.cpp b/universal7885-common/interfaces/hardware/parts/1.0/default/SELinux.cpp similarity index 85% rename from universal7885-common/interfaces/security/selinux/1.0/default/SELinux.cpp rename to universal7885-common/interfaces/hardware/parts/1.0/default/SELinux.cpp index a344d9e..ec3b1c5 100644 --- a/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.cpp +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/SELinux.cpp @@ -16,12 +16,12 @@ #include #include #include -namespace vendor::eureka::security::selinux::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { -Return SELinux::setSELinuxWritable(selinux::V1_0::Enable enable) { +Return SELinux::setSELinuxWritable(parts::V1_0::Number enable) { std::ofstream file; std::string writevalue; - if (enable == Enable::ENABLE) { + if (enable == Number::ENABLE) { writevalue = "1"; } else { writevalue = "0"; @@ -50,4 +50,4 @@ Return SELinux::readSELinuxstats(void) { ISELinux* SELinux::getInstance(void) { return new SELinux(); } -} // namespace vendor::eureka::security::selinux::V1_0 +} // namespace vendor::eureka::hardware::parts::V1_0 diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.h b/universal7885-common/interfaces/hardware/parts/1.0/default/SELinux.h similarity index 82% rename from universal7885-common/interfaces/security/selinux/1.0/default/SELinux.h rename to universal7885-common/interfaces/hardware/parts/1.0/default/SELinux.h index 0b2a44d..ee942d4 100644 --- a/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.h +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/SELinux.h @@ -16,9 +16,9 @@ #include #include -#include +#include -namespace vendor::eureka::security::selinux::V1_0 { +namespace vendor::eureka::hardware::parts::V1_0 { using ::android::sp; using ::android::hardware::hidl_array; @@ -29,10 +29,10 @@ using ::android::hardware::Return; using ::android::hardware::Void; struct SELinux : public ISELinux { - // Methods from ::vendor::eureka::security::selinux::V1_0::ISELinux follow. + // Methods from ::vendor::eureka::hardware::parts::V1_0::ISELinux follow. Return setSELinuxWritable(Enable enable); Return readSELinuxstats(void); // Methods from ::android::hidl::base::V1_0::IBase follow. static ISELinux* getInstance(void); }; -} // namespace vendor::eureka::security::selinux::V1_0 +} // namespace vendor::eureka::hardware::parts::V1_0 diff --git a/universal7885-common/interfaces/hardware/parts/1.0/default/service.cpp b/universal7885-common/interfaces/hardware/parts/1.0/default/service.cpp new file mode 100644 index 0000000..f2cefe0 --- /dev/null +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/service.cpp @@ -0,0 +1,89 @@ +// 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 +#include +#include +#include + +#include + +#include "Battery.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 mBatteryService = Battery::getInstance(); + android::sp mFlashLightService = FlashLight::getInstance(); + android::sp mGPUService = Gpu::getInstance(); + android::sp 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 +} diff --git a/universal7885-common/interfaces/hardware/parts/1.0/default/vendor.eureka.hardware.parts@1.0-service.rc b/universal7885-common/interfaces/hardware/parts/1.0/default/vendor.eureka.hardware.parts@1.0-service.rc new file mode 100644 index 0000000..44cf193 --- /dev/null +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/vendor.eureka.hardware.parts@1.0-service.rc @@ -0,0 +1,8 @@ +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 diff --git a/universal7885-common/interfaces/hardware/parts/1.0/default/vendor.eureka.hardware.parts@1.0.xml b/universal7885-common/interfaces/hardware/parts/1.0/default/vendor.eureka.hardware.parts@1.0.xml new file mode 100644 index 0000000..39483ec --- /dev/null +++ b/universal7885-common/interfaces/hardware/parts/1.0/default/vendor.eureka.hardware.parts@1.0.xml @@ -0,0 +1,23 @@ + + + vendor.eureka.hardware.parts + hwbinder + 1.0 + + IBattery + default + + + IFlashLight + default + + + IGpu + default + + + ISELinux + default + + + diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/types.hal b/universal7885-common/interfaces/hardware/parts/1.0/types.hal similarity index 79% rename from universal7885-common/interfaces/hardware/flashlight/1.0/types.hal rename to universal7885-common/interfaces/hardware/parts/1.0/types.hal index c06e368..53c2346 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/types.hal +++ b/universal7885-common/interfaces/hardware/parts/1.0/types.hal @@ -12,14 +12,28 @@ // See the License for the specific language governing permissions and // limitations under the License. -package vendor.eureka.hardware.flashlight@1.0; +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 Number : int32_t { +enum Value : int32_t { ONEUI, TWOUI, THREEUI, @@ -31,8 +45,3 @@ enum Number : int32_t { NINEUI, TENUI, }; - -enum Enable : int32_t { - ENABLE, - DISABLE, -}; diff --git a/universal7885-common/interfaces/security/selinux/1.0/Android.bp b/universal7885-common/interfaces/security/selinux/1.0/Android.bp deleted file mode 100644 index f92791e..0000000 --- a/universal7885-common/interfaces/security/selinux/1.0/Android.bp +++ /dev/null @@ -1,10 +0,0 @@ -hidl_interface { - name: "vendor.eureka.security.selinux@1.0", - root: "vendor.eureka", - srcs: [ - "types.hal", - "ISELinux.hal", - ], - interfaces: [ "android.hidl.base@1.0" ], - gen_java: true, -} diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/Android.bp b/universal7885-common/interfaces/security/selinux/1.0/default/Android.bp deleted file mode 100644 index 9214d73..0000000 --- a/universal7885-common/interfaces/security/selinux/1.0/default/Android.bp +++ /dev/null @@ -1,19 +0,0 @@ -// FIXME: your file license if you have one - -cc_binary { - name: "vendor.eureka.security.selinux@1.0-service", - relative_install_path: "hw", - proprietary: true, - srcs: [ - "SELinux.cpp", - "service.cpp", - ], - shared_libs: [ - "libhidlbase", - "libutils", - "liblog", - "vendor.eureka.security.selinux@1.0", - ], - init_rc: [ "vendor.eureka.security.selinux@1.0-service.rc" ], - vintf_fragments: [ "vendor.eureka.security.selinux@1.0.xml" ], -} diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/service.cpp b/universal7885-common/interfaces/security/selinux/1.0/default/service.cpp deleted file mode 100644 index c8db8eb..0000000 --- a/universal7885-common/interfaces/security/selinux/1.0/default/service.cpp +++ /dev/null @@ -1,48 +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.security.selinux@1.0-service" - -#include - -#include - -#include "SELinux.h" - -using android::sp; -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using vendor::eureka::security::selinux::V1_0::ISELinux; -using vendor::eureka::security::selinux::V1_0::SELinux; - -int main() { - int ret; - android::sp 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 -} diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0-service.rc b/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0-service.rc deleted file mode 100644 index f00cff9..0000000 --- a/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0-service.rc +++ /dev/null @@ -1,5 +0,0 @@ -service vendor.selinux-hal /vendor/bin/hw/vendor.eureka.security.selinux@1.0-service - interface vendor.eureka.security.selinux@1.0::ISELinux default - class hal - user root - group root diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0.xml b/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0.xml deleted file mode 100644 index 1f9f912..0000000 --- a/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - vendor.eureka.security.selinux - hwbinder - 1.0 - - ISELinux - default - - - diff --git a/universal7885-common/interfaces/security/selinux/1.0/types.hal b/universal7885-common/interfaces/security/selinux/1.0/types.hal deleted file mode 100644 index 00ac2d4..0000000 --- a/universal7885-common/interfaces/security/selinux/1.0/types.hal +++ /dev/null @@ -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.security.selinux@1.0; - -enum Enable : int32_t { - ENABLE, - DISABLE, -};