Avoid sub_overflow_minimal in AIDL effects VTS
Bug: 299385610 Test: atest VtsHalHapticGeneratorTargetTest Change-Id: I1721fb87dd373a40453505733c8aaee647b4cf3b
This commit is contained in:
parent
8f28f8b8ea
commit
5ed80c5144
2 changed files with 4 additions and 4 deletions
|
@ -250,11 +250,11 @@ class EffectHelper {
|
||||||
maxLimit = std::numeric_limits<S>::max();
|
maxLimit = std::numeric_limits<S>::max();
|
||||||
if (s.size()) {
|
if (s.size()) {
|
||||||
const auto min = *s.begin(), max = *s.rbegin();
|
const auto min = *s.begin(), max = *s.rbegin();
|
||||||
s.insert(min + (max - min) / 2);
|
s.insert((min & max) + ((min ^ max) >> 1));
|
||||||
if (min != minLimit) {
|
if (min > minLimit + 1) {
|
||||||
s.insert(min - 1);
|
s.insert(min - 1);
|
||||||
}
|
}
|
||||||
if (max != maxLimit) {
|
if (max < maxLimit - 1) {
|
||||||
s.insert(max + 1);
|
s.insert(max + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
HapticGeneratorInvalidTest, HapticGeneratorParamTest,
|
HapticGeneratorInvalidTest, HapticGeneratorParamTest,
|
||||||
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
|
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
|
||||||
IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
|
IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
|
||||||
testing::Values(MIN_ID - 1),
|
testing::Values(MIN_ID),
|
||||||
testing::Values(HapticGenerator::VibratorScale::NONE),
|
testing::Values(HapticGenerator::VibratorScale::NONE),
|
||||||
testing::Values(MIN_FLOAT), testing::Values(MIN_FLOAT),
|
testing::Values(MIN_FLOAT), testing::Values(MIN_FLOAT),
|
||||||
testing::Values(MIN_FLOAT)),
|
testing::Values(MIN_FLOAT)),
|
||||||
|
|
Loading…
Reference in a new issue