From 968c3d1a000153d2d6a84f0f29e43a387edb7a30 Mon Sep 17 00:00:00 2001 From: Chase Wu Date: Thu, 9 Feb 2023 22:57:44 +0800 Subject: [PATCH] cs40l26: Fix the composed effect delay problem When user typed the gboard back-to-back, HAL will send a STOP call right after it sends a START call. At this moment, driver is under an activating process and the vibe_state is not 1, so the erasing process will be forced to wait for the FW's completed signal. This makes STOP call consumes lots of waiting time and user would still feels a delay gap under back-to-back typing behavior. This patch removes the erased process from the STOP call and let it be done in the completed process. Bug: 263476381 Test: atest PtsVibratorHalTestSuite \ PtsHapticsTestCases \ PtsHapticsFeatureTestCases \ VibratorHalCs40l26TestSuite \ VtsHalVibratorManagerTargetTest \ VtsHalVibratorTargetTest \ android.os.cts.VibratorTest \ android.os.cts.VibratorManagerTest \ android.os.cts.VibrationEffectTest \ android.os.cts.VibrationAttributesTest \ android.os.cts.CombinedVibrationTest Test: Type Gboard with five fingers Change-Id: I02dfdae4e9e9334a253106f631c933228398b077 --- vibrator/cs40l26/Vibrator.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 131a376..dd84100 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -576,18 +576,7 @@ ndk::ScopedAStatus Vibrator::off() { strerror(errno)); ret = false; } - /* Do erase process */ - if ((mActiveId >= WAVEFORM_MAX_PHYSICAL_INDEX) && - (!mHwApiDef->eraseOwtEffect(mInputFd, mActiveId, &mFfEffects))) { - ALOGE("Off: Failed to clean up the composed effect %d", mActiveId); - ret = false; - } - if (mIsDual && (mActiveId >= WAVEFORM_MAX_PHYSICAL_INDEX) && - (!mHwApiDual->eraseOwtEffect(mInputFdDual, mActiveId, &mFfEffectsDual))) { - ALOGE("Off: Failed to clean up flip's the composed effect %d", mActiveId); - ret = false; - } if (!mHwGPIO->setGPIOOutput(false)) { ALOGE("Off: Failed to reset GPIO(%d): %s", errno, strerror(errno)); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);