vibrator: Ensure waveform_index and vmax is set for other effects

It seems that the DOUBLE_CLICK and HEAVY_CLICK effects assume that
`waveform_index` is always set to 1 and `vmax` is set to 1600, because
if the last played effect is TICK, then all the other effects (aside
from CLICK) end up feeling different, presumably because
`waveform_index` is left as set to 2 and `vmax` is left as set to 1600.

Fix this by having DOUBLE_CLICK and HEAVY_CLICK set `waveform_index`
back to 1 and `vmax` back to 1600.

Change-Id: Ic116f45894cf4af25bcd25b66764eeb472631af5
This commit is contained in:
jabashque
2022-08-03 18:14:04 -07:00
committed by Łukasz Patron
parent 559c9f3640
commit 83cfc07394

View File

@@ -485,6 +485,8 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std
ledVib.write_value(LED_DEVICE "/rtp", "0");
break;
case Effect::DOUBLE_CLICK:
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
ledVib.write_value(LED_DEVICE "/vmax", "1600");
ledVib.write_value(LED_DEVICE "/duration", "30");
ledVib.write_value(LED_DEVICE "/state", "1");
ledVib.write_value(LED_DEVICE "/activate", "1");
@@ -503,6 +505,8 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std
ledVib.write_value(LED_DEVICE "/rtp", "0");
break;
case Effect::HEAVY_CLICK:
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
ledVib.write_value(LED_DEVICE "/vmax", "1600");
ledVib.write_value(LED_DEVICE "/duration", "1");
ledVib.write_value(LED_DEVICE "/state", "1");
ledVib.write_value(LED_DEVICE "/activate", "1");