vibrator: Add "Light Tick" Primitive

Bug: 147844633
Test: adb shell idlcli vibrator compose 0 7 1.0
Change-Id: I208e56011f790c095afe734fd4326de10078525a
Signed-off-by: Harpreet \"Eli\" Sangha <eliptus@google.com>
This commit is contained in:
Harpreet \"Eli\" Sangha 2020-01-17 14:46:37 +09:00
parent afa8636ce2
commit ee9d2bcf5b
2 changed files with 7 additions and 2 deletions

View file

@ -49,4 +49,9 @@ enum CompositePrimitive {
* A haptic effect that simulates quick downwards movement with gravity.
*/
QUICK_FALL,
/**
* This very short effect should produce a light crisp sensation intended
* to be used repetitively for dynamic feedback.
*/
LIGHT_TICK,
}

View file

@ -118,7 +118,7 @@ ndk::ScopedAStatus Vibrator::getSupportedPrimitives(std::vector<CompositePrimiti
CompositePrimitive::NOOP, CompositePrimitive::CLICK,
CompositePrimitive::THUD, CompositePrimitive::SPIN,
CompositePrimitive::QUICK_RISE, CompositePrimitive::SLOW_RISE,
CompositePrimitive::QUICK_FALL,
CompositePrimitive::QUICK_FALL, CompositePrimitive::LIGHT_TICK,
};
return ndk::ScopedAStatus::ok();
}
@ -147,7 +147,7 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
if (e.primitive < CompositePrimitive::NOOP ||
e.primitive > CompositePrimitive::QUICK_FALL) {
e.primitive > CompositePrimitive::LIGHT_TICK) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
}