Add hall sensor support

The hall sensor would report fixed value fields, we have to ignore other
unused values when checking the condition.

- Only check the expected values.

Bug: 182241801
Test: manual
Change-Id: I63c17ac388e3a089914b4b8a3ca3295f90ef1cae
This commit is contained in:
arthurhung
2021-03-31 18:02:10 +08:00
committed by Arthur Hung
parent c05712b927
commit 062e858a7c

View File

@@ -394,13 +394,13 @@ public final class DeviceStateProviderImpl implements DeviceStateProvider,
throw new IllegalStateException("Have not received sensor event.");
}
if (latestEvent.values.length != mExpectedValues.size()) {
if (latestEvent.values.length < mExpectedValues.size()) {
throw new RuntimeException("Number of supplied numeric range(s) does not "
+ "match the number of values in the latest sensor event for sensor: "
+ mSensor);
}
for (int i = 0; i < latestEvent.values.length; i++) {
for (int i = 0; i < mExpectedValues.size(); i++) {
if (!adheresToRange(latestEvent.values[i], mExpectedValues.get(i))) {
return false;
}