Merge "Fix default vibrator HAL to check support on getPrimitiveDuration" into sc-dev am: cca7e93111

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/14985772

Change-Id: I95c0ebf06c8b058d5dd0c067e834f43430c87c6d
This commit is contained in:
TreeHugger Robot
2021-06-18 13:56:20 +00:00
committed by Automerger Merge Worker

View File

@@ -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 {