private boolean checkStateError(String method, EnumSet<State> allowedStates) {
    """
	Checks states for methods that asynchronously invoke
	{@link android.media.MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)
	onError()} when invoked in an illegal state. Such methods always throw
	{@link IllegalStateException} rather than invoke {@code onError()} if
	they are invoked from the END state.
	
	This method will either emulate this behavior by posting an
	{@code onError()} callback to the current thread's message queue (or
	throw an {@link IllegalStateException} if invoked from the END state), or
	else it will generate an assertion if {@link #setAssertOnError
	assertOnError} is set.
	
	@param method
	the name of the method being tested.
	@param allowedStates
	the states that this method is allowed to be called from.
	@see #getHandler
	@see #setAssertOnError
	@see #checkStateLog(String, EnumSet)
	@see #checkStateException(String, EnumSet)
    """
    if (!allowedStates.contains(state)) {
      switch (invalidStateBehavior) {
      case SILENT:
        break;
      case EMULATE:
        if (state == END) {
          String msg = "Can't call " + method + " from state " + state;
          throw new IllegalStateException(msg);
        }
        state = ERROR;
        postEvent(invalidStateErrorCallback);
        return false;
      case ASSERT:
        String msg = "Can't call " + method + " from state " + state;
        throw new AssertionError(msg);
      }
    }
    return true;
  }
private boolean checkStateError(String method, EnumSet<State> allowedStates) {
    if (!allowedStates.contains(state)) {
      switch (invalidStateBehavior) {
      case SILENT:
        break;
      case EMULATE:
        if (state == END) {
          String msg = "Can't call " + method + " from state " + state;
          throw new IllegalStateException(msg);
        }
        state = ERROR;
        postEvent(invalidStateErrorCallback);
        return false;
      case ASSERT:
        String msg = "Can't call " + method + " from state " + state;
        throw new AssertionError(msg);
      }
    }
    return true;
  }
private boolean checkStateError ( String method , EnumSet < State > allowedStates ) { if ( ! allowedStates . contains ( state ) ) { switch ( invalidStateBehavior ) { case SILENT : break ; case EMULATE : if ( state == END ) { String msg = "Can't call " + method + " from state " + state ; throw new IllegalStateException ( msg ) ; } state = ERROR ; postEvent ( invalidStateErrorCallback ) ; return false ; case ASSERT : String msg = "Can't call " + method + " from state " + state ; throw new AssertionError ( msg ) ; } } return true ; }
Checks states for methods that asynchronously invoke
{@link android.media.MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)
onError()} when invoked in an illegal state. Such methods always throw
{@link IllegalStateException} rather than invoke {@code onError()} if
they are invoked from the END state.

This method will either emulate this behavior by posting an
{@code onError()} callback to the current thread's message queue (or
throw an {@link IllegalStateException} if invoked from the END state), or
else it will generate an assertion if {@link #setAssertOnError
assertOnError} is set.

@param method
the name of the method being tested.
@param allowedStates
the states that this method is allowed to be called from.
@see #getHandler
@see #setAssertOnError
@see #checkStateLog(String, EnumSet)
@see #checkStateException(String, EnumSet)
Checks states for methods that asynchronously invoke { @link android . media . MediaPlayer . OnErrorListener#onError ( MediaPlayer int int ) onError () } when invoked in an illegal state . Such methods always throw { @link IllegalStateException } rather than invoke { @code onError () } if they are invoked from the END state .