Program: 34070
Project: 34070
Buggy source:
private void initialPageElements(){
  imageViewLayout=(RelativeLayout)this.findViewById(R.id.camera_view_layout);
  imageView=(ImageView)this.findViewById(R.id.img_camera1);
  mediaPlayerView=(ImageView)this.findViewById(R.id.ivmediaplayer1);
  snapshotMenuView=(ImageView)this.findViewById(R.id.player_savesnapshot);
  surfaceView=(SurfaceView)findViewById(R.id.surface_view);
  surfaceHolder=surfaceView.getHolder();
  surfaceHolder.addCallback(this);
  progressView=((ProgressView)imageViewLayout.findViewById(R.id.ivprogressspinner1));
  progressView.setMinimumWidth(mediaPlayerView.getWidth());
  progressView.setMinimumHeight(mediaPlayerView.getHeight());
  progressView.canvasColor=Color.TRANSPARENT;
  isProgressShowing=true;
  progressView.setVisibility(View.VISIBLE);
  offlineTextView=(TextView)findViewById(R.id.offline_text_view);
  timeCountTextView=(TextView)findViewById(R.id.time_text_view);
  mediaPlayerView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (end) {
        Toast.makeText(VideoActivity.this,R.string.msg_try_again,Toast.LENGTH_SHORT).show();
        return;
      }
      if (isProgressShowing)       return;
      if (paused) {
        timeCountTextView.setVisibility(View.VISIBLE);
        showProgressView();
        mediaPlayerView.setImageBitmap(null);
        mediaPlayerView.setVisibility(View.VISIBLE);
        snapshotMenuView.setVisibility(View.VISIBLE);
        mediaPlayerView.setImageResource(android.R.drawable.ic_media_pause);
        startMediaPlayerAnimation();
        if (evercamCamera != null && !evercamCamera.getExternalRtspUrl().isEmpty()) {
          restartPlay(evercamCamera);
        }
 else {
        }
        paused=false;
      }
 else {
        timeCountTextView.setVisibility(View.GONE);
        mediaPlayerView.clearAnimation();
        snapshotMenuView.clearAnimation();
        if (fadeInAnimation != null && fadeInAnimation.hasStarted() && !fadeInAnimation.hasEnded()) {
          fadeInAnimation.cancel();
          fadeInAnimation.reset();
        }
        mediaPlayerView.setVisibility(View.VISIBLE);
        snapshotMenuView.setVisibility(View.VISIBLE);
        if (surfaceView.getVisibility() == View.VISIBLE) {
          snapshotMenuView.setVisibility(View.GONE);
        }
        mediaPlayerView.setImageBitmap(null);
        mediaPlayerView.setImageResource(android.R.drawable.ic_media_play);
        pausePlayer();
        paused=true;
      }
    }
  }
);
  imageViewLayout.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (end) {
        Toast.makeText(VideoActivity.this,R.string.msg_try_again,Toast.LENGTH_SHORT).show();
        return;
      }
      if (isProgressShowing)       return;
      if (!paused && !end) {
        if (mediaPlayerView.getVisibility() == View.VISIBLE) {
          mediaPlayerView.setVisibility(View.GONE);
          snapshotMenuView.setVisibility(View.GONE);
          mediaPlayerView.clearAnimation();
          snapshotMenuView.clearAnimation();
          fadeInAnimation.reset();
        }
 else {
          VideoActivity.this.getActionBar().show();
          mediaPlayerView.setImageResource(android.R.drawable.ic_media_pause);
          mediaPlayerView.setVisibility(View.VISIBLE);
          snapshotMenuView.setVisibility(View.VISIBLE);
          startMediaPlayerAnimation();
        }
      }
    }
  }
);
  snapshotMenuView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (!paused) {
        mediaPlayerView.setVisibility(View.GONE);
        snapshotMenuView.setVisibility(View.GONE);
        mediaPlayerView.clearAnimation();
        snapshotMenuView.clearAnimation();
        fadeInAnimation.reset();
      }
      if (imageView.getVisibility() == View.VISIBLE) {
        final Bitmap bitmap;
        if (imageView.getDrawable() instanceof BitmapDrawable) {
          bitmap=((BitmapDrawable)imageView.getDrawable()).getBitmap();
        }
 else {
          Drawable drawable=imageView.getDrawable();
          bitmap=Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),Bitmap.Config.ARGB_8888);
          Canvas canvas=new Canvas(bitmap);
          drawable.draw(canvas);
        }
        if (bitmap != null) {
          CustomedDialog.getConfirmSnapshotDialog(VideoActivity.this,bitmap,new DialogInterface.OnClickListener(){
            @Override public void onClick(            DialogInterface dialog,            int which){
              String path=SnapshotManager.createFilePath(evercamCamera.getCameraId(),FileType.JPG);
              new Thread(new CaptureSnapshotRunnable(VideoActivity.this,path,bitmap)).start();
            }
          }
).show();
        }
      }
 else       if (surfaceView.getVisibility() == View.VISIBLE) {
        nativeRequestSample();
      }
    }
  }
);
}

