diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 3a674c4d7ee56..3ee2b8dd57d29 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -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(amplitudesArray[channel][i])); }