universal7885: parts: implement display controls

Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2022-04-12 16:45:48 +09:00
commit 15f84d5a7b
No known key found for this signature in database
GPG key ID: 50ABF73F0D19445D
17 changed files with 79 additions and 310 deletions

View file

@ -2,19 +2,19 @@
#include <hidl/HidlSupport.h>
#include <hidl/LegacySupport.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/parts/1.0/IBattery.h>
#include <vendor/eureka/hardware/parts/1.0/IBatteryStats.h>
#include "jni.h"
using android::sp;
using vendor::eureka::hardware::parts::V1_0::IBattery;
using vendor::eureka::hardware::parts::V1_0::IBatteryStats;
using vendor::eureka::hardware::parts::V1_0::Number;
using vendor::eureka::hardware::parts::V1_0::SysfsType;
static android::sp<IBatteryStats> service = IBatteryStats::getService();
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 {
@ -25,7 +25,6 @@ Java_com_eurekateam_samsungextras_interfaces_Battery_setChargeSysfs(JNIEnv* env,
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;
}
@ -34,7 +33,6 @@ extern "C" JNIEXPORT void JNICALL
Java_com_eurekateam_samsungextras_interfaces_Battery_setFastCharge(JNIEnv* env,
__unused jobject obj,
jint enable) {
android::sp<IBattery> service = IBattery::getService();
if (enable == 1) {
service->setBatteryWritable(SysfsType::FASTCHARGE, Number::ENABLE);
} else {
@ -44,7 +42,6 @@ Java_com_eurekateam_samsungextras_interfaces_Battery_setFastCharge(JNIEnv* env,
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;
}
@ -61,7 +58,7 @@ Java_com_eurekateam_samsungextras_interfaces_Battery_getGeneralBatteryStats(JNIE
* 5 = BATTERY_TEMP
* 6 = BATTERY_CURRENT
*/
android::sp<IBattery> service = IBattery::getService();
int ret;
switch (id) {
case 1:

View file

@ -0,0 +1,33 @@
#include <hardware/hardware.h>
#include <hidl/HidlSupport.h>
#include <hidl/LegacySupport.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/parts/1.0/IDisplayConfigs.h>
#include "jni.h"
using android::sp;
using vendor::eureka::hardware::parts::V1_0::Number;
using vendor::eureka::hardware::parts::V1_0::Display;
using vendor::eureka::hardware::parts::V1_0::IDisplayConfigs;
static android::sp<IDisplayConfigs> service = IDisplayConfigs::getService();
extern "C" JNIEXPORT void JNICALL
Java_com_eurekateam_samsungextras_interfaces_Display_setDT2W(JNIEnv* env, jclass clazz, jboolean enable) {
if (enable) {
service->writeDisplay(Number::ENABLE,
Display::DOUBLE_TAP);
} else {
service->writeDisplay(Number::DISABLE,
Display::DOUBLE_TAP);
}
}
extern "C" JNIEXPORT void JNICALL
Java_com_eurekateam_samsungextras_interfaces_Display_setGloveMode(JNIEnv* env, jclass clazz, jboolean enable) {
if (enable) {
service->writeDisplay(Number::ENABLE, Display::GLOVE_MODE);
} else {
service->writeDisplay(Number::DISABLE, Display::GLOVE_MODE);
}
}

View file

@ -2,18 +2,19 @@
#include <hidl/HidlSupport.h>
#include <hidl/LegacySupport.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/parts/1.0/IFlashLight.h>
#include <vendor/eureka/hardware/parts/1.0/IFlashBrightness.h>
#include "jni.h"
using android::sp;
using vendor::eureka::hardware::parts::V1_0::Device;
using vendor::eureka::hardware::parts::V1_0::Value;
using vendor::eureka::hardware::parts::V1_0::IFlashLight;
using vendor::eureka::hardware::parts::V1_0::IFlashBrightness;
using vendor::eureka::hardware::parts::V1_0::Number;
static android::sp<IFlashBrightness> service = IFlashBrightness::getService();
extern "C" JNIEXPORT void JNICALL Java_com_eurekateam_samsungextras_interfaces_Flashlight_setFlash(
JNIEnv* env, __unused jobject obj, jint value) {
android::sp<IFlashLight> service = IFlashLight::getService();
service->setFlashlightEnable(Number::ENABLE);
switch (value) {
case 1:
@ -52,7 +53,6 @@ extern "C" JNIEXPORT void JNICALL Java_com_eurekateam_samsungextras_interfaces_F
}
extern "C" JNIEXPORT jint JNICALL Java_com_eurekateam_samsungextras_interfaces_Flashlight_getFlash(
JNIEnv* env, jobject clazz, jint isA10) {
android::sp<IFlashLight> service = IFlashLight::getService();
int ret;
if (isA10 == 1) {
ret = service->readFlashlightstats(Device::A10);

View file

@ -1,26 +0,0 @@
#include <hardware/hardware.h>
#include <hidl/HidlSupport.h>
#include <hidl/LegacySupport.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/parts/1.0/IGpu.h>
#include "jni.h"
using android::sp;
using vendor::eureka::hardware::parts::V1_0::Number;
using vendor::eureka::hardware::parts::V1_0::IGpu;
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(Number::ENABLE);
} else {
service->setGpuWritable(Number::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;
}

View file

@ -1,17 +0,0 @@
#include <hardware/hardware.h>
#include <hidl/HidlSupport.h>
#include <hidl/LegacySupport.h>
#include <hidl/Status.h>
#include <vendor/eureka/hardware/parts/1.0/ISELinux.h>
#include "jni.h"
using android::sp;
using vendor::eureka::hardware::parts::V1_0::Number;
using vendor::eureka::hardware::parts::V1_0::ISELinux;
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;
}