Merge "cs40l26: Add cancelSynced when prepare sync fail" into tm-qpr-dev am: d520623aed

Original change: https://googleplex-android-review.googlesource.com/c/device/google/felix/+/20533491

Change-Id: I274dcecbfd34f04b8db7407b23b72f3f7fe12f50
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot 2022-11-22 08:16:48 +00:00 committed by Automerger Merge Worker
commit d8acae6982
2 changed files with 4 additions and 1 deletions

View file

@ -420,6 +420,7 @@ ndk::ScopedAStatus Vibrator::off() {
const std::scoped_lock<std::mutex> lock(mActiveId_mutex);
if (mActiveId >= 0) {
ALOGV("Off: Stop the active effect: %d", mActiveId);
/* Stop the active effect. */
if (!mHwApi->setFFPlay(mInputFd, mActiveId, false)) {
ALOGE("Failed to stop effect %d (%d): %s", mActiveId, errno, strerror(errno));
@ -1403,6 +1404,7 @@ void Vibrator::waitForComplete(std::shared_ptr<IVibratorCallback> &&callback) {
}
mSyncedCallback = nullptr;
}
ALOGV("waitForComplete: Done");
}
uint32_t Vibrator::intensityToVolLevel(float intensity, uint32_t effectIndex) {

View file

@ -126,7 +126,8 @@ ndk::ScopedAStatus VibratorManager::prepareSynced(const std::vector<int32_t> &id
if (ext->prepareSynced(callback).isOk()) {
mSyncContext.emplace_back(id, callback->getFuture());
} else {
ALOGV("prepareSynced: Fail");
cancelSynced();
ALOGV("prepareSynced: Fail: %d", id);
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
}