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

Commit 53ed5bdc authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "vibrator: Deduplicate Supported Primitives Check" am: a399d331 am:...

Merge "vibrator: Deduplicate Supported Primitives Check" am: a399d331 am: 56438136 am: 2d48d582

Change-Id: I598db1d74dcb3f611c0feadeb8a9d001280197cb
parents b76fb487 2d48d582
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -139,6 +139,9 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
        return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
    }

    std::vector<CompositePrimitive> supported;
    getSupportedPrimitives(&supported);

    for (auto& e : composite) {
        if (e.delayMs > kComposeDelayMaxMs) {
            return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
@@ -146,8 +149,7 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
        if (e.scale <= 0.0f || e.scale > 1.0f) {
            return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
        }
        if (e.primitive < CompositePrimitive::NOOP ||
            e.primitive > CompositePrimitive::LIGHT_TICK) {
        if (std::find(supported.begin(), supported.end(), e.primitive) == supported.end()) {
            return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
        }
    }