Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c7f0d90 authored by Lais Andrade's avatar Lais Andrade
Browse files

Fix default vibrator HAL to check support on getPrimitiveDuration

Change-Id: I09219cca0a1b0bb985cae70734b0dd03cca441fc
Fix: 191115802
Test: VtsHalVibratorTargetTest
parent e1aa9206
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -138,6 +138,11 @@ ndk::ScopedAStatus Vibrator::getSupportedPrimitives(std::vector<CompositePrimiti

ndk::ScopedAStatus Vibrator::getPrimitiveDuration(CompositePrimitive primitive,
                                                  int32_t* durationMs) {
    std::vector<CompositePrimitive> supported;
    getSupportedPrimitives(&supported);
    if (std::find(supported.begin(), supported.end(), primitive) == supported.end()) {
        return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
    }
    if (primitive != CompositePrimitive::NOOP) {
        *durationMs = 100;
    } else {