Support AIDL Vibrator
co-authored by: SebaUbuntu <barezzisebastiano@gmail.com> Change-Id: Ifaa0af4cb0fe0dee7d2a9ad4c58a5ede5ce46d59
This commit is contained in:
@@ -53,7 +53,8 @@ cc_library_shared {
|
||||
"libcutils",
|
||||
"liblog",
|
||||
"libbase",
|
||||
"libsync"
|
||||
"libsync",
|
||||
"libbinder_ndk"
|
||||
],
|
||||
static_libs: ["libpixelflinger_twrp"]
|
||||
}
|
||||
|
||||
@@ -32,6 +32,13 @@
|
||||
#include <android/hardware/vibrator/1.2/IVibrator.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_QTI_AIDL_HAPTICS
|
||||
#include <aidl/android/hardware/vibrator/IVibrator.h>
|
||||
#include <android/binder_manager.h>
|
||||
using ::aidl::android::hardware::vibrator::IVibrator;
|
||||
static const std::string kVibratorInstance = std::string(IVibrator::descriptor) + "/default";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "minuitwrp/minui.h"
|
||||
@@ -140,6 +147,11 @@ int vibrate(int timeout_ms)
|
||||
if (vib != nullptr) {
|
||||
vib->on((uint32_t)timeout_ms);
|
||||
}
|
||||
#elif defined(USE_QTI_AIDL_HAPTICS)
|
||||
std::shared_ptr<IVibrator> vib = IVibrator::fromBinder(ndk::SpAIBinder(AServiceManager_getService(kVibratorInstance.c_str())));
|
||||
if (vib != nullptr) {
|
||||
vib->on((uint32_t)timeout_ms, nullptr);
|
||||
}
|
||||
#else
|
||||
if (std::ifstream(LEDS_HAPTICS_ACTIVATE_FILE).good()) {
|
||||
write_to_file(LEDS_HAPTICS_DURATION_FILE, tout);
|
||||
|
||||
@@ -15,6 +15,10 @@ func globalFlags(ctx android.BaseContext) []string {
|
||||
cflags = append(cflags, "-DUSE_QTI_HAPTICS")
|
||||
}
|
||||
|
||||
if getMakeVars(ctx, "TW_SUPPORT_INPUT_AIDL_HAPTICS") == "true" {
|
||||
cflags = append(cflags, "-DUSE_QTI_AIDL_HAPTICS")
|
||||
}
|
||||
|
||||
if getMakeVars(ctx, "TW_TARGET_USES_QCOM_BSP") == "true" {
|
||||
cflags = append(cflags, "-DMSM_BSP")
|
||||
}
|
||||
@@ -245,6 +249,11 @@ func globalSharedLibs(ctx android.BaseContext) []string {
|
||||
sharedLibs = append(sharedLibs, "libhidlbase")
|
||||
}
|
||||
|
||||
if getMakeVars(ctx, "TW_SUPPORT_INPUT_AIDL_HAPTICS") == "true" {
|
||||
sharedLibs = append(sharedLibs, "android.hardware.vibrator-ndk_platform")
|
||||
sharedLibs = append(sharedLibs, "android.hardware.vibrator-cpp")
|
||||
}
|
||||
|
||||
if getMakeVars(ctx, "TW_INCLUDE_JPEG") != "" {
|
||||
sharedLibs = append(sharedLibs, "libjpeg")
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/resize2fs
|
||||
#RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/twrpmtp
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/android.hardware.fastboot@1.0.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/ld-android.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libandroid_runtime_lazy.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libc.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libdl.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libm.so
|
||||
@@ -70,6 +71,7 @@ RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libinit.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/bootstrap/libdl_android.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-lite.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbinder.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbinder_ndk.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libchrome.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libevent.so
|
||||
RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/keystore
|
||||
@@ -191,6 +193,8 @@ ifeq ($(TW_INCLUDE_CRYPTO), true)
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.vibrator@1.0.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.vibrator@1.1.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.vibrator@1.2.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.vibrator-V1-ndk_platform.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.vibrator-V1-cpp.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstatslog.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsoft_attestation_cert.so
|
||||
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libxml2.so
|
||||
|
||||
Reference in New Issue
Block a user