Skip to content

Commit f07f260

Browse files
hellobbnlog1cs
authored andcommitted
vibrator: Align waveform index with Sony
Change-Id: I52360330bdb23bbfb4e1c5dda4593980f1f52655
1 parent 3e7573e commit f07f260

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

aidl/vibrator/cs40l25/Vibrator.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ static constexpr uint32_t WAVEFORM_SLOW_RISE_INDEX = 7;
6262
static constexpr uint32_t WAVEFORM_QUICK_FALL_INDEX = 8;
6363
static constexpr uint32_t WAVEFORM_LIGHT_TICK_INDEX = 9;
6464
static constexpr uint32_t WAVEFORM_LOW_TICK_INDEX = 10;
65+
static constexpr uint32_t WAVEFORM_SONY_THUD_INDEX = 11;
66+
static constexpr uint32_t WAVEFORM_SONY_POP_INDEX = 12;
67+
static constexpr uint32_t WAVEFORM_SONY_HEAVY_CLICK_INDEX = 13;
68+
static constexpr uint32_t WAVEFORM_SONY_DOUBLE_CLICK_INDEX = 19;
6569

6670
static constexpr uint32_t WAVEFORM_UNSAVED_TRIGGER_QUEUE_INDEX = 65529;
6771
static constexpr uint32_t WAVEFORM_TRIGGER_QUEUE_INDEX = 65534;
@@ -1000,19 +1004,24 @@ ndk::ScopedAStatus Vibrator::getSimpleDetails(Effect effect, EffectStrength stre
10001004
switch (effect) {
10011005
case Effect::TEXTURE_TICK:
10021006
effectIndex = WAVEFORM_LIGHT_TICK_INDEX;
1003-
intensity *= 0.5f;
10041007
break;
10051008
case Effect::TICK:
1006-
effectIndex = WAVEFORM_CLICK_INDEX;
1007-
intensity *= 0.5f;
1009+
effectIndex = WAVEFORM_LOW_TICK_INDEX;
10081010
break;
10091011
case Effect::CLICK:
10101012
effectIndex = WAVEFORM_CLICK_INDEX;
1011-
intensity *= 0.7f;
10121013
break;
10131014
case Effect::HEAVY_CLICK:
1014-
effectIndex = WAVEFORM_CLICK_INDEX;
1015-
intensity *= 1.0f;
1015+
effectIndex = WAVEFORM_SONY_HEAVY_CLICK_INDEX;
1016+
break;
1017+
case Effect::DOUBLE_CLICK:
1018+
effectIndex = WAVEFORM_SONY_DOUBLE_CLICK_INDEX;
1019+
break;
1020+
case Effect::THUD:
1021+
effectIndex = WAVEFORM_SONY_THUD_INDEX;
1022+
break;
1023+
case Effect::POP:
1024+
effectIndex = WAVEFORM_SONY_POP_INDEX;
10161025
break;
10171026
default:
10181027
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
@@ -1151,10 +1160,14 @@ ndk::ScopedAStatus Vibrator::performEffect(Effect effect, EffectStrength strengt
11511160
case Effect::CLICK:
11521161
// fall-through
11531162
case Effect::HEAVY_CLICK:
1154-
status = getSimpleDetails(effect, strength, &effectIndex, &timeMs, &volLevel);
1155-
break;
1163+
// fall-through
1164+
case Effect::THUD:
1165+
// fall-through
1166+
case Effect::POP:
1167+
// fall-through
11561168
case Effect::DOUBLE_CLICK:
1157-
status = getCompoundDetails(effect, strength, &timeMs, &volLevel, &effectQueue);
1169+
// fall-through
1170+
status = getSimpleDetails(effect, strength, &effectIndex, &timeMs, &volLevel);
11581171
break;
11591172
default:
11601173
status = ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);

0 commit comments

Comments
 (0)