Merge "Avoid sub_overflow_minimal in AIDL effects VTS" into main am: 5348432dea am: a2c4af080a am: 7b25756282

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

Change-Id: Ib7fcef94f5f0e29192c36dbd072108d0891b5004
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shunkai Yao 2023-09-08 23:46:37 +00:00 committed by Automerger Merge Worker
commit 278b277322
2 changed files with 4 additions and 4 deletions

View file

@ -250,11 +250,11 @@ class EffectHelper {
maxLimit = std::numeric_limits<S>::max();
if (s.size()) {
const auto min = *s.begin(), max = *s.rbegin();
s.insert(min + (max - min) / 2);
if (min != minLimit) {
s.insert((min & max) + ((min ^ max) >> 1));
if (min > minLimit + 1) {
s.insert(min - 1);
}
if (max != maxLimit) {
if (max < maxLimit - 1) {
s.insert(max + 1);
}
}

View file

@ -208,7 +208,7 @@ INSTANTIATE_TEST_SUITE_P(
HapticGeneratorInvalidTest, HapticGeneratorParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
testing::Values(MIN_ID - 1),
testing::Values(MIN_ID),
testing::Values(HapticGenerator::VibratorScale::NONE),
testing::Values(MIN_FLOAT), testing::Values(MIN_FLOAT),
testing::Values(MIN_FLOAT)),