vibrator: Implement Effect::TICK

The AOSP TICK effect generated from the following test app:
- https://github.com/luk1337/VibeTest
was used as the starting point. It is more or less the same as oplus
CLICK, except waveform_index is set to 2.

The vibration effect from this TICK was stronger than oplus CLICK, which
is not really desirable, so adjustments were made to vmax in an
unscientific manner until it felt and sounded just right.

Change-Id: I472db022c2b0182e9a0d544c9d439bc3e47e4d82
This commit is contained in:
jabashque
2022-07-11 12:33:47 -07:00
committed by Łukasz Patron
parent 0962815d6f
commit cf2723baa3

View File

@@ -495,6 +495,13 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std
ledVib.write_value(LED_DEVICE "/activate", "1");
ledVib.write_value(LED_DEVICE "/activate", "0");
break;
case Effect::TICK:
ledVib.write_value(LED_DEVICE "/rtp", "0");
ledVib.write_value(LED_DEVICE "/vmax", "80");
ledVib.write_value(LED_DEVICE "/waveform_index", "2");
ledVib.write_value(LED_DEVICE "/brightness", "1");
ledVib.write_value(LED_DEVICE "/rtp", "0");
break;
case Effect::HEAVY_CLICK:
ledVib.write_value(LED_DEVICE "/duration", "1");
ledVib.write_value(LED_DEVICE "/state", "1");
@@ -542,7 +549,7 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std
ndk::ScopedAStatus Vibrator::getSupportedEffects(std::vector<Effect>* _aidl_return) {
if (ledVib.mDetected) {
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::HEAVY_CLICK};
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::HEAVY_CLICK};
} else {
#ifdef TARGET_SUPPORTS_OFFLOAD
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::THUD,