summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kenneth Ford <kennethford@google.com> 2022-12-05 19:47:51 +0000
committer Kenneth Ford <kennethford@google.com> 2022-12-05 19:50:06 +0000
commite742c1defaa0d0cb61dde16c986c845f05056f4e (patch)
tree7d580b7afaf08176e380e685e675fc37d7b1da2b
parentb28a5b990143e9f413ccfce71d63af3966dbbd17 (diff)
Continue searching for device state after exception
Instead of returning if a sensor value hasn't returned we continue to look for a state that satisfy's the current device configuration. This fixes scenarios where some sensors return values much faster than others on startup, and certain states may have their conditions met. Bug: 257292818 Test: Manual Change-Id: I1796a682f0fa82ab9cba39e496369f59fd9c5721
-rw-r--r--services/core/java/com/android/server/policy/DeviceStateProviderImpl.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java b/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java
index 2a65ea2552b3..ced3a45935f8 100644
--- a/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java
+++ b/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java
@@ -378,13 +378,14 @@ public final class DeviceStateProviderImpl implements DeviceStateProvider,
try {
conditionSatisfied = mStateConditions.get(state).getAsBoolean();
} catch (IllegalStateException e) {
- // Failed to compute the current state based on current available data. Return
+ // Failed to compute the current state based on current available data. Continue
// with the expectation that notifyDeviceStateChangedIfNeeded() will be called
- // when a callback with the missing data is triggered.
+ // when a callback with the missing data is triggered. May trigger another state
+ // change if another state is satisfied currently.
if (DEBUG) {
Slog.d(TAG, "Unable to check current state", e);
}
- return;
+ continue;
}
if (conditionSatisfied) {