Buggy code:
public static final String EXTRA_SHOP = "WidgetGoShopping" ; private static boolean launchTorch = false ; private static boolean launchBarcode = false ; private static boolean goShopping = false ; private static int prefFlash = - 1 ; private static boolean prefBarcode = false ; private static final int VOLUME_FUNC_SHUTTER = 0 ; private static final int VOLUME_FUNC_EXPO = 2 ; private static final int VOLUME_FUNC_NONE = 3 ; private static List < Area > mMeteringAreaMatrix5 = new ArrayList < Area > ( ) ; private static List < Area > mMeteringAreaMatrix4 = new ArrayList < Area > ( ) ; private static List < Area > mMeteringAreaMatrix1 = new ArrayList < Area > ( ) ; private static List < Area > mMeteringAreaCenter = new ArrayList < Area > ( ) ; private static List < Area > mMeteringAreaSpot = new ArrayList < Area > ( ) ; private int currentMeteringMode = - 1 ; public static String sTimestampDate ; public static String sTimestampAbbreviation ; public static String sTimestampTime ; public static String sTimestampSeparator ; public static String sTimestampCustomText ; public static String sTimestampColor ; public static String sTimestampFontSize ; public static String sEvPref ; public static String sSceneModePref ; public static String sWBModePref ; public static String sFrontFocusModePref ; public static String sRearFocusModePref ; public static String sFlashModePref ; public static String sISOPref ; public static String sMeteringModePref ; public static String sDelayedCapturePref ; public static String sShowDelayedCapturePref ; public static String sDelayedSoundPref ; public static String sDelayedFlashPref ; public static String sDelayedCaptureIntervalPref ; public static String sPhotoTimeLapseCaptureIntervalPref ; public static String sPhotoTimeLapseCaptureIntervalMeasurmentPref ; public static String sPhotoTimeLapseActivePref ; public static String sPhotoTimeLapseIsRunningPref ; public static String sPhotoTimeLapseCount ; public static String sUseFrontCameraPref ; private static String sShutterPref ; private static String sShotOnTapPref ; private static String sVolumeButtonPref ; public static String sImageSizeRearPref ; public static String sImageSizeFrontPref ; public static String sImageSizeMultishotBackPref ; public static String sImageSizeMultishotFrontPref ; public static String sImageSizePanoramaBackPref ; public static String sImageSizePanoramaFrontPref ; public static String sImageSizeVideoBackPref ; public static String sImageSizeVideoFrontPref ; public static String sCaptureRAWPref ; public static String sInitModeListPref = "initModeListPref" ; public static String sJPEGQualityPref ; public static String sDefaultInfoSetPref ; public static String sSWCheckedPref ; public static String sSavePathPref ; public static String sExportNamePref ; public static String sExportNamePrefixPref ; public static String sExportNamePostfixPref ; public static String sSaveToPref ; public static String sSortByDataPref ; public static String sEnableExifOrientationTagPref ; public static String sAdditionalRotationPref ; public static String sExpoPreviewModePref ; public static String sDefaultModeName ; public static int sDefaultValue = CameraParameters . SCENE_MODE_AUTO ; public static int sDefaultFocusValue = CameraParameters . AF_MODE_CONTINUOUS_PICTURE ; public static int sDefaultFlashValue = CameraParameters . FLASH_MODE_OFF ; public static int sDefaultMeteringValue = CameraParameters . meteringModeAuto ; @ Override public void onCreate ( Bundle savedInstanceState ) { } public static MainScreen getInstance ( ) { } public static Context getMainContext ( ) { } public static Handler getMessageHandler ( ) { } public static CameraController getCameraController ( ) { } public static GUI getGUIManager ( ) { } @ TargetApi ( 21 ) public static void createImageReaders ( ) { Log . e ( "MainScreen" , "createImageReaders" ) ; <START_BUG> MainScreen . thiz . mImageReaderPreviewYUV = ImageReader . newInstance ( MainScreen . thiz . previewWidth , MainScreen . thiz . previewHeight , YUV_420_888 , 1 ) ; <END_BUG> CameraController . Size imageSize = CameraController . getCameraImageSize ( ) ; MainScreen . thiz . mImageReaderYUV = ImageReader . newInstance ( imageSize . getWidth ( ) , imageSize . getHeight ( ) , YUV_420_888 , 2 ) ; if ( ( MainScreen . getCaptureFormat ( ) ) == ( CameraController . RAW ) ) { CameraController . Size imageSizeJPEG = CameraController . getMaxCameraImageSize ( JPEG ) ; MainScreen . thiz . mImageReaderJPEG = ImageReader . newInstance ( imageSizeJPEG . getWidth ( ) , imageSizeJPEG . getHeight ( ) , ImageFormat . JPEG , 2 ) ; } else MainScreen . thiz . mImageReaderJPEG = ImageReader . newInstance ( imageSize . getWidth ( ) , imageSize . getHeight ( ) , ImageFormat . JPEG , 2 ) ; MainScreen . thiz . mImageReaderRAW = ImageReader . newInstance ( imageSize . getWidth ( ) , imageSize . getHeight ( ) , RAW_SENSOR , 2 ) ; MainScreen . thiz . guiManager . setupViewfinderPreviewSize ( new CameraController . Size ( MainScreen . thiz . previewWidth , MainScreen . thiz . previewHeight ) ) ; } public static ImageReader getPreviewYUVImageReader ( ) { } public static ImageReader getYUVImageReader ( ) { } public static ImageReader getJPEGImageReader ( ) { } public static ImageReader getRAWImageReader ( ) { } public static int getCaptureFormat ( ) { } public static void setCaptureFormat ( int capture ) { } public static File getForceFilename ( ) { } public static void setForceFilename ( File fileName ) { } public static Uri getForceFilenameURI ( ) { } public static SurfaceHolder getPreviewSurfaceHolder ( ) { } public static SurfaceView getPreviewSurfaceView ( ) { } public static void setSurfaceHolderSize ( int width , int height ) { } public static int getOrientation ( ) { } public static String getImageSizeIndex ( ) { } public static String getMultishotImageSizeIndex ( ) { } public static boolean isShutterSoundEnabled ( ) { } public static int isShotOnTap ( ) { } public static boolean isShowHelp ( ) { } public static void setShowHelp ( boolean show ) { } public static String getSaveToPath ( ) { } public static String getSaveTo ( ) { } public static boolean isSortByData ( ) { } public static int getMeteringMode ( ) { } public void onPreferenceCreate ( PreferenceFragment prefActivity ) { } private void setImageSizeOptions ( PreferenceFragment prefActivity , int mode ) { } public void onAdvancePreferenceCreate ( PreferenceFragment prefActivity ) { } public void glSetRenderingMode ( final int renderMode ) { } public void glRequestRender ( ) { } public void queueGLEvent ( final Runnable runnable ) { } public int glGetPreviewTexture ( ) { }

Fix:
MainScreen . thiz . mImageReaderPreviewYUV = ImageReader . newInstance ( MainScreen . thiz . previewWidth , MainScreen . thiz . previewHeight , YUV_420_888 , 2 ) ;