Fixed input device vibrator manager with single vibrator in

CombinedEffects.

Fixed the input device vibrator manager to handle the combined vibration effect contains only one vibrator ID.

Bug: 184584308
Test: atest InputDeviceVibratorManagerTest
Change-Id: Id19af5e0094a7ec2fff057e93ab51ae975633163
This commit is contained in:
Chris Ye
2021-04-05 17:31:11 -07:00
parent 1eff81e13e
commit 7d78fea1f5

View File

@@ -1920,7 +1920,7 @@ static void nativeVibrateCombined(JNIEnv* env, jclass /* clazz */, jlong ptr, ji
// VibrationEffect.validate guarantees duration > 0.
std::chrono::milliseconds duration(patternMillis[i]);
element.duration = std::min(duration, MAX_VIBRATE_PATTERN_DELAY_MILLIS);
for (int32_t channel = 0; channel < CHANNEL_SIZE; channel++) {
for (int32_t channel = 0; channel < amplSize; channel++) {
element.addChannel(vibratorIdArray[channel],
static_cast<uint8_t>(amplitudesArray[channel][i]));
}