universal7885: interfaces: unify to 1 HIDL

This commit is contained in:
roynatech2544 2022-02-18 14:02:11 +09:00
commit fd74bda6dc
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
40 changed files with 222 additions and 496 deletions

View file

@ -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",
],
}

View file

@ -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 <vendor/eureka/hardware/battery/1.0/IBattery.h>
#include <hidl/LegacySupport.h>
#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<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

@ -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

View file

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

View file

@ -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,
};

View file

@ -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,
}

View file

@ -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" ],
}

View file

@ -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 <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
#include <hidl/LegacySupport.h>
#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<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

@ -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

View file

@ -1,11 +0,0 @@
<manifest version="1.0" type="device" target-level="3">
<hal format="hidl">
<name>vendor.eureka.hardware.flashlight</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IFlashlight</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View file

@ -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,
}

View file

@ -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" ],
}

View file

@ -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 <vendor/eureka/hardware/gpu/1.0/IGpu.h>
#include <hidl/LegacySupport.h>
#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<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

@ -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

View file

@ -1,11 +0,0 @@
<manifest version="1.0" type="device" target-level="3">
<hal format="hidl">
<name>vendor.eureka.hardware.gpu</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IGpu</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

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.gpu@1.0;
enum Enable : int32_t {
ENABLE,
DISABLE,
};

View file

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

View file

@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package vendor.eureka.hardware.flashlight@1.0; package vendor.eureka.hardware.parts@1.0;
interface IFlashlight { interface IFlashlight {
setFlashlightWritable(Number value) generates (int32_t result); setFlashlightWritable(Value value) generates (int32_t result);
setFlashlightEnable(Enable enable) generates (int32_t result); setFlashlightEnable(Number enable) generates (int32_t result);
readFlashlightstats(Device device) generates (int32_t value); readFlashlightstats(Device device) generates (int32_t value);
}; };

View file

@ -15,6 +15,6 @@
package vendor.eureka.hardware.gpu@1.0; package vendor.eureka.hardware.gpu@1.0;
interface IGpu { interface IGpu {
setGpuWritable(Enable enable) generates (int32_t result); setGpuWritable(Number enable) generates (int32_t result);
readGpustats() generates (int32_t value); readGpustats() generates (int32_t value);
}; };

View file

@ -15,6 +15,6 @@
package vendor.eureka.security.selinux@1.0; package vendor.eureka.security.selinux@1.0;
interface ISELinux { interface ISELinux {
setSELinuxWritable(Enable enable) generates (int32_t result); setSELinuxWritable(Number enable) generates (int32_t result);
readSELinuxstats() generates (int32_t value); readSELinuxstats() generates (int32_t value);
}; };

View file

@ -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" ],
}

View file

