private boolean isPortraitMode() {
    int orientation = getContext().getResources().getConfiguration().orientation;
    return orientation == Configuration.ORIENTATION_PORTRAIT;
  }
Check if we are is in the portrait mode or not

@return true if the we are currently in portrait mode
java/com/google/android/apps/authenticator/barcode/preview/CameraSourcePreview.java