Merge "cs40l26: Improve the vibrator manager stability" into tm-qpr-dev
This commit is contained in:
commit
ee8e70c340
2 changed files with 17 additions and 9 deletions
|
@ -434,7 +434,7 @@ ndk::ScopedAStatus Vibrator::off() {
|
||||||
|
|
||||||
mHwApi->clearTrigBtn(mInputFd, &mFfEffects[mActiveId], mActiveId);
|
mHwApi->clearTrigBtn(mInputFd, &mFfEffects[mActiveId], mActiveId);
|
||||||
} else {
|
} else {
|
||||||
ALOGV("Vibrator is already off");
|
ALOGV("Off: Vibrator is already off");
|
||||||
}
|
}
|
||||||
|
|
||||||
mActiveId = -1;
|
mActiveId = -1;
|
||||||
|
@ -1382,10 +1382,12 @@ void Vibrator::waitForComplete(std::shared_ptr<IVibratorCallback> &&callback) {
|
||||||
(!mHwApi->eraseOwtEffect(mInputFd, mActiveId, &mFfEffects))) {
|
(!mHwApi->eraseOwtEffect(mInputFd, mActiveId, &mFfEffects))) {
|
||||||
ALOGE("Failed to clean up the composed effect %d", mActiveId);
|
ALOGE("Failed to clean up the composed effect %d", mActiveId);
|
||||||
}
|
}
|
||||||
|
if (mActiveId >= 0) {
|
||||||
mHwApi->clearTrigBtn(mInputFd, &mFfEffects[mActiveId], mActiveId);
|
mHwApi->clearTrigBtn(mInputFd, &mFfEffects[mActiveId], mActiveId);
|
||||||
|
mActiveId = -1;
|
||||||
mActiveId = -1;
|
} else {
|
||||||
|
ALOGV("waitForComplete: Vibrator is already off");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ ndk::ScopedAStatus VibratorManager::prepareSynced(const std::vector<int32_t> &id
|
||||||
ATRACE_NAME("VibratorManager::prepareSynced");
|
ATRACE_NAME("VibratorManager::prepareSynced");
|
||||||
|
|
||||||
if (!mGPIOStatus) {
|
if (!mGPIOStatus) {
|
||||||
ALOGE("GetVibrator: GPIO status error");
|
ALOGE("prepareSynced: GPIO status error");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,10 +123,14 @@ ndk::ScopedAStatus VibratorManager::prepareSynced(const std::vector<int32_t> &id
|
||||||
auto &[vib, ext] = mVibrators.at(id);
|
auto &[vib, ext] = mVibrators.at(id);
|
||||||
auto callback = sp<VibratorSyncCallback>::make();
|
auto callback = sp<VibratorSyncCallback>::make();
|
||||||
|
|
||||||
ext->prepareSynced(callback);
|
if (ext->prepareSynced(callback).isOk()) {
|
||||||
|
mSyncContext.emplace_back(id, callback->getFuture());
|
||||||
mSyncContext.emplace_back(id, callback->getFuture());
|
} else {
|
||||||
|
ALOGV("prepareSynced: Fail");
|
||||||
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ALOGV("prepareSynced: Done");
|
||||||
if (mHwApi->initGPIO()) {
|
if (mHwApi->initGPIO()) {
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
} else {
|
} else {
|
||||||
|
@ -138,6 +142,7 @@ ndk::ScopedAStatus VibratorManager::prepareSynced(const std::vector<int32_t> &id
|
||||||
ndk::ScopedAStatus VibratorManager::triggerSynced(
|
ndk::ScopedAStatus VibratorManager::triggerSynced(
|
||||||
const std::shared_ptr<IVibratorCallback> &callback) {
|
const std::shared_ptr<IVibratorCallback> &callback) {
|
||||||
ATRACE_NAME("VibratorManager::triggerSynced");
|
ATRACE_NAME("VibratorManager::triggerSynced");
|
||||||
|
ALOGV("TriggerSynced");
|
||||||
if (isBusy()) {
|
if (isBusy()) {
|
||||||
ALOGE("TriggerSynced isBusy");
|
ALOGE("TriggerSynced isBusy");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
|
@ -171,6 +176,7 @@ ndk::ScopedAStatus VibratorManager::triggerSynced(
|
||||||
ndk::ScopedAStatus VibratorManager::cancelSynced() {
|
ndk::ScopedAStatus VibratorManager::cancelSynced() {
|
||||||
ATRACE_NAME("VibratorManager::cancelSynced");
|
ATRACE_NAME("VibratorManager::cancelSynced");
|
||||||
|
|
||||||
|
ALOGV("Do cancelSynced");
|
||||||
mHwApi->setTrigger(false);
|
mHwApi->setTrigger(false);
|
||||||
{
|
{
|
||||||
std::shared_lock lock(mContextMutex);
|
std::shared_lock lock(mContextMutex);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue