Files
lineage_patches/hardware/xiaomi/0015-vibrator-effect-Fallback-to-click-if-an-effect-is-mi.patch
2024-06-29 02:55:42 +08:00

32 lines
1.1 KiB
Diff

From 249bbdf1fc97b0a519a789828a2abc33518fad70 Mon Sep 17 00:00:00 2001
From: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date: Fri, 11 Aug 2023 19:33:04 +0530
Subject: [PATCH 15/15] vibrator: effect: Fallback to click if an effect is
missing
On some device certain effects can be garbage to the point
where its just better to use the default click effect.
Change-Id: I047f72aaba2a1d56138a6431b5b96f0f626e2e83
---
vibrator/effect/effect.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/vibrator/effect/effect.cpp b/vibrator/effect/effect.cpp
index 5655922..f09d09a 100644
--- a/vibrator/effect/effect.cpp
+++ b/vibrator/effect/effect.cpp
@@ -117,6 +117,9 @@ const struct effect_stream* get_effect_stream(uint32_t effectId) {
auto result = sEffectStreams.emplace(effectId, *newEffectStream);
return &result.first->second;
}
+ } else if (effectId != (uint32_t)Effect::CLICK) {
+ LOG(VERBOSE) << "Could not get effect " << effectId << ", falling back to click effect";
+ return get_effect_stream((uint32_t)Effect::CLICK);
}
} else {
return &it->second;
--
2.25.1