From c1a9d9f071d03869bb5d5f4136fcd173b6a0c2aa Mon Sep 17 00:00:00 2001 From: roynatech2544 Date: Mon, 25 Oct 2021 00:04:38 +0900 Subject: [PATCH] universal7885: SamsungParts: add gpu, selinux and update related sepolicy --- .../SamsungParts/AndroidManifest.xml | 2 +- universal7885-common/configs/hals.conf | 1 + .../hardware/flashlight/1.0/IFlashlight.hal | 2 +- .../flashlight/1.0/default/Flashlight.cpp | 10 +- .../flashlight/1.0/default/Flashlight.h | 6 +- .../hardware/flashlight/1.0/types.hal | 2 +- .../interfaces/hardware/gpu/1.0/Android.bp | 10 + .../interfaces/hardware/gpu/1.0/IGpu.hal | 20 ++ .../hardware/gpu/1.0/default/Android.bp | 19 ++ .../hardware/gpu/1.0/default/Gpu.cpp | 53 ++++ .../interfaces/hardware/gpu/1.0/default/Gpu.h | 39 +++ .../hardware/gpu/1.0/default/service.cpp | 49 ++++ .../vendor.eureka.hardware.gpu@1.0-service.rc | 5 + .../vendor.eureka.hardware.gpu@1.0.xml | 11 + .../interfaces/hardware/gpu/1.0/types.hal | 20 ++ .../security/selinux/1.0/Android.bp | 10 + .../security/selinux/1.0/ISELinux.hal | 20 ++ .../security/selinux/1.0/default/Android.bp | 19 ++ .../security/selinux/1.0/default/SELinux.cpp | 53 ++++ .../security/selinux/1.0/default/SELinux.h | 39 +++ .../security/selinux/1.0/default/service.cpp | 49 ++++ ...dor.eureka.security.selinux@1.0-service.rc | 5 + .../vendor.eureka.security.selinux@1.0.xml | 11 + .../interfaces/security/selinux/1.0/types.hal | 20 ++ universal7885-common/manifest.xml | 18 -- universal7885-common/sepolicy/public/init.te | 5 - .../sepolicy/public/system_app.te | 9 - universal7885-common/sepolicy/vendor/file.te | 244 +++++++++--------- .../sepolicy/vendor/file_contexts | 3 + .../sepolicy/vendor/hal_battery_default.te | 10 + .../sepolicy/vendor/hal_flashlight_default.te | 5 + .../sepolicy/vendor/hal_gpu_default.te | 9 + .../sepolicy/vendor/hal_selinux_default.te | 9 + .../sepolicy/vendor/hwservice.te | 2 + .../sepolicy/vendor/hwservice_contexts | 3 +- universal7885-common/universal7885-common.mk | 10 +- 36 files changed, 632 insertions(+), 170 deletions(-) create mode 100644 universal7885-common/configs/hals.conf create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/Android.bp create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/default/Android.bp create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.cpp create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.h create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/default/service.cpp create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0-service.rc create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0.xml create mode 100644 universal7885-common/interfaces/hardware/gpu/1.0/types.hal create mode 100644 universal7885-common/interfaces/security/selinux/1.0/Android.bp create mode 100644 universal7885-common/interfaces/security/selinux/1.0/ISELinux.hal create mode 100644 universal7885-common/interfaces/security/selinux/1.0/default/Android.bp create mode 100644 universal7885-common/interfaces/security/selinux/1.0/default/SELinux.cpp create mode 100644 universal7885-common/interfaces/security/selinux/1.0/default/SELinux.h create mode 100644 universal7885-common/interfaces/security/selinux/1.0/default/service.cpp create mode 100644 universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0-service.rc create mode 100644 universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0.xml create mode 100644 universal7885-common/interfaces/security/selinux/1.0/types.hal delete mode 100644 universal7885-common/sepolicy/public/init.te delete mode 100644 universal7885-common/sepolicy/public/system_app.te create mode 100644 universal7885-common/sepolicy/vendor/hal_gpu_default.te create mode 100644 universal7885-common/sepolicy/vendor/hal_selinux_default.te diff --git a/universal7885-common/SamsungParts/AndroidManifest.xml b/universal7885-common/SamsungParts/AndroidManifest.xml index 1bfc5c8..775a676 100644 --- a/universal7885-common/SamsungParts/AndroidManifest.xml +++ b/universal7885-common/SamsungParts/AndroidManifest.xml @@ -82,7 +82,7 @@ diff --git a/universal7885-common/configs/hals.conf b/universal7885-common/configs/hals.conf new file mode 100644 index 0000000..977c3d0 --- /dev/null +++ b/universal7885-common/configs/hals.conf @@ -0,0 +1 @@ +sensors.universal7884B.so diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/IFlashlight.hal b/universal7885-common/interfaces/hardware/flashlight/1.0/IFlashlight.hal index 313c059..bc86bae 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/IFlashlight.hal +++ b/universal7885-common/interfaces/hardware/flashlight/1.0/IFlashlight.hal @@ -14,7 +14,7 @@ package vendor.eureka.hardware.flashlight@1.0; -interface IFlashLight { +interface IFlashlight { setFlashlightWritable(Number value) generates (int32_t result); setFlashlightEnable(Enable enable) generates (int32_t result); readFlashlightstats(Device device) generates (int32_t value); diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.cpp b/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.cpp index 083fee2..83b13cf 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.cpp +++ b/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.cpp @@ -19,18 +19,18 @@ namespace vendor::eureka::hardware::flashlight::V1_0 { // Methods from ::android::hardware::flashlight::V1_0::IFlashlight follow. -Return Flashlight::getFlashlightStats(flashlight::V1_0::Enable enable) { +Return Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable) { std::ofstream file; std::string writevalue; switch (enable){ - case Number::ENABLE: + case Enable::ENABLE: writevalue = "1"; break; - case Number::DISABLE: + case Enable::DISABLE: writevalue = "0"; break; default: - filename = ""; + writevalue = ""; break; } file.open("/sys/class/camera/flash/torch_brightness_lvl_enable"); @@ -74,7 +74,7 @@ Return Flashlight::setFlashlightWritable(flashlight::V1_0::Number value writevalue = "10"; break; default: - filename = ""; + writevalue = ""; break; } file.open("/sys/class/camera/flash/torch_brightness_lvl"); diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.h b/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.h index c8c4033..56f2fee 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.h +++ b/universal7885-common/interfaces/hardware/flashlight/1.0/default/Flashlight.h @@ -30,9 +30,9 @@ using ::android::sp; struct Flashlight : public IFlashlight { // Methods from ::vendor::eureka::hardware::flashlight::V1_0::IFlashlight follow. - Return Flashlight::getFlashlightStats(flashlight::V1_0::Enable enable); - Return Flashlight::setFlashlightWritable(flashlight::V1_0::Number value); - Return Flashlight::readFlashlightstats(flashlight::V1_0::Device device); + Return setFlashlightEnable(Enable enable); + Return setFlashlightWritable(Number value); + Return readFlashlightstats(Device device); // Methods from ::android::hidl::base::V1_0::IBase follow. static IFlashlight* getInstance(void); diff --git a/universal7885-common/interfaces/hardware/flashlight/1.0/types.hal b/universal7885-common/interfaces/hardware/flashlight/1.0/types.hal index ae51633..c06e368 100644 --- a/universal7885-common/interfaces/hardware/flashlight/1.0/types.hal +++ b/universal7885-common/interfaces/hardware/flashlight/1.0/types.hal @@ -35,4 +35,4 @@ enum Number : int32_t { enum Enable : int32_t { ENABLE, DISABLE, -} +}; diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/Android.bp b/universal7885-common/interfaces/hardware/gpu/1.0/Android.bp new file mode 100644 index 0000000..3aa4c5d --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/Android.bp @@ -0,0 +1,10 @@ +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/IGpu.hal b/universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal new file mode 100644 index 0000000..da4d910 --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal @@ -0,0 +1,20 @@ +// 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; + +interface IGpu { + setGpuWritable(Enable enable) generates (int32_t result); + readGpustats() generates (int32_t value); +}; diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/Android.bp b/universal7885-common/interfaces/hardware/gpu/1.0/default/Android.bp new file mode 100644 index 0000000..a226ce3 --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/default/Android.bp @@ -0,0 +1,19 @@ +// 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/Gpu.cpp b/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.cpp new file mode 100644 index 0000000..657c881 --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.cpp @@ -0,0 +1,53 @@ +// 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 +#include +#include +namespace vendor::eureka::hardware::gpu::V1_0 { + +Return Gpu::setGpuWritable(gpu::V1_0::Enable enable) { + std::ofstream file; + std::string writevalue; + if (enable == Enable::ENABLE){ + writevalue = "1"; + }else{ + writevalue = "0"; + } + file.open("/sys/devices/platform/11500000.mali/tmu"); + file << writevalue; + file.close(); + return 0; +} + +Return 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 android::hardware::gpu::implementation diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.h b/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.h new file mode 100644 index 0000000..4ad1d14 --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/default/Gpu.h @@ -0,0 +1,39 @@ +// 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 +#include +#include + +namespace vendor::eureka::hardware::gpu::V1_0 { + +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct Gpu : public IGpu { + // Methods from ::vendor::eureka::hardware::gpu::V1_0::IGpu follow. + Return setGpuWritable(Enable enable); + Return readGpustats(void); + // Methods from ::android::hidl::base::V1_0::IBase follow. + static IGpu* getInstance(void); + +}; +} // namespace android::hardware::gpu::implementation diff --git a/universal7885-common/interfaces/hardware/gpu/1.0/default/service.cpp b/universal7885-common/interfaces/hardware/gpu/1.0/default/service.cpp new file mode 100644 index 0000000..04316d5 --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/default/service.cpp @@ -0,0 +1,49 @@ +// 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 vendor::eureka::hardware::gpu::V1_0::IGpu; +using vendor::eureka::hardware::gpu::V1_0::Gpu; +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::sp; + +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 new file mode 100644 index 0000000..a301b27 --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0-service.rc @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..5099cef --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/default/vendor.eureka.hardware.gpu@1.0.xml @@ -0,0 +1,11 @@ + + + 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 new file mode 100644 index 0000000..cadcf78 --- /dev/null +++ b/universal7885-common/interfaces/hardware/gpu/1.0/types.hal @@ -0,0 +1,20 @@ +// 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/security/selinux/1.0/Android.bp b/universal7885-common/interfaces/security/selinux/1.0/Android.bp new file mode 100644 index 0000000..f92791e --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/Android.bp @@ -0,0 +1,10 @@ +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/ISELinux.hal b/universal7885-common/interfaces/security/selinux/1.0/ISELinux.hal new file mode 100644 index 0000000..e7a26a2 --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/ISELinux.hal @@ -0,0 +1,20 @@ +// 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; + +interface ISELinux { + setSELinuxWritable(Enable enable) generates (int32_t result); + readSELinuxstats() generates (int32_t value); +}; diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/Android.bp b/universal7885-common/interfaces/security/selinux/1.0/default/Android.bp new file mode 100644 index 0000000..9214d73 --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/default/Android.bp @@ -0,0 +1,19 @@ +// 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/SELinux.cpp b/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.cpp new file mode 100644 index 0000000..019ef4c --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.cpp @@ -0,0 +1,53 @@ +// 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 +#include +#include +namespace vendor::eureka::security::selinux::V1_0 { + +Return SELinux::setSELinuxWritable(selinux::V1_0::Enable enable) { + std::ofstream file; + std::string writevalue; + if (enable == Enable::ENABLE){ + writevalue = "1"; + }else{ + writevalue = "0"; + } + file.open("/sys/fs/selinux/enforce"); + file << writevalue; + file.close(); + return 0; +} + +Return 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 android::security::selinux::implementation diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.h b/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.h new file mode 100644 index 0000000..d048773 --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/default/SELinux.h @@ -0,0 +1,39 @@ +// 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 +#include +#include + +namespace vendor::eureka::security::selinux::V1_0 { + +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct SELinux : public ISELinux { + // Methods from ::vendor::eureka::security::selinux::V1_0::ISELinux follow. + Return setSELinuxWritable(Enable enable); + Return readSELinuxstats(void); + // Methods from ::android::hidl::base::V1_0::IBase follow. + static ISELinux* getInstance(void); + +}; +} // namespace android::security::selinux::implementation diff --git a/universal7885-common/interfaces/security/selinux/1.0/default/service.cpp b/universal7885-common/interfaces/security/selinux/1.0/default/service.cpp new file mode 100644 index 0000000..a6f6a8c --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/default/service.cpp @@ -0,0 +1,49 @@ +// 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 vendor::eureka::security::selinux::V1_0::ISELinux; +using vendor::eureka::security::selinux::V1_0::SELinux; +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::sp; + +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 new file mode 100644 index 0000000..f00cff9 --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0-service.rc @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..1f9f912 --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/default/vendor.eureka.security.selinux@1.0.xml @@ -0,0 +1,11 @@ + + + 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 new file mode 100644 index 0000000..00ac2d4 --- /dev/null +++ b/universal7885-common/interfaces/security/selinux/1.0/types.hal @@ -0,0 +1,20 @@ +// 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, +}; diff --git a/universal7885-common/manifest.xml b/universal7885-common/manifest.xml index 8013120..1a972bb 100644 --- a/universal7885-common/manifest.xml +++ b/universal7885-common/manifest.xml @@ -172,15 +172,6 @@ default - - android.hardware.sensors - hwbinder - 1.0 - - ISensors - default - - android.hardware.thermal hwbinder @@ -241,13 +232,4 @@ imsd2 - - vendor.eureka.hardware.battery - hwbinder - 1.0 - - IBattery - default - - diff --git a/universal7885-common/sepolicy/public/init.te b/universal7885-common/sepolicy/public/init.te deleted file mode 100644 index 6461e8f..0000000 --- a/universal7885-common/sepolicy/public/init.te +++ /dev/null @@ -1,5 +0,0 @@ -allow init sysfs_gpu_tmu:file { setattr }; -allow init sysfs_flashlight:file { setattr }; -allow init selinuxfs:file { setattr }; -allow init sysfs_sec_switch_writable:file { setattr }; -allow init sysfs_battery_writable:file { setattr }; repo):universal7885-common/sepolicy/public/init.te diff --git a/universal7885-common/sepolicy/public/system_app.te b/universal7885-common/sepolicy/public/system_app.te deleted file mode 100644 index b24e241..0000000 --- a/universal7885-common/sepolicy/public/system_app.te +++ /dev/null @@ -1,9 +0,0 @@ -allow system_app sysfs_gpu_tmu:file { read open write getattr }; -allow system_app sysfs_flashlight:file { read open write getattr }; -allow system_app selinuxfs:file rw_file_perms; -allow system_app sysfs_sec_switch:dir { search }; -allow system_app sysfs_sec_switch_writable:file rw_file_perms; -allow system_app sysfs_battery_writeable:file rw_file_perms; -allow system_app sysfs_sec_switch_writable:dir { search }; -allow system_app sysfs_battery_writeable:dir { search }; -allow system_app sysfs_battery:dir { search }; diff --git a/universal7885-common/sepolicy/vendor/file.te b/universal7885-common/sepolicy/vendor/file.te index 27d593d..7deea73 100644 --- a/universal7885-common/sepolicy/vendor/file.te +++ b/universal7885-common/sepolicy/vendor/file.te @@ -1,123 +1,123 @@ -### DATA -type biometrics_vendor_data_file, file_type, data_file_type; -type conn_vendor_data_file, file_type, data_file_type; -type gps_vendor_data_file, file_type, data_file_type; -type log_vendor_data_file, file_type, data_file_type; -type log_cbd_vendor_data_file, file_type, data_file_type; -type radio_vendor_data_file, file_type, data_file_type; -type wifi_vendor_data_file, file_type, data_file_type; - -# EFS -type app_efs_file, file_type; -type battery_efs_file, file_type; -type bin_nv_data_efs_file, file_type; -type cpk_efs_file, file_type; -type imei_efs_file, file_type; -type nfc_efs_file, file_type; -type pfw_efs_file, file_type; -type prov_efs_file, file_type; -type sec_efs_file, file_type; -type tee_efs_file, file_type; -type wifi_efs_file, file_type; - -# PROC -type proc_last_kmsg, fs_type, proc_type; - -# SOCKETS -type epicd_socket, file_type, data_file_type; - -### SYSFS -type sysfs_argos, sysfs_type, r_fs_type, fs_type; -#type sysfs_battery, sysfs_type, r_fs_type, fs_type; -type sysfs_bbd, sysfs_type, r_fs_type, fs_type; -type sysfs_fingerprint, sysfs_type, r_fs_type, fs_type; -type sysfs_iio, sysfs_type, r_fs_type, fs_type; -type sysfs_input, sysfs_type, r_fs_type, fs_type; -type sysfs_sec_gps, sysfs_type, r_fs_type, fs_type; -type sysfs_sec_key, sysfs_type, r_fs_type, fs_type; -type sysfs_sec_sensors, sysfs_type, r_fs_type, fs_type; -#type sysfs_sec_switch, sysfs_type, r_fs_type, fs_type; -type sysfs_sec_touchscreen, sysfs_type, r_fs_type, fs_type; -type sysfs_sim, sysfs_type, r_fs_type, fs_type; -type sysfs_sensors, sysfs_type, r_fs_type, fs_type; -type sysfs_wifi, sysfs_type, r_fs_type, fs_type; - -type sysfs_backlight_writable, sysfs_type, rw_fs_type, fs_type; -#type sysfs_battery_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_bt_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_gps_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_lcd_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_power_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_scsi_host_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_sensorhub_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_sensors_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_sim_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_spi_writeable, sysfs_type, rw_fs_type, fs_type; -#type sysfs_sec_switch_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_touchscreen_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_wifi_writable, sysfs_type, rw_fs_type, fs_type; - -### VENDOR -type vendor_firmware_file, file_type, vendor_file_type; - -# DATA -type tee_vendor_data_file, file_type, data_file_type; - -# DEV SOCKET -type tz_socket, file_type; -### efs types -type radio_factoryapp_efs_file, file_type; -type factoryprop_efs_file, file_type; -type sensor_factoryapp_efs_file, file_type; -type factorymode_factoryapp_efs_file, file_type; -type baro_delta_factoryapp_efs_file, file_type; -# gps -type gps_socket, file_type; -# debugfs types -type debugfs_mali, fs_type, debugfs_type; -type debugfs_mali_mem, fs_type, debugfs_type; -type debugfs_ion, fs_type, debugfs_type; -type debugfs_ion_dma, fs_type, debugfs_type; -# cache -type boot_logcat_file, file_type, data_file_type; -# proc -type proc_extra, fs_type, proc_type; -type proc_reset_reason, fs_type, proc_type; -type proc_swapiness, fs_type, proc_type; - -# data types -type display_vendor_data_file, file_type, data_file_type; -type fingerprintd_vendor_data_file, data_file_type, file_type; -type mediadrm_data_file, file_type, data_file_type; -type nfc_vendor_data_file, file_type, data_file_type; - -# sysfs types -type sysfs_battery_info, sysfs_type, fs_type; -type sysfs_battery_supply, sysfs_type, rw_fs_type, fs_type; -type sysfs_abox_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_sensor_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_input_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_batteryinfo_charger_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_camera_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_decon, sysfs_type, r_fs_type, fs_type; -type sysfs_gpu, sysfs_type, r_fs_type, fs_type; -type sysfs_socinfo, sysfs_type, r_fs_type, fs_type; -type sysfs_v4l, sysfs_type, r_fs_type, fs_type; -type sysfs_v4l_mfc, sysfs_type, r_fs_type, fs_type; -type sysfs_v4l_smfc, sysfs_type, r_fs_type, fs_type; -type sysfs_v4l_fimc, sysfs_type, r_fs_type, fs_type; -type sysfs_graphics, fs_type, sysfs_type; -type sysfs_multipdp, fs_type, sysfs_type, mlstrustedobject; -type sysfs_sec, fs_type, sysfs_type, mlstrustedobject; -type sysfs_gps, fs_type, sysfs_type, mlstrustedobject; -type sysfs_brightness, fs_type, sysfs_type, mlstrustedobject; -type sysfs_virtual, fs_type, sysfs_type, mlstrustedobject; -type sysfs_fuelgauge, fs_type, sysfs_type, mlstrustedobject; -type sysfs_charger, fs_type, sysfs_type, mlstrustedobject; -type sysfs_modem, fs_type, sysfs_type, mlstrustedobject; -type sysfs_camera, fs_type, sysfs_type, mlstrustedobject; -type sysfs_mmc_host_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_ss_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_usb_writable, sysfs_type, rw_fs_type, fs_type; -type sysfs_gpu_writable, sysfs_type, rw_fs_type, fs_type; +### DATA +type biometrics_vendor_data_file, file_type, data_file_type; +type conn_vendor_data_file, file_type, data_file_type; +type gps_vendor_data_file, file_type, data_file_type; +type log_vendor_data_file, file_type, data_file_type; +type log_cbd_vendor_data_file, file_type, data_file_type; +type radio_vendor_data_file, file_type, data_file_type; +type wifi_vendor_data_file, file_type, data_file_type; + +# EFS +type app_efs_file, file_type; +type battery_efs_file, file_type; +type bin_nv_data_efs_file, file_type; +type cpk_efs_file, file_type; +type imei_efs_file, file_type; +type nfc_efs_file, file_type; +type pfw_efs_file, file_type; +type prov_efs_file, file_type; +type sec_efs_file, file_type; +type tee_efs_file, file_type; +type wifi_efs_file, file_type; + +# PROC +type proc_last_kmsg, fs_type, proc_type; + +# SOCKETS +type epicd_socket, file_type, data_file_type; + +### SYSFS +type sysfs_argos, sysfs_type, r_fs_type, fs_type; +#type sysfs_battery, sysfs_type, r_fs_type, fs_type; +type sysfs_bbd, sysfs_type, r_fs_type, fs_type; +type sysfs_fingerprint, sysfs_type, r_fs_type, fs_type; +type sysfs_iio, sysfs_type, r_fs_type, fs_type; +type sysfs_input, sysfs_type, r_fs_type, fs_type; +type sysfs_sec_gps, sysfs_type, r_fs_type, fs_type; +type sysfs_sec_key, sysfs_type, r_fs_type, fs_type; +type sysfs_sec_sensors, sysfs_type, r_fs_type, fs_type; +#type sysfs_sec_switch, sysfs_type, r_fs_type, fs_type; +type sysfs_sec_touchscreen, sysfs_type, r_fs_type, fs_type; +type sysfs_sim, sysfs_type, r_fs_type, fs_type; +type sysfs_sensors, sysfs_type, r_fs_type, fs_type; +type sysfs_wifi, sysfs_type, r_fs_type, fs_type; + +type sysfs_backlight_writable, sysfs_type, rw_fs_type, fs_type; +#type sysfs_battery_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_bt_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_gps_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_lcd_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_power_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_scsi_host_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_sensorhub_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_sensors_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_sim_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_spi_writeable, sysfs_type, rw_fs_type, fs_type; +#type sysfs_sec_switch_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_touchscreen_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_wifi_writable, sysfs_type, rw_fs_type, fs_type; + +### VENDOR +type vendor_firmware_file, file_type, vendor_file_type; + +# DATA +type tee_vendor_data_file, file_type, data_file_type; + +# DEV SOCKET +type tz_socket, file_type; +### efs types +type radio_factoryapp_efs_file, file_type; +type factoryprop_efs_file, file_type; +type sensor_factoryapp_efs_file, file_type; +type factorymode_factoryapp_efs_file, file_type; +type baro_delta_factoryapp_efs_file, file_type; +# gps +type gps_socket, file_type; +# debugfs types +type debugfs_mali, fs_type, debugfs_type; +type debugfs_mali_mem, fs_type, debugfs_type; +type debugfs_ion, fs_type, debugfs_type; +type debugfs_ion_dma, fs_type, debugfs_type; +# cache +type boot_logcat_file, file_type, data_file_type; +# proc +type proc_extra, fs_type, proc_type; +type proc_reset_reason, fs_type, proc_type; +type proc_swapiness, fs_type, proc_type; + +# data types +type display_vendor_data_file, file_type, data_file_type; +type fingerprintd_vendor_data_file, data_file_type, file_type; +type mediadrm_data_file, file_type, data_file_type; +type nfc_vendor_data_file, file_type, data_file_type; + +# sysfs types +type sysfs_battery_info, sysfs_type, fs_type; +type sysfs_battery_supply, sysfs_type, rw_fs_type, fs_type; +type sysfs_abox_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_sensor_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_input_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_batteryinfo_charger_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_camera_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_decon, sysfs_type, r_fs_type, fs_type; +type sysfs_gpu, sysfs_type, r_fs_type, fs_type; +type sysfs_socinfo, sysfs_type, r_fs_type, fs_type; +type sysfs_v4l, sysfs_type, r_fs_type, fs_type; +type sysfs_v4l_mfc, sysfs_type, r_fs_type, fs_type; +type sysfs_v4l_smfc, sysfs_type, r_fs_type, fs_type; +type sysfs_v4l_fimc, sysfs_type, r_fs_type, fs_type; +type sysfs_graphics, fs_type, sysfs_type; +type sysfs_multipdp, fs_type, sysfs_type, mlstrustedobject; +type sysfs_sec, fs_type, sysfs_type, mlstrustedobject; +type sysfs_gps, fs_type, sysfs_type, mlstrustedobject; +type sysfs_brightness, fs_type, sysfs_type, mlstrustedobject; +type sysfs_virtual, fs_type, sysfs_type, mlstrustedobject; +type sysfs_fuelgauge, fs_type, sysfs_type, mlstrustedobject; +type sysfs_charger, fs_type, sysfs_type, mlstrustedobject; +type sysfs_modem, fs_type, sysfs_type, mlstrustedobject; +type sysfs_camera, fs_type, sysfs_type, mlstrustedobject; +type sysfs_mmc_host_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_ss_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_usb_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_gpu_writable, sysfs_type, rw_fs_type, fs_type; type sysfs_info, sysfs_type, r_fs_type, fs_type; \ No newline at end of file diff --git a/universal7885-common/sepolicy/vendor/file_contexts b/universal7885-common/sepolicy/vendor/file_contexts index 7c6f72a..2455005 100644 --- a/universal7885-common/sepolicy/vendor/file_contexts +++ b/universal7885-common/sepolicy/vendor/file_contexts @@ -212,7 +212,10 @@ /(vendor|system/vendor)/bin/hw/android\.hardware\.usb@[0-9]\.[0-9]-service\.exynos7884B u:object_r:hal_usb_default_exec:s0 /(vendor|system/vendor)/bin/hw/vendor\.samsung\.hardware\.gnss@[0-9]\.[0-9]-service u:object_r:hal_gnss_default_exec:s0 /(vendor|system/vendor)/firmware(/.*)? u:object_r:vendor_firmware_file:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.sensors@2.1-service\.samsung-multihal u:object_r:hal_sensors_default_exec:s0 # SamsungParts /(vendor|system/vendor)/bin/hw/vendor\.eureka\.hardware\.battery@1\.0-service u:object_r:hal_battery_default_exec:s0 /(vendor|system/vendor)/bin/hw/vendor\.eureka\.hardware\.flashlight@1\.0-service u:object_r:hal_flashlight_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.eureka\.hardware\.gpu@1\.0-service u:object_r:hal_gpu_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.eureka\.security\.selinux@1\.0-service u:object_r:hal_selinux_default_exec:s0 diff --git a/universal7885-common/sepolicy/vendor/hal_battery_default.te b/universal7885-common/sepolicy/vendor/hal_battery_default.te index 1bd4afe..3164834 100644 --- a/universal7885-common/sepolicy/vendor/hal_battery_default.te +++ b/universal7885-common/sepolicy/vendor/hal_battery_default.te @@ -2,3 +2,13 @@ type hal_battery_default, domain; type hal_battery_default_exec, exec_type, file_type, vendor_file_type; add_hwservice(hal_battery_default, hal_battery_hwservice); init_daemon_domain(hal_battery_default); + +hwbinder_use(hal_battery_default); +get_prop(hal_battery_default, hwservicemanager_prop); + +allow hal_battery_default sysfs_sec_switch:dir { search }; +allow hal_battery_default sysfs_sec_switch_writable:file rw_file_perms; +allow hal_battery_default sysfs_battery_writable:file rw_file_perms; +allow hal_battery_default sysfs_sec_switch_writable:dir { search }; +allow hal_battery_default sysfs_battery_writable:dir { search }; +allow hal_battery_default sysfs_battery:dir { search }; diff --git a/universal7885-common/sepolicy/vendor/hal_flashlight_default.te b/universal7885-common/sepolicy/vendor/hal_flashlight_default.te index 3830ecc..bc052b3 100644 --- a/universal7885-common/sepolicy/vendor/hal_flashlight_default.te +++ b/universal7885-common/sepolicy/vendor/hal_flashlight_default.te @@ -2,3 +2,8 @@ type hal_flashlight_default, domain; type hal_flashlight_default_exec, exec_type, file_type, vendor_file_type; add_hwservice(hal_flashlight_default, hal_flashlight_hwservice); init_daemon_domain(hal_flashlight_default); + +hwbinder_use(hal_flashlight_default); +get_prop(hal_flashlight_default, hwservicemanager_prop); +allow hal_flashlight_default sysfs_flashlight:file { read open write getattr }; +allow hal_flashlight_default sysfs_flashlight:dir search; diff --git a/universal7885-common/sepolicy/vendor/hal_gpu_default.te b/universal7885-common/sepolicy/vendor/hal_gpu_default.te new file mode 100644 index 0000000..597e062 --- /dev/null +++ b/universal7885-common/sepolicy/vendor/hal_gpu_default.te @@ -0,0 +1,9 @@ +type hal_gpu_default, domain; +type hal_gpu_default_exec, exec_type, file_type, vendor_file_type; +add_hwservice(hal_gpu_default, hal_gpu_hwservice); +init_daemon_domain(hal_gpu_default); + +hwbinder_use(hal_gpu_default); +get_prop(hal_gpu_default, hwservicemanager_prop) +allow system_app sysfs_gpu_tmu:file { read open write getattr }; +allow system_app sysfs_gpu_tmu:dir search; diff --git a/universal7885-common/sepolicy/vendor/hal_selinux_default.te b/universal7885-common/sepolicy/vendor/hal_selinux_default.te new file mode 100644 index 0000000..71ff127 --- /dev/null +++ b/universal7885-common/sepolicy/vendor/hal_selinux_default.te @@ -0,0 +1,9 @@ +type hal_selinux_default, domain; +type hal_selinux_default_exec, exec_type, file_type, vendor_file_type; +add_hwservice(hal_selinux_default, hal_selinux_hwservice); +init_daemon_domain(hal_selinux_default); + +hwbinder_use(hal_selinux_default) +get_prop(hal_selinux_default, hwservicemanager_prop) +allow hal_selinux_default selinuxfs:file rw_file_perms; +allow hal_selinux_default selinuxfs:dir search; diff --git a/universal7885-common/sepolicy/vendor/hwservice.te b/universal7885-common/sepolicy/vendor/hwservice.te index 00e9f7c..dfaa12e 100644 --- a/universal7885-common/sepolicy/vendor/hwservice.te +++ b/universal7885-common/sepolicy/vendor/hwservice.te @@ -1,3 +1,5 @@ type rild_hwservice, hwservice_manager_type; type hal_battery_hwservice, hwservice_manager_type; type hal_flashlight_hwservice, hwservice_manager_type; +type hal_gpu_hwservice, hwservice_manager_type; +type hal_selinux_hwservice, hwservice_manager_type; diff --git a/universal7885-common/sepolicy/vendor/hwservice_contexts b/universal7885-common/sepolicy/vendor/hwservice_contexts index 5f5a0eb..c73f104 100644 --- a/universal7885-common/sepolicy/vendor/hwservice_contexts +++ b/universal7885-common/sepolicy/vendor/hwservice_contexts @@ -7,4 +7,5 @@ vendor.lineage.power::ILineagePower u:object_r:hal_power_hwservice:s0 # SamsungParts vendor.eureka.hardware.battery::IBattery u:object_r:hal_battery_hwservice:s0 vendor.eureka.hardware.flashlight::IFlashlight u:object_r:hal_flashlight_hwservice:s0 - +vendor.eureka.hardware.gpu::IGpu u:object_r:hal_gpu_hwservice:s0 +vendor.eureka.security.selinux::ISELinux u:object_r:hal_selinux_hwservice:s0 diff --git a/universal7885-common/universal7885-common.mk b/universal7885-common/universal7885-common.mk index 4350dab..3997c7a 100644 --- a/universal7885-common/universal7885-common.mk +++ b/universal7885-common/universal7885-common.mk @@ -226,9 +226,9 @@ PRODUCT_COPY_FILES += \ # Sensors PRODUCT_PACKAGES += \ - android.hardware.sensors@1.0-impl.samsung \ - android.hardware.sensors@1.0-service \ - libsensorndkbridge + android.hardware.sensors@2.1-service.samsung-multihal \ + libsensorndkbridge \ + $(LOCAL_PATH)/configs/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf # Shims PRODUCT_PACKAGES += \ @@ -281,7 +281,9 @@ PRODUCT_PACKAGES += \ SamsungParts \ init.samsungparts.rc \ vendor.eureka.hardware.battery@1.0-service \ - vendor.eureka.hardware.flashlight@1.0-service + vendor.eureka.hardware.flashlight@1.0-service \ + vendor.eureka.hardware.gpu@1.0-service \ + vendor.eureka.security.selinux@1.0-service # Debug ifeq ($(TARGET_BUILD_VARIENT),eng)