Program: 38205
Project: 38205
Buggy source:
public PhotoUI(CameraActivity activity,PhotoController controller,View parent){
  mActivity=activity;
  mController=controller;
  mRootView=parent;
  mActivity.getLayoutInflater().inflate(R.layout.photo_module,(ViewGroup)mRootView,true);
  mPreviewCover=mRootView.findViewById(R.id.preview_cover);
  mSurfaceView=(SurfaceView)mRootView.findViewById(R.id.mdp_preview_content);
  mSurfaceView.setVisibility(View.VISIBLE);
  mSurfaceHolder=mSurfaceView.getHolder();
  mSurfaceHolder.addCallback(this);
  mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  Log.v(TAG,"String_Node_Str");
  mSurfaceView.addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      int width=right - left;
      int height=bottom - top;
      tryToCloseSubList();
      if (mMaxPreviewWidth == 0 && mMaxPreviewHeight == 0) {
        mMaxPreviewWidth=width;
        mMaxPreviewHeight=height;
      }
      if (mOrientationResize != mPrevOrientationResize || mAspectRatioResize) {
        layoutPreview(mAspectRatio);
        mAspectRatioResize=false;
      }
    }
  }
);
  mRenderOverlay=(RenderOverlay)mRootView.findViewById(R.id.render_overlay);
  mFlashOverlay=mRootView.findViewById(R.id.flash_overlay);
  mShutterButton=(ShutterButton)mRootView.findViewById(R.id.shutter_button);
  mSwitcher=(ModuleSwitcher)mRootView.findViewById(R.id.camera_switcher);
  mSwitcher.setCurrentIndex(ModuleSwitcher.PHOTO_MODULE_INDEX);
  mSwitcher.setSwitchListener(mActivity);
  mSwitcher.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (mController.getCameraState() == PhotoController.LONGSHOT) {
        return;
      }
      mSwitcher.showPopup();
      mSwitcher.setOrientation(mOrientation,false);
    }
  }
);
  mMenuButton=mRootView.findViewById(R.id.menu);
  RotateImageView muteButton=(RotateImageView)mRootView.findViewById(R.id.mute_button);
  muteButton.setVisibility(View.GONE);
  mCameraControls=(CameraControls)mRootView.findViewById(R.id.camera_controls);
  ViewStub faceViewStub=(ViewStub)mRootView.findViewById(R.id.face_view_stub);
  if (faceViewStub != null) {
    faceViewStub.inflate();
    mFaceView=(FaceView)mRootView.findViewById(R.id.face_view);
    setSurfaceTextureSizeChangedListener(mFaceView);
  }
  initIndicators();
  mAnimationManager=new AnimationManager();
  mOrientationResize=false;
  mPrevOrientationResize=false;
  Point size=new Point();
  mActivity.getWindowManager().getDefaultDisplay().getSize(size);
  mScreenRatio=CameraUtil.determineRatio(size.x,size.y);
  calculateMargins(size);
  mCameraControls.setMargins(mTopMargin,mBottomMargin);
  showFirstTimeHelp();
}

Fixed version (ground truth):
public PhotoUI(CameraActivity activity,PhotoController controller,View parent){
  mActivity=activity;
  mController=controller;
  mRootView=parent;
  mActivity.getLayoutInflater().inflate(R.layout.photo_module,(ViewGroup)mRootView,true);
  mPreviewCover=mRootView.findViewById(R.id.preview_cover);
  mSurfaceView=(SurfaceView)mRootView.findViewById(R.id.mdp_preview_content);
  mSurfaceView.setVisibility(View.VISIBLE);
  mSurfaceHolder=mSurfaceView.getHolder();
  mSurfaceHolder.addCallback(this);
  mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  Log.v(TAG,"String_Node_Str");
  mSurfaceView.addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      int width=right - left;
      int height=bottom - top;
      tryToCloseSubList();
      if (mMaxPreviewWidth == 0 && mMaxPreviewHeight == 0) {
        mMaxPreviewWidth=width;
        mMaxPreviewHeight=height;
      }
      if (mOrientationResize != mPrevOrientationResize || mAspectRatioResize || !mIsLayoutInitializedAlready) {
        layoutPreview(mAspectRatio);
        mAspectRatioResize=false;
      }
    }
  }
);
  mRenderOverlay=(RenderOverlay)mRootView.findViewById(R.id.render_overlay);
  mFlashOverlay=mRootView.findViewById(R.id.flash_overlay);
  mShutterButton=(ShutterButton)mRootView.findViewById(R.id.shutter_button);
  mSwitcher=(ModuleSwitcher)mRootView.findViewById(R.id.camera_switcher);
  mSwitcher.setCurrentIndex(ModuleSwitcher.PHOTO_MODULE_INDEX);
  mSwitcher.setSwitchListener(mActivity);
  mSwitcher.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (mController.getCameraState() == PhotoController.LONGSHOT) {
        return;
      }
      mSwitcher.showPopup();
      mSwitcher.setOrientation(mOrientation,false);
    }
  }
);
  mMenuButton=mRootView.findViewById(R.id.menu);
  RotateImageView muteButton=(RotateImageView)mRootView.findViewById(R.id.mute_button);
  muteButton.setVisibility(View.GONE);
  mCameraControls=(CameraControls)mRootView.findViewById(R.id.camera_controls);
  ViewStub faceViewStub=(ViewStub)mRootView.findViewById(R.id.face_view_stub);
  if (faceViewStub != null) {
    faceViewStub.inflate();
    mFaceView=(FaceView)mRootView.findViewById(R.id.face_view);
    setSurfaceTextureSizeChangedListener(mFaceView);
  }
  initIndicators();
  mAnimationManager=new AnimationManager();
  mOrientationResize=false;
  mPrevOrientationResize=false;
  Point size=new Point();
  mActivity.getWindowManager().getDefaultDisplay().getSize(size);
  mScreenRatio=CameraUtil.determineRatio(size.x,size.y);
  calculateMargins(size);
  mCameraControls.setMargins(mTopMargin,mBottomMargin);
  showFirstTimeHelp();
}