mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 04:25:33 -04:00
universal7885: SamsungParts: add gpu, selinux and update related sepolicy
This commit is contained in:
parent
1bcf57f719
commit
c1a9d9f071
36 changed files with 632 additions and 170 deletions
|
|
@ -82,7 +82,7 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.eurekateam.samsungparts.battery.BatteryActivity"
|
android:name=".battery.BatteryActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/fastcharge_title">
|
android:label="@string/fastcharge_title">
|
||||||
|
|
||||||
|
|
|
||||||
1
universal7885-common/configs/hals.conf
Normal file
1
universal7885-common/configs/hals.conf
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
sensors.universal7884B.so
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
package vendor.eureka.hardware.flashlight@1.0;
|
package vendor.eureka.hardware.flashlight@1.0;
|
||||||
|
|
||||||
interface IFlashLight {
|
interface IFlashlight {
|
||||||
setFlashlightWritable(Number value) generates (int32_t result);
|
setFlashlightWritable(Number value) generates (int32_t result);
|
||||||
setFlashlightEnable(Enable enable) generates (int32_t result);
|
setFlashlightEnable(Enable enable) generates (int32_t result);
|
||||||
readFlashlightstats(Device device) generates (int32_t value);
|
readFlashlightstats(Device device) generates (int32_t value);
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,18 @@
|
||||||
namespace vendor::eureka::hardware::flashlight::V1_0 {
|
namespace vendor::eureka::hardware::flashlight::V1_0 {
|
||||||
|
|
||||||
// Methods from ::android::hardware::flashlight::V1_0::IFlashlight follow.
|
// Methods from ::android::hardware::flashlight::V1_0::IFlashlight follow.
|
||||||
Return<int32_t> Flashlight::getFlashlightStats(flashlight::V1_0::Enable enable) {
|
Return<int32_t> Flashlight::setFlashlightEnable(flashlight::V1_0::Enable enable) {
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
std::string writevalue;
|
std::string writevalue;
|
||||||
switch (enable){
|
switch (enable){
|
||||||
case Number::ENABLE:
|
case Enable::ENABLE:
|
||||||
writevalue = "1";
|
writevalue = "1";
|
||||||
break;
|
break;
|
||||||
case Number::DISABLE:
|
case Enable::DISABLE:
|
||||||
writevalue = "0";
|
writevalue = "0";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
filename = "";
|
writevalue = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
file.open("/sys/class/camera/flash/torch_brightness_lvl_enable");
|
file.open("/sys/class/camera/flash/torch_brightness_lvl_enable");
|
||||||
|
|
@ -74,7 +74,7 @@ Return<int32_t> Flashlight::setFlashlightWritable(flashlight::V1_0::Number value
|
||||||
writevalue = "10";
|
writevalue = "10";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
filename = "";
|
writevalue = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
file.open("/sys/class/camera/flash/torch_brightness_lvl");
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ using ::android::sp;
|
||||||
|
|
||||||
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> Flashlight::getFlashlightStats(flashlight::V1_0::Enable enable);
|
Return<int32_t> setFlashlightEnable(Enable enable);
|
||||||
Return<int32_t> Flashlight::setFlashlightWritable(flashlight::V1_0::Number value);
|
Return<int32_t> setFlashlightWritable(Number value);
|
||||||
Return<int32_t> Flashlight::readFlashlightstats(flashlight::V1_0::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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,4 @@ enum Number : int32_t {
|
||||||
enum Enable : int32_t {
|
enum Enable : int32_t {
|
||||||
ENABLE,
|
ENABLE,
|
||||||
DISABLE,
|
DISABLE,
|
||||||
}
|
};
|
||||||
|
|
|
||||||
10
universal7885-common/interfaces/hardware/gpu/1.0/Android.bp
Normal file
10
universal7885-common/interfaces/hardware/gpu/1.0/Android.bp
Normal file
|
|
@ -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,
|
||||||
|
}
|
||||||
20
universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal
Normal file
20
universal7885-common/interfaces/hardware/gpu/1.0/IGpu.hal
Normal file
|
|
@ -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);
|
||||||
|
};
|
||||||
|
|
@ -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" ],
|
||||||
|
}
|
||||||
|
|
@ -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 <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
namespace vendor::eureka::hardware::gpu::V1_0 {
|
||||||
|
|
||||||
|
Return<int32_t> Gpu::setGpuWritable(gpu::V1_0::Enable enable) {
|
||||||
|
std::ofstream file;
|
||||||
|
std::string writevalue;
|
||||||
|
if (enable == Enable::ENABLE){
|
||||||
|
writevalue = "1";
|
||||||
|
}else{
|
||||||
|
writevalue = "0";
|
||||||
|
}
|
||||||
|
file.open("/sys/devices/platform/11500000.mali/tmu");
|
||||||
|
file << writevalue;
|
||||||
|
file.close();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<int32_t> Gpu::readGpustats(void) {
|
||||||
|
std::ifstream file;
|
||||||
|
std::string value;
|
||||||
|
int32_t intvalue;
|
||||||
|
file.open("/sys/devices/platform/11500000.mali/tmu");
|
||||||
|
if (file.is_open()) {
|
||||||
|
getline(file, value);
|
||||||
|
file.close();
|
||||||
|
std::stringstream val(value);
|
||||||
|
val >> intvalue;
|
||||||
|
return intvalue;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
IGpu *Gpu::getInstance(void){
|
||||||
|
return new Gpu();
|
||||||
|
}
|
||||||
|
} // namespace android::hardware::gpu::implementation
|
||||||
|
|
@ -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 <vendor/eureka/hardware/gpu/1.0/IGpu.h>
|
||||||
|
#include <hidl/MQDescriptor.h>
|
||||||
|
#include <hidl/Status.h>
|
||||||
|
|
||||||
|
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<int32_t> setGpuWritable(Enable enable);
|
||||||
|
Return<int32_t> readGpustats(void);
|
||||||
|
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||||
|
static IGpu* getInstance(void);
|
||||||
|
|
||||||
|
};
|
||||||
|
} // namespace android::hardware::gpu::implementation
|
||||||
|
|
@ -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 <vendor/eureka/hardware/gpu/1.0/IGpu.h>
|
||||||
|
|
||||||
|
#include <hidl/LegacySupport.h>
|
||||||
|
|
||||||
|
#include "Gpu.h"
|
||||||
|
|
||||||
|
using vendor::eureka::hardware::gpu::V1_0::IGpu;
|
||||||
|
using vendor::eureka::hardware::gpu::V1_0::Gpu;
|
||||||
|
using android::hardware::configureRpcThreadpool;
|
||||||
|
using android::hardware::joinRpcThreadpool;
|
||||||
|
using android::sp;
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<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>
|
||||||
20
universal7885-common/interfaces/hardware/gpu/1.0/types.hal
Normal file
20
universal7885-common/interfaces/hardware/gpu/1.0/types.hal
Normal file
|
|
@ -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,
|
||||||
|
};
|
||||||
|
|
@ -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,
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
};
|
||||||
|
|
@ -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" ],
|
||||||
|
}
|
||||||
|
|
@ -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 <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
namespace vendor::eureka::security::selinux::V1_0 {
|
||||||
|
|
||||||
|
Return<int32_t> SELinux::setSELinuxWritable(selinux::V1_0::Enable enable) {
|
||||||
|
std::ofstream file;
|
||||||
|
std::string writevalue;
|
||||||
|
if (enable == Enable::ENABLE){
|
||||||
|
writevalue = "1";
|
||||||
|
}else{
|
||||||
|
writevalue = "0";
|
||||||
|
}
|
||||||
|
file.open("/sys/fs/selinux/enforce");
|
||||||
|
file << writevalue;
|
||||||
|
file.close();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<int32_t> SELinux::readSELinuxstats(void) {
|
||||||
|
std::ifstream file;
|
||||||
|
std::string value;
|
||||||
|
int32_t intvalue;
|
||||||
|
file.open("/sys/fs/selinux/enforce");
|
||||||
|
if (file.is_open()) {
|
||||||
|
getline(file, value);
|
||||||
|
file.close();
|
||||||
|
std::stringstream val(value);
|
||||||
|
val >> intvalue;
|
||||||
|
return intvalue;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ISELinux *SELinux::getInstance(void){
|
||||||
|
return new SELinux();
|
||||||
|
}
|
||||||
|
} // namespace android::security::selinux::implementation
|
||||||
|
|
@ -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 <vendor/eureka/security/selinux/1.0/ISELinux.h>
|
||||||
|
#include <hidl/MQDescriptor.h>
|
||||||
|
#include <hidl/Status.h>
|
||||||
|
|
||||||
|
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<int32_t> setSELinuxWritable(Enable enable);
|
||||||
|
Return<int32_t> readSELinuxstats(void);
|
||||||
|
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||||
|
static ISELinux* getInstance(void);
|
||||||
|
|
||||||
|
};
|
||||||
|
} // namespace android::security::selinux::implementation
|
||||||
|
|
@ -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 <vendor/eureka/security/selinux/1.0/ISELinux.h>
|
||||||
|
|
||||||
|
#include <hidl/LegacySupport.h>
|
||||||
|
|
||||||
|
#include "SELinux.h"
|
||||||
|
|
||||||
|
using vendor::eureka::security::selinux::V1_0::ISELinux;
|
||||||
|
using vendor::eureka::security::selinux::V1_0::SELinux;
|
||||||
|
using android::hardware::configureRpcThreadpool;
|
||||||
|
using android::hardware::joinRpcThreadpool;
|
||||||
|
using android::sp;
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<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>
|
||||||
|
|
@ -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,
|
||||||
|
};
|
||||||
|
|
@ -172,15 +172,6 @@
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
|
||||||
<name>android.hardware.sensors</name>
|
|
||||||
<transport>hwbinder</transport>
|
|
||||||
<version>1.0</version>
|
|
||||||
<interface>
|
|
||||||
<name>ISensors</name>
|
|
||||||
<instance>default</instance>
|
|
||||||
</interface>
|
|
||||||
</hal>
|
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.thermal</name>
|
<name>android.hardware.thermal</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
|
|
@ -241,13 +232,4 @@
|
||||||
<instance>imsd2</instance>
|
<instance>imsd2</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<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>
|
</manifest>
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -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 };
|
|
||||||
|
|
@ -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/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)/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)/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
|
# 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\.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\.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
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,13 @@ type hal_battery_default, domain;
|
||||||
type hal_battery_default_exec, exec_type, file_type, vendor_file_type;
|
type hal_battery_default_exec, exec_type, file_type, vendor_file_type;
|
||||||
add_hwservice(hal_battery_default, hal_battery_hwservice);
|
add_hwservice(hal_battery_default, hal_battery_hwservice);
|
||||||
init_daemon_domain(hal_battery_default);
|
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 };
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,8 @@ type hal_flashlight_default, domain;
|
||||||
type hal_flashlight_default_exec, exec_type, file_type, vendor_file_type;
|
type hal_flashlight_default_exec, exec_type, file_type, vendor_file_type;
|
||||||
add_hwservice(hal_flashlight_default, hal_flashlight_hwservice);
|
add_hwservice(hal_flashlight_default, hal_flashlight_hwservice);
|
||||||
init_daemon_domain(hal_flashlight_default);
|
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;
|
||||||
|
|
|
||||||
9
universal7885-common/sepolicy/vendor/hal_gpu_default.te
vendored
Normal file
9
universal7885-common/sepolicy/vendor/hal_gpu_default.te
vendored
Normal file
|
|
@ -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;
|
||||||
9
universal7885-common/sepolicy/vendor/hal_selinux_default.te
vendored
Normal file
9
universal7885-common/sepolicy/vendor/hal_selinux_default.te
vendored
Normal file
|
|
@ -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;
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
type rild_hwservice, hwservice_manager_type;
|
type rild_hwservice, hwservice_manager_type;
|
||||||
type hal_battery_hwservice, hwservice_manager_type;
|
type hal_battery_hwservice, hwservice_manager_type;
|
||||||
type hal_flashlight_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;
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,5 @@ vendor.lineage.power::ILineagePower u:object_r:hal_power_hwservice:s0
|
||||||
# SamsungParts
|
# SamsungParts
|
||||||
vendor.eureka.hardware.battery::IBattery u:object_r:hal_battery_hwservice:s0
|
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.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
|
||||||
|
|
|
||||||
|
|
@ -226,9 +226,9 @@ PRODUCT_COPY_FILES += \
|
||||||
|
|
||||||
# Sensors
|
# Sensors
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.sensors@1.0-impl.samsung \
|
android.hardware.sensors@2.1-service.samsung-multihal \
|
||||||
android.hardware.sensors@1.0-service \
|
libsensorndkbridge \
|
||||||
libsensorndkbridge
|
$(LOCAL_PATH)/configs/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf
|
||||||
|
|
||||||
# Shims
|
# Shims
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
|
@ -281,7 +281,9 @@ PRODUCT_PACKAGES += \
|
||||||
SamsungParts \
|
SamsungParts \
|
||||||
init.samsungparts.rc \
|
init.samsungparts.rc \
|
||||||
vendor.eureka.hardware.battery@1.0-service \
|
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
|
# Debug
|
||||||
ifeq ($(TARGET_BUILD_VARIENT),eng)
|
ifeq ($(TARGET_BUILD_VARIENT),eng)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue