Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e742c1de authored by Kenneth Ford's avatar Kenneth Ford
Browse files

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
parent b28a5b99
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -378,13 +378,14 @@ public final class DeviceStateProviderImpl implements DeviceStateProvider,
                try {
                try {
                    conditionSatisfied = mStateConditions.get(state).getAsBoolean();
                    conditionSatisfied = mStateConditions.get(state).getAsBoolean();
                } catch (IllegalStateException e) {
                } 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
                    // 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) {
                    if (DEBUG) {
                        Slog.d(TAG, "Unable to check current state", e);
                        Slog.d(TAG, "Unable to check current state", e);
                    }
                    }
                    return;
                    continue;
                }
                }


                if (conditionSatisfied) {
                if (conditionSatisfied) {