Fixed version (ground truth):
private void initialPageElements(){
  imageViewLayout=(RelativeLayout)this.findViewById(R.id.camera_view_layout);
  imageView=(ImageView)this.findViewById(R.id.img_camera1);
  mediaPlayerView=(ImageView)this.findViewById(R.id.ivmediaplayer1);
  snapshotMenuView=(ImageView)this.findViewById(R.id.player_savesnapshot);
  surfaceView=(SurfaceView)findViewById(R.id.surface_view);
  surfaceHolder=surfaceView.getHolder();
  surfaceHolder.addCallback(this);
  progressView=((ProgressView)imageViewLayout.findViewById(R.id.ivprogressspinner1));
  progressView.setMinimumWidth(mediaPlayerView.getWidth());
  progressView.setMinimumHeight(mediaPlayerView.getHeight());
  progressView.canvasColor=Color.TRANSPARENT;
  isProgressShowing=true;
  progressView.setVisibility(View.VISIBLE);
  offlineTextView=(TextView)findViewById(R.id.offline_text_view);
  timeCountTextView=(TextView)findViewById(R.id.time_text_view);
  mediaPlayerView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (end) {
        Toast.makeText(VideoActivity.this,R.string.msg_try_again,Toast.LENGTH_SHORT).show();
        return;
      }
      if (isProgressShowing)       return;
      if (paused) {
        timeCountTextView.setVisibility(View.VISIBLE);
        showProgressView();
        mediaPlayerView.setImageBitmap(null);
        mediaPlayerView.setVisibility(View.VISIBLE);
        snapshotMenuView.setVisibility(View.VISIBLE);
        mediaPlayerView.setImageResource(android.R.drawable.ic_media_pause);
        startMediaPlayerAnimation();
        if (evercamCamera != null && !evercamCamera.getExternalRtspUrl().isEmpty()) {
          restartPlay(evercamCamera);
        }
 else {
        }
        paused=false;
      }
 else {
        timeCountTextView.setVisibility(View.GONE);
        mediaPlayerView.clearAnimation();
        snapshotMenuView.clearAnimation();
        if (fadeInAnimation != null && fadeInAnimation.hasStarted() && !fadeInAnimation.hasEnded()) {
          fadeInAnimation.cancel();
          fadeInAnimation.reset();
        }
        mediaPlayerView.setVisibility(View.VISIBLE);
        snapshotMenuView.setVisibility(View.VISIBLE);
        if (surfaceView.getVisibility() == View.VISIBLE) {
          snapshotMenuView.setVisibility(View.GONE);
        }
        mediaPlayerView.setImageBitmap(null);
        mediaPlayerView.setImageResource(android.R.drawable.ic_media_play);
        pausePlayer();
        paused=true;
      }
    }
  }
);
  imageViewLayout.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (end) {
        Toast.makeText(VideoActivity.this,R.string.msg_try_again,Toast.LENGTH_SHORT).show();
        return;
      }
      if (isProgressShowing)       return;
      if (!paused && !end) {
        if (mediaPlayerView.getVisibility() == View.VISIBLE) {
          mediaPlayerView.setVisibility(View.GONE);
          snapshotMenuView.setVisibility(View.GONE);
          mediaPlayerView.clearAnimation();
          snapshotMenuView.clearAnimation();
          fadeInAnimation.reset();
        }
 else {
          VideoActivity.this.getActionBar().show();
          mediaPlayerView.setImageResource(android.R.drawable.ic_media_pause);
          mediaPlayerView.setVisibility(View.VISIBLE);
          snapshotMenuView.setVisibility(View.VISIBLE);
          startMediaPlayerAnimation();
        }
      }
    }
  }
);
  snapshotMenuView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (!paused) {
        mediaPlayerView.setVisibility(View.GONE);
        snapshotMenuView.setVisibility(View.GONE);
        mediaPlayerView.clearAnimation();
        snapshotMenuView.clearAnimation();
        fadeInAnimation.reset();
      }
      if (imageView.getVisibility() == View.VISIBLE) {
        final Bitmap bitmap;
        if (imageView.getDrawable() instanceof BitmapDrawable) {
          bitmap=((BitmapDrawable)imageView.getDrawable()).getBitmap();
        }
 else {
          Drawable drawable=imageView.getDrawable();
          bitmap=Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),Bitmap.Config.ARGB_8888);
          Canvas canvas=new Canvas(bitmap);
          drawable.draw(canvas);
        }
        if (bitmap != null) {
          CustomedDialog.getConfirmSnapshotDialog(VideoActivity.this,bitmap,new DialogInterface.OnClickListener(){
            @Override public void onClick(            DialogInterface dialog,            int which){
              String path=SnapshotManager.createFilePath(evercamCamera.getCameraId(),FileType.JPG);
              new Thread(new CaptureSnapshotRunnable(VideoActivity.this,path,bitmap)).start();
            }
          }
).show();
        }
      }
 else       if (surfaceView.getVisibility() == View.VISIBLE) {
        nativeRequestSample("String_Node_Str");
      }
    }
  }
);
}