Lines Matching defs:state

31  * Block until a specific state change occurs.
33 * <p>Provides wait calls that block until the next unobserved state of the
58 * Create a new state waiter.
60 * <p>All {@code state}/{@code states} arguments used in other methods must be
72 public void onStateChanged(int state) {
73 queueStateTransition(checkStateInRange(state));
83 * Wait until the desired state is observed, checking all state
84 * transitions since the last time a state was waited on.
86 * <p>Any intermediate state transitions that is not {@code state} are ignored.</p>
90 * @param state state to observe a transition to
93 * @throws IllegalArgumentException if {@code state} was out of range
94 * @throws TimeoutRuntimeException if the desired state is not observed before timeout.
95 * @throws IllegalStateException if another thread is already waiting for a state transition
97 public void waitForState(int state, long timeoutMs) {
98 Integer[] stateArray = { checkStateInRange(state) };
105 * state transitions since the last time a state was waited on.
107 * <p>Any intermediate state transitions that are not in {@code states} are ignored.</p>
114 * @return the state reached
116 * @throws IllegalArgumentException if {@code state} was out of range
118 * @throws IllegalStateException if another thread is already waiting for a state transition
131 StringBuilder s = new StringBuilder("Waiting for state(s) ");
161 s.append(" ms waiting for state(s) ");
171 * Convert state integer to a String
173 public String getStateName(int state) {
174 return mStateNames[checkStateInRange(state)];
184 for (Integer state : states) {
189 s.append(getStateName(state));
194 private void queueStateTransition(int state) {
195 if (VERBOSE) Log.v(TAG, "setCurrentState - state now " + getStateName(state));
198 mQueuedStates.put(state);
200 throw new UnsupportedOperationException("Unable to set current state", e);
204 private int checkStateInRange(int state) {
205 if (state < 0 || state >= mStateCount) {
206 throw new IllegalArgumentException("State out of range " + state);
209 return state;
213 for (int state : states) {
214 checkStateInRange(state);