summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiran Gunda <kgunda@codeaurora.org>2021-09-15 18:36:27 +0530
committerKiran Gunda <kgunda@codeaurora.org>2021-09-16 10:07:32 +0530
commit5fba81168e8446448da68a5e546c2aa77b8dd148 (patch)
treea56aee82171ee28b0ee936306f0b581a08d8ef25
parent2feeb5e8573bf1b7fc6f682ccc91bd5444ee2a1b (diff)
Vibrator: Update the perform operation to allow ringtone IDs
Currently the "perform" operation is only allowing the effects up to HEAVY_CLICK. Update it to allow the ringtone IDs when the offload functionality is enabled. While at it update the below as well. 1. update the play_rate of fifo effect 17 to S_PERIOD_T_LRA_X_8 2. Include the "slatecom_interface.h" header and add "qti_kernel_header" lib in Android.bp file for compilation fix. Change-Id: I305288894da40837c54743012c1bfe25900efc51
-rw-r--r--aidl/Android.bp3
-rw-r--r--aidl/Vibrator.cpp7
-rw-r--r--aidl/VibratorOffload.cpp7
-rw-r--r--effect/VibratorPatterns.cpp2
4 files changed, 9 insertions, 10 deletions
diff --git a/aidl/Android.bp b/aidl/Android.bp
index 32a9f59..42b271f 100644
--- a/aidl/Android.bp
+++ b/aidl/Android.bp
@@ -60,7 +60,8 @@ cc_library_shared {
"libbinder_ndk",
"android.hardware.vibrator-ndk_platform",
],
- export_include_dirs: ["include"]
+ export_include_dirs: ["include"],
+ header_libs: ["qti_kernel_headers"],
}
cc_binary {
diff --git a/aidl/Vibrator.cpp b/aidl/Vibrator.cpp
index d844e74..fab0415 100644
--- a/aidl/Vibrator.cpp
+++ b/aidl/Vibrator.cpp
@@ -467,8 +467,11 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std
ALOGD("Vibrator perform effect %d", effect);
- if (effect < Effect::CLICK ||
- effect > Effect::HEAVY_CLICK)
+#ifdef TARGET_SUPPORTS_OFFLOAD
+ if (effect < Effect::CLICK || effect > Effect::RINGTONE_15)
+#else
+ if (effect < Effect::CLICK || effect > Effect::HEAVY_CLICK)
+#endif
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
if (es != EffectStrength::LIGHT && es != EffectStrength::MEDIUM && es != EffectStrength::STRONG)
diff --git a/aidl/VibratorOffload.cpp b/aidl/VibratorOffload.cpp
index e9a4616..8c4e877 100644
--- a/aidl/VibratorOffload.cpp
+++ b/aidl/VibratorOffload.cpp
@@ -34,6 +34,7 @@
#include <string.h>
#include <thread>
#include <linux/input.h>
+#include <linux/slatecom_interface.h>
#include <log/log.h>
#include <fcntl.h>
#include <cutils/log.h>
@@ -56,12 +57,6 @@ namespace vibrator {
#define UEVENT_MSG_LEN 1024
#define SLATE_EVENT "SLATE_EVENT="
#define SLATE_EVENT_STRING_LEN 12 //length of SLATE_EVENT
-/*
- * TODO Need to work on solution to get this from kernel header
- * without effecting other kernel versions where this change
- * goes in.
- */
-#define SLATE_AFTER_POWER_UP 4
PatternOffload::PatternOffload()
{
diff --git a/effect/VibratorPatterns.cpp b/effect/VibratorPatterns.cpp
index 18a3857..9daa573 100644
--- a/effect/VibratorPatterns.cpp
+++ b/effect/VibratorPatterns.cpp
@@ -447,7 +447,7 @@ const static struct effect config_data[] = {
.effect_type = EFFECT_TYPE_FIFO_ENVELOPE,
.effect_len = ARRAY_SIZE(effect_6),
.offset = OFFSET_EFFECT_6,
- .play_rate = S_PERIOD_T_LRA,
+ .play_rate = S_PERIOD_T_LRA_X_8,
},
{