mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 20:45:31 -04:00
universal7885: Add prebuilt GCam
This commit is contained in:
parent
7329c87196
commit
d195a1d848
73 changed files with 20 additions and 39 deletions
21
universal7885-common/apps/SamsungParts/jni/Android.bp
Normal file
21
universal7885-common/apps/SamsungParts/jni/Android.bp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
cc_library_shared {
|
||||
name: "libsamsungparts_jni",
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wno-unused-parameter",
|
||||
"-Werror",
|
||||
],
|
||||
srcs: ["*.cpp"],
|
||||
header_libs: ["jni_headers"],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"vendor.eureka.hardware.battery@1.0",
|
||||
"vendor.eureka.hardware.flashlight@1.0",
|
||||
"vendor.eureka.hardware.gpu@1.0",
|
||||
"vendor.eureka.security.selinux@1.0",
|
||||
]
|
||||
}
|
||||
|
||||
100
universal7885-common/apps/SamsungParts/jni/BatteryBridge.cpp
Normal file
100
universal7885-common/apps/SamsungParts/jni/BatteryBridge.cpp
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#include <vendor/eureka/hardware/battery/1.0/IBattery.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <hidl/LegacySupport.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include "jni.h"
|
||||
|
||||
using vendor::eureka::hardware::battery::V1_0::IBattery;
|
||||
using vendor::eureka::hardware::battery::V1_0::SysfsType;
|
||||
using vendor::eureka::hardware::battery::V1_0::Number;
|
||||
using android::sp;
|
||||
|
||||
extern "C" JNIEXPORT void
|
||||
JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_Battery_setChargeSysfs
|
||||
(JNIEnv *env , __unused jclass obj, jint enable) {
|
||||
android::sp<IBattery> service = IBattery::getService();
|
||||
if (enable == 1){
|
||||
service->setBatteryWritable(SysfsType::CHARGE, Number::ENABLE);
|
||||
}else{
|
||||
service->setBatteryWritable(SysfsType::CHARGE, Number::DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jint
|
||||
JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_Battery_getChargeSysfs
|
||||
(JNIEnv *env , __unused jclass obj) {
|
||||
android::sp<IBattery> service = IBattery::getService();
|
||||
int ret = service->getBatteryStats(SysfsType::CHARGE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_Battery_setFastCharge(JNIEnv *env, __unused jclass obj,
|
||||
jint enable) {
|
||||
android::sp<IBattery> service = IBattery::getService();
|
||||
if (enable == 1){
|
||||
service->setBatteryWritable(SysfsType::FASTCHARGE, Number::ENABLE);
|
||||
}else{
|
||||
service->setBatteryWritable(SysfsType::FASTCHARGE, Number::DISABLE);
|
||||
}
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_Battery_getFastChargeSysfs(JNIEnv *env, __unused
|
||||
jclass obj) {
|
||||
android::sp<IBattery> service = IBattery::getService();
|
||||
int ret = service->getBatteryStats(SysfsType::FASTCHARGE);
|
||||
return ret;
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_Battery_getGeneralBatteryStats(JNIEnv *env,
|
||||
__unused
|
||||
jclass obj, jint id) {
|
||||
/**
|
||||
* id:
|
||||
* 1 = BATTERY_CAPACITY_MAX
|
||||
* 2 = BATTERY_CAPACITY_CURRENT (%)
|
||||
* 3 = BATTERY_CAPACITY_CURRENT (mAh)
|
||||
* 4 = CHARGING_STATE
|
||||
* 5 = BATTERY_TEMP
|
||||
* 6 = BATTERY_CURRENT
|
||||
*/
|
||||
android::sp<IBattery> service = IBattery::getService();
|
||||
int ret;
|
||||
switch (id) {
|
||||
case 1:
|
||||
ret = service->getBatteryStats(SysfsType::CAPACITY_MAX) / 1000;
|
||||
break;
|
||||
case 2:
|
||||
ret = service->getBatteryStats(SysfsType::CAPACITY_CURRENT);
|
||||
break;
|
||||
case 3:
|
||||
ret = (float) service->getBatteryStats(SysfsType::CAPACITY_CURRENT) *
|
||||
(float) service->getBatteryStats(SysfsType::CAPACITY_MAX) / 100000;
|
||||
break;
|
||||
case 4:
|
||||
if (service->getBatteryStats(SysfsType::CURRENT) > 0){
|
||||
ret = 1;
|
||||
}else{
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
ret = service->getBatteryStats(SysfsType::TEMP) / 10;
|
||||
break;
|
||||
case 6:
|
||||
ret = service->getBatteryStats(SysfsType::CURRENT);
|
||||
break;
|
||||
default:
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
#include <vendor/eureka/hardware/flashlight/1.0/IFlashlight.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <hidl/LegacySupport.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include "jni.h"
|
||||
|
||||
using vendor::eureka::hardware::flashlight::V1_0::IFlashlight;
|
||||
using vendor::eureka::hardware::flashlight::V1_0::Device;
|
||||
using vendor::eureka::hardware::flashlight::V1_0::Enable;
|
||||
using vendor::eureka::hardware::flashlight::V1_0::Number;
|
||||
using android::sp;
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_Flashlight_setFlash(JNIEnv *env, __unused jclass obj,
|
||||
jint value) {
|
||||
android::sp<IFlashlight> service = IFlashlight::getService();
|
||||
service->setFlashlightEnable(Enable::ENABLE);
|
||||
switch (value) {
|
||||
case 1:
|
||||
service->setFlashlightWritable(Number::ONEUI);
|
||||
break;
|
||||
case 2:
|
||||
service->setFlashlightWritable(Number::TWOUI);
|
||||
break;
|
||||
case 3:
|
||||
service->setFlashlightWritable(Number::THREEUI);
|
||||
break;
|
||||
case 4:
|
||||
service->setFlashlightWritable(Number::FOURUI);
|
||||
break;
|
||||
case 5:
|
||||
service->setFlashlightWritable(Number::FIVEUI);
|
||||
break;
|
||||
case 6:
|
||||
service->setFlashlightWritable(Number::SIXUI);
|
||||
break;
|
||||
case 7:
|
||||
service->setFlashlightWritable(Number::SEVENUI);
|
||||
break;
|
||||
case 8:
|
||||
service->setFlashlightWritable(Number::EIGHTUI);
|
||||
break;
|
||||
case 9:
|
||||
service->setFlashlightWritable(Number::NINEUI);
|
||||
break;
|
||||
case 10:
|
||||
service->setFlashlightWritable(Number::TENUI);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_Flashlight_getFlash(JNIEnv *env, jclass clazz,
|
||||
jint isA10) {
|
||||
android::sp<IFlashlight> service = IFlashlight::getService();
|
||||
int ret;
|
||||
if(isA10 == 1) {
|
||||
ret = service->readFlashlightstats(Device::A10);
|
||||
}else{
|
||||
ret = service->readFlashlightstats(Device::NOTA10);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
28
universal7885-common/apps/SamsungParts/jni/GPUBridge.cpp
Normal file
28
universal7885-common/apps/SamsungParts/jni/GPUBridge.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <vendor/eureka/hardware/gpu/1.0/IGpu.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <hidl/LegacySupport.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include "jni.h"
|
||||
|
||||
using vendor::eureka::hardware::gpu::V1_0::IGpu;
|
||||
using vendor::eureka::hardware::gpu::V1_0::Enable;
|
||||
using android::sp;
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_GPU_setGPU(JNIEnv *env, jclass clazz, jint enable) {
|
||||
android::sp<IGpu> service = IGpu::getService();
|
||||
if (enable == 1){
|
||||
service->setGpuWritable(Enable::ENABLE);
|
||||
}else{
|
||||
service->setGpuWritable(Enable::DISABLE);
|
||||
}
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_GPU_getGPU(JNIEnv *env, jclass clazz) {
|
||||
android::sp<IGpu> service = IGpu::getService();
|
||||
int ret = service->readGpustats();
|
||||
return ret;
|
||||
}
|
||||
18
universal7885-common/apps/SamsungParts/jni/SELinuxBridge.cpp
Normal file
18
universal7885-common/apps/SamsungParts/jni/SELinuxBridge.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include <vendor/eureka/security/selinux/1.0/ISELinux.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <hidl/LegacySupport.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include "jni.h"
|
||||
|
||||
using vendor::eureka::security::selinux::V1_0::ISELinux;
|
||||
using vendor::eureka::security::selinux::V1_0::Enable;
|
||||
using android::sp;
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_SELinux_getSELinux(JNIEnv *env, jclass clazz) {
|
||||
android::sp<ISELinux> service = ISELinux::getService();
|
||||
int ret = service->readSELinuxstats();
|
||||
return ret;
|
||||
}
|
||||
Loading…
Reference in a new issue