Add DeviceIdle constraints with BT motion as a PoC
Right now we only need constraints to act as blockers between state
transitions in stepIdleStateLocked.
This is easier than with any other option because it lets us ignore the
rest of the state machine inside DeviceIdleController and the individual
constraints just focus on whether the device should:
a) go back into ACTIVE state via exitIdleLocked()
b) stay at current state (eg. SENSING) for longer via doing nothing,
with the caveat that there might be some timeout imposed by
DeviceIdleController after which it moves to some other state
anyway (eg. SENSING -> INACTIVE)
c) move down to the next state whenever this becomes viable according
to timeouts and conjunction of any other constraints on this state
ie. (ALARM_TIMEOUT ∧ ¬Constraints[0] ∧ ... ∧ ¬Constraints[n-1])
Bug: 110756616
Bug: 111443261
Test: atest com.android.server.DeviceIdleControllerTest
Test: atest com.android.server.deviceidle.BluetoothConstraintTest
Test: atest BatterySaverPolicyTest
Change-Id: Ia2b6c3b4039acbc19cf2edf9f6b93dbdf2978bdd
8 files changed