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

Commit 6738af59 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix default vibrator HAL to check support on getPrimitiveDuration"

parents dc46322e 6d4c0482
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,11 @@ ndk::ScopedAStatus Vibrator::getSupportedPrimitives(std::vector<CompositePrimiti


ndk::ScopedAStatus Vibrator::getPrimitiveDuration(CompositePrimitive primitive,
ndk::ScopedAStatus Vibrator::getPrimitiveDuration(CompositePrimitive primitive,
                                                  int32_t* durationMs) {
                                                  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) {
    if (primitive != CompositePrimitive::NOOP) {
        *durationMs = 100;
        *durationMs = 100;
    } else {
    } else {