mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-01-28 13:18:23 +00:00
haptics: Implement constant effect for heavy click
This patch implements support for heavy click effect which has the following UX requirements: - 8 ms in square wave and full amplitude for Walleye - 12 ms in square wave and full amplitude for Taimen Bug: 77863933 Test: manual long press test Change-Id: Ibc30117fecb234a6b400123e5f18a7c100ae36cb Signed-off-by: David Lin <dtwlin@google.com>
This commit is contained in:
1
sepolicy/vendor/property_contexts
vendored
1
sepolicy/vendor/property_contexts
vendored
@@ -164,6 +164,7 @@ ro.vendor.build.svn u:object_r:vendor_default_prop:s0
|
||||
ro.vendor.extension_library u:object_r:vendor_default_prop:s0
|
||||
ro.vibrator.hal.click.duration u:object_r:vendor_default_prop:s0
|
||||
ro.vibrator.hal.tick.duration u:object_r:vendor_default_prop:s0
|
||||
ro.vibrator.hal.heavyclick.duration u:object_r:vendor_default_prop:s0
|
||||
sdm. u:object_r:vendor_default_prop:s0
|
||||
sys.disable_ext_animation u:object_r:vendor_default_prop:s0
|
||||
sys.display.low_persistence_mode_brightness u:object_r:vendor_default_prop:s0
|
||||
|
||||
@@ -42,18 +42,22 @@ static constexpr int8_t MIN_RTP_INPUT = 0;
|
||||
static constexpr char RTP_MODE[] = "rtp";
|
||||
static constexpr char WAVEFORM_MODE[] = "waveform";
|
||||
|
||||
// Use effect #1 in the waveform library
|
||||
// Use effect #1 in the waveform library for CLICK effect
|
||||
static constexpr char WAVEFORM_CLICK_EFFECT_SEQ[] = "1 0";
|
||||
static constexpr int32_t WAVEFORM_CLICK_EFFECT_MS = 6;
|
||||
|
||||
// Use effect #2 in the waveform library
|
||||
// Use effect #2 in the waveform library for TICK effect
|
||||
static constexpr char WAVEFORM_TICK_EFFECT_SEQ[] = "2 0";
|
||||
static constexpr int32_t WAVEFORM_TICK_EFFECT_MS = 2;
|
||||
|
||||
// Use effect #3 in the waveform library
|
||||
// Use effect #3 in the waveform library for DOUBLE_CLICK effect
|
||||
static constexpr char WAVEFORM_DOUBLE_CLICK_EFFECT_SEQ[] = "3 0";
|
||||
static constexpr uint32_t WAVEFORM_DOUBLE_CLICK_EFFECT_MS = 135;
|
||||
|
||||
// Use effect #4 in the waveform library for HEAVY_CLICK effect
|
||||
static constexpr char WAVEFORM_HEAVY_CLICK_EFFECT_SEQ[] = "4 0";
|
||||
static constexpr uint32_t WAVEFORM_HEAVY_CLICK_EFFECT_MS = 8;
|
||||
|
||||
// Timeout threshold for selecting open or closed loop mode
|
||||
static constexpr int8_t LOOP_MODE_THRESHOLD_MS = 20;
|
||||
|
||||
@@ -76,6 +80,8 @@ Vibrator::Vibrator(std::ofstream&& activate, std::ofstream&& duration,
|
||||
|
||||
mClickDuration = property_get_int32("ro.vibrator.hal.click.duration", WAVEFORM_CLICK_EFFECT_MS);
|
||||
mTickDuration = property_get_int32("ro.vibrator.hal.tick.duration", WAVEFORM_TICK_EFFECT_MS);
|
||||
mHeavyClickDuration = property_get_int32(
|
||||
"ro.vibrator.hal.heavyclick.duration", WAVEFORM_HEAVY_CLICK_EFFECT_MS);
|
||||
|
||||
// This enables effect #1 from the waveform library to be triggered by SLPI
|
||||
// while the AP is in suspend mode
|
||||
@@ -199,6 +205,10 @@ Return<void> Vibrator::performEffect(Effect effect, EffectStrength strength, per
|
||||
mSequencer << WAVEFORM_TICK_EFFECT_SEQ << std::endl;
|
||||
timeMS = mTickDuration;
|
||||
break;
|
||||
case Effect::HEAVY_CLICK:
|
||||
mSequencer << WAVEFORM_HEAVY_CLICK_EFFECT_SEQ << std::endl;
|
||||
timeMS = mHeavyClickDuration;
|
||||
break;
|
||||
default:
|
||||
_hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
|
||||
return Void();
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
std::ofstream mLpTriggerEffect;
|
||||
int32_t mClickDuration;
|
||||
int32_t mTickDuration;
|
||||
int32_t mHeavyClickDuration;
|
||||
};
|
||||
} // namespace implementation
|
||||
} // namespace V1_2
|
||||
|
||||
Reference in New Issue
Block a user