コード例 #1
0
  /** Called when mSyncObject lock is held */
  private void checkCurrentState() {
    int targetState;

    if (mEnabled && mSurfaceExist && getVisibility() == VISIBLE) {
      targetState = STARTED;
    } else {
      targetState = STOPPED;
    }

    if (targetState != mState) {
      /* The state change detected. Need to exit the current state and enter target state */
      processExitState(mState);
      mState = targetState;
      processEnterState(mState);
    }
  }