Skip to content

Commit eae6a93

Browse files
hellobbnlog1cs
authored andcommitted
vibrator: Add a usleep before wait for completion
Seems there will be a race condition if we wait for completion too early, so add a usleep(10000) before we wait for completion. Note that this also aligns the implementation with stock. Change-Id: I4c74928aa3d438f07a860e0b4f28a35ab654a6e3
1 parent f07f260 commit eae6a93

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

aidl/vibrator/cs40l25/Vibrator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex,
520520
mHwApi->setEffectIndex(effectIndex);
521521
mHwApi->setDuration(timeoutMs);
522522
mHwApi->setActivate(1);
523+
usleep(10000);
523524
// Using the mToalDuration for composed effect.
524525
// For composed effect, we set the UINT32_MAX to the duration sysfs node,
525526
// but it not a practical way to use it to monitor the total duration time.

0 commit comments

Comments
 (0)