mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
Update composePwleV2 VTS test
Updating composePwleV2 VTS test to verify cases where the PWLE V2 capability is not supported. Bug: 347034419 Flag: TEST_ONLY Test: vts-tradefed run vts -m VtsHalVibratorTargetTest Change-Id: I73de882f6595e858cea922b5378e5e7da4719140
This commit is contained in:
@@ -543,6 +543,14 @@ float getPwleV2FrequencyMaxHz(std::vector<PwleV2OutputMapEntry> frequencyToOutpu
|
||||
|
||||
ndk::ScopedAStatus Vibrator::composePwleV2(const std::vector<PwleV2Primitive>& composite,
|
||||
const std::shared_ptr<IVibratorCallback>& callback) {
|
||||
int32_t capabilities = 0;
|
||||
if (!getCapabilities(&capabilities).isOk()) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
}
|
||||
if ((capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) == 0) {
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
int compositionSizeMax;
|
||||
getPwleV2CompositionSizeMax(&compositionSizeMax);
|
||||
if (composite.size() <= 0 || composite.size() > compositionSizeMax) {
|
||||
|
||||
@@ -89,6 +89,7 @@ const std::vector<CompositePrimitive> kInvalidPrimitives = {
|
||||
static constexpr std::chrono::milliseconds VIBRATION_CALLBACK_TIMEOUT = 100ms;
|
||||
|
||||
static constexpr int32_t VENDOR_EFFECTS_MIN_VERSION = 3;
|
||||
static constexpr int32_t PWLE_V2_MIN_VERSION = 3;
|
||||
|
||||
static std::vector<std::string> findVibratorManagerNames() {
|
||||
std::vector<std::string> names;
|
||||
@@ -1117,6 +1118,17 @@ TEST_P(VibratorAidl, ComposeValidPwleV2Effect) {
|
||||
EXPECT_OK(vibrator->off());
|
||||
}
|
||||
|
||||
TEST_P(VibratorAidl, ComposePwleV2Unsupported) {
|
||||
if (version < PWLE_V2_MIN_VERSION) {
|
||||
EXPECT_EQ(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2, 0)
|
||||
<< "Vibrator version " << version << " should not report PWLE V2 capability.";
|
||||
}
|
||||
if (capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) return;
|
||||
|
||||
EXPECT_UNKNOWN_OR_UNSUPPORTED(
|
||||
vibrator->composePwleV2(pwle_v2_utils::composeValidPwleV2Effect(vibrator), nullptr));
|
||||
}
|
||||
|
||||
TEST_P(VibratorAidl, ComposeValidPwleV2EffectWithCallback) {
|
||||
if (!(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2)) {
|
||||
GTEST_SKIP() << "PWLE V2 not supported, skipping test";
|
||||
|
||||
Reference in New Issue
Block a user