@ -18,10 +18,10 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
namespace vendor::eureka::hardware::battery::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
// Methods from ::android::hardware::battery::V1_0::IBattery follow. // Methods from ::android::hardware::battery::V1_0::IBattery follow.
Return<int32_t> Battery::getBatteryStats(battery::V1_0::SysfsType stats) { Return<int32_t> Battery::getBatteryStats(parts::V1_0::SysfsType stats) {
std::ifstream file; std::ifstream file;
std::string filename; std::string filename;
switch (stats) { switch (stats) {
@ -60,8 +60,8 @@ Return<int32_t> Battery::getBatteryStats(battery::V1_0::SysfsType stats) {
return -1; return -1;
} }
Return<int32_t> Battery::setBatteryWritable(battery::V1_0::SysfsType stats, Return<int32_t> Battery::setBatteryWritable(parts::V1_0::SysfsType stats,
battery::V1_0::Number value) { parts::V1_0::Number value) {
std::ofstream file; std::ofstream file;
std::string filename; std::string filename;
bool FastCharge = false; bool FastCharge = false;
@ -106,4 +106,4 @@ Return<int32_t> Battery::setBatteryWritable(battery::V1_0::SysfsType stats,
IBattery* Battery::getInstance(void) { IBattery* Battery::getInstance(void) {
return new Battery(); return new Battery();
} }
} // namespace vendor::eureka::hardware::battery::V1_0 } // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -16,12 +16,12 @@
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/eureka/hardware/battery/1.0/IBattery.h> #include <vendor/eureka/hardware/parts/1.0/IBattery.h>
#define ANDROID_SYSTEM_UID 1000 #define ANDROID_SYSTEM_UID 1000
#define ANDROID_ROOT_UID 0 #define ANDROID_ROOT_UID 0
namespace vendor::eureka::hardware::battery::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
using ::android::sp; using ::android::sp;
using ::android::hardware::hidl_array; using ::android::hardware::hidl_array;
@ -32,11 +32,11 @@ using ::android::hardware::Return;
using ::android::hardware::Void; using ::android::hardware::Void;
struct Battery : public IBattery { 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<int32_t> getBatteryStats(SysfsType stats) override; Return<int32_t> getBatteryStats(SysfsType stats) override;
Return<int32_t> setBatteryWritable(SysfsType stats, Number value) override; Return<int32_t> setBatteryWritable(SysfsType stats, Number value) override;
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
static IBattery* getInstance(void); static IBattery* getInstance(void);
}; };
} // namespace vendor::eureka::hardware::battery::V1_0 } // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -12,21 +12,21 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "Flashlight.h" #include "FlashLight.h"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
namespace vendor::eureka::hardware::flashlight::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
// Methods from ::android::hardware::flashlight::V1_0::IFlashlight follow. // Methods from ::android::hardware::parts::V1_0::IFlashLight follow.
Return<int32_t> Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable) { Return<int32_t> FlashLight::setFlashlightEnable(parts::V1_0::Number enable) {
std::ofstream file; std::ofstream file;
std::string writevalue; std::string writevalue;
switch (enable) { switch (enable) {
case Enable::ENABLE: case Number::ENABLE:
writevalue = "1"; writevalue = "1";
break; break;
case Enable::DISABLE: case Number::DISABLE:
writevalue = "0"; writevalue = "0";
break; break;
default: default:
@ -39,38 +39,38 @@ Return<int32_t> Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable)
return 0; return 0;
} }
Return<int32_t> Flashlight::setFlashlightWritable(flashlight::V1_0::Number value) { Return<int32_t> FlashLight::setFlashlightWritable(parts::V1_0::Value value) {
std::ofstream file; std::ofstream file;
std::string writevalue; std::string writevalue;
switch (value) { switch (value) {
case Number::ONEUI: case Value::ONEUI:
writevalue = "1"; writevalue = "1";
break; break;
case Number::TWOUI: case Value::TWOUI:
writevalue = "2"; writevalue = "2";
break; break;
case Number::THREEUI: case Value::THREEUI:
writevalue = "3"; writevalue = "3";
break; break;
case Number::FOURUI: case Value::FOURUI:
writevalue = "4"; writevalue = "4";
break; break;
case Number::FIVEUI: case Value::FIVEUI:
writevalue = "5"; writevalue = "5";
break; break;
case Number::SIXUI: case Value::SIXUI:
writevalue = "6"; writevalue = "6";
break; break;
case Number::SEVENUI: case Value::SEVENUI:
writevalue = "7"; writevalue = "7";
break; break;
case Number::EIGHTUI: case Value::EIGHTUI:
writevalue = "8"; writevalue = "8";
break; break;
case Number::NINEUI: case Value::NINEUI:
writevalue = "9"; writevalue = "9";
break; break;
case Number::TENUI: case Value::TENUI:
writevalue = "10"; writevalue = "10";
break; break;
default: default:
@ -83,7 +83,7 @@ Return<int32_t> Flashlight::setFlashlightWritable(flashlight::V1_0::Number value
return 0; return 0;
} }
Return<int32_t> Flashlight::readFlashlightstats(flashlight::V1_0::Device device) { Return<int32_t> FlashLight::readFlashlightstats(parts::V1_0::Device device) {
std::ifstream file; std::ifstream file;
std::string value; std::string value;
int32_t intvalue; int32_t intvalue;
@ -104,7 +104,7 @@ Return<int32_t> Flashlight::readFlashlightstats(flashlight::V1_0::Device device)
return -1; return -1;
} }
IFlashlight* Flashlight::getInstance(void) { IFlashlight* FlashLight::getInstance(void) {
return new Flashlight(); return new FlashLight();
} }
} // namespace vendor::eureka::hardware::flashlight::V1_0 } // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -16,9 +16,9 @@
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h> #include <vendor/eureka/hardware/parts/1.0/IFlashLight.h>
namespace vendor::eureka::hardware::flashlight::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
using ::android::sp; using ::android::sp;
using ::android::hardware::hidl_array; using ::android::hardware::hidl_array;
@ -28,12 +28,12 @@ using ::android::hardware::hidl_vec;
using ::android::hardware::Return; using ::android::hardware::Return;
using ::android::hardware::Void; using ::android::hardware::Void;
struct Flashlight : public IFlashlight { struct FlashLight : public IFlashLight {
// Methods from ::vendor::eureka::hardware::flashlight::V1_0::IFlashlight follow. // Methods from ::vendor::eureka::hardware::flashlight::V1_0::IFlashLight follow.
Return<int32_t> setFlashlightEnable(Enable enable); Return<int32_t> setFlashlightEnable(Number enable);
Return<int32_t> setFlashlightWritable(Number value); Return<int32_t> setFlashlightWritable(Value value);
Return<int32_t> readFlashlightstats(Device device); Return<int32_t> readFlashlightstats(Device device);
// Methods from ::android::hidl::base::V1_0::IBase follow. // 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

View file

@ -16,12 +16,12 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
namespace vendor::eureka::hardware::gpu::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
Return<int32_t> Gpu::setGpuWritable(gpu::V1_0::Enable enable) { Return<int32_t> Gpu::setGpuWritable(parts::V1_0::Number enable) {
std::ofstream file; std::ofstream file;
std::string writevalue; std::string writevalue;
if (enable == Enable::ENABLE) { if (enable == Number::ENABLE) {
writevalue = "1"; writevalue = "1";
} else { } else {
writevalue = "0"; writevalue = "0";
@ -50,4 +50,4 @@ Return<int32_t> Gpu::readGpustats(void) {
IGpu* Gpu::getInstance(void) { IGpu* Gpu::getInstance(void) {
return new Gpu(); return new Gpu();
} }
} // namespace vendor::eureka::hardware::gpu::V1_0 } // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -16,9 +16,9 @@
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/eureka/hardware/gpu/1.0/IGpu.h> #include <vendor/eureka/hardware/parts/1.0/IGpu.h>
namespace vendor::eureka::hardware::gpu::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
using ::android::sp; using ::android::sp;
using ::android::hardware::hidl_array; using ::android::hardware::hidl_array;
@ -29,10 +29,10 @@ using ::android::hardware::Return;
using ::android::hardware::Void; using ::android::hardware::Void;
struct Gpu : public IGpu { struct Gpu : public IGpu {
// Methods from ::vendor::eureka::hardware::gpu::V1_0::IGpu follow. // Methods from ::vendor::eureka::hardware::parts::V1_0::IGpu follow.
Return<int32_t> setGpuWritable(Enable enable); Return<int32_t> setGpuWritable(Number enable);
Return<int32_t> readGpustats(void); Return<int32_t> readGpustats(void);
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
static IGpu* getInstance(void); static IGpu* getInstance(void);
}; };
} // namespace vendor::eureka::hardware::gpu::V1_0 } // namespace vendor::eureka::hardware::parss::V1_0

View file

@ -16,12 +16,12 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
namespace vendor::eureka::security::selinux::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
Return<int32_t> SELinux::setSELinuxWritable(selinux::V1_0::Enable enable) { Return<int32_t> SELinux::setSELinuxWritable(parts::V1_0::Number enable) {
std::ofstream file; std::ofstream file;
std::string writevalue; std::string writevalue;
if (enable == Enable::ENABLE) { if (enable == Number::ENABLE) {
writevalue = "1"; writevalue = "1";
} else { } else {
writevalue = "0"; writevalue = "0";
@ -50,4 +50,4 @@ Return<int32_t> SELinux::readSELinuxstats(void) {
ISELinux* SELinux::getInstance(void) { ISELinux* SELinux::getInstance(void) {
return new SELinux(); return new SELinux();
} }
} // namespace vendor::eureka::security::selinux::V1_0 } // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -16,9 +16,9 @@
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/eureka/security/selinux/1.0/ISELinux.h> #include <vendor/eureka/hardware/parts/1.0/ISELinux.h>
namespace vendor::eureka::security::selinux::V1_0 { namespace vendor::eureka::hardware::parts::V1_0 {
using ::android::sp; using ::android::sp;
using ::android::hardware::hidl_array; using ::android::hardware::hidl_array;
@ -29,10 +29,10 @@ using ::android::hardware::Return;
using ::android::hardware::Void; using ::android::hardware::Void;
struct SELinux : public ISELinux { 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<int32_t> setSELinuxWritable(Enable enable); Return<int32_t> setSELinuxWritable(Enable enable);
Return<int32_t> readSELinuxstats(void); Return<int32_t> readSELinuxstats(void);
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
static ISELinux* getInstance(void); static ISELinux* getInstance(void);
}; };
} // namespace vendor::eureka::security::selinux::V1_0 } // namespace vendor::eureka::hardware::parts::V1_0

View file

@ -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 <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"
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

@ -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

View file

@ -0,0 +1,23 @@
<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

@ -12,14 +12,28 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 { enum Device : int32_t {
A10, A10,
NOTA10, NOTA10,
}; };
enum Number : int32_t { enum Value : int32_t {
ONEUI, ONEUI,
TWOUI, TWOUI,
THREEUI, THREEUI,
@ -31,8 +45,3 @@ enum Number : int32_t {
NINEUI, NINEUI,
TENUI, TENUI,
}; };
enum Enable : int32_t {
ENABLE,
DISABLE,
};

View file

@ -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,
}

View file

@ -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" ],
}

View file

@ -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 <vendor/eureka/security/selinux/1.0/ISELinux.h>
#include <hidl/LegacySupport.h>
#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<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
}

View file

@ -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

View file

@ -1,11 +0,0 @@
<manifest version="1.0" type="device" target-level="3">
<hal format="hidl">
<name>vendor.eureka.security.selinux</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ISELinux</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

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.security.selinux@1.0;
enum Enable : int32_t {
ENABLE,
DISABLE,
};