Program: 34002
Project: 34002
Buggy source:
private void initialPageElements(){
  imageViewLayout=(RelativeLayout)this.findViewById(R.id.camera_view_layout);
  imageView=(ImageView)this.findViewById(R.id.jpg_image_view);
  playPauseImageView=(ImageView)this.findViewById(R.id.play_pause_image_view);
  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.live_progress_view));
  progressView.setMinimumWidth(playPauseImageView.getWidth());
  progressView.setMinimumHeight(playPauseImageView.getHeight());
  progressView.canvasColor=Color.TRANSPARENT;
  progressView.setVisibility(View.VISIBLE);
  offlineTextView=(TextView)findViewById(R.id.offline_text_view);
  timeCountTextView=(TextView)findViewById(R.id.time_text_view);
  ImageView ptzLeftImageView=(ImageView)findViewById(R.id.arrow_left);
  ImageView ptzRightImageView=(ImageView)findViewById(R.id.arrow_right);
  ImageView ptzUpImageView=(ImageView)findViewById(R.id.arrow_up);
  ImageView ptzDownImageView=(ImageView)findViewById(R.id.arrow_down);
  ImageView ptzHomeImageView=(ImageView)findViewById(R.id.ptz_home);
  ImageView ptzZoomInImageView=(ImageView)findViewById(R.id.zoom_in_image_view);
  ImageView ptzZoomOutImageView=(ImageView)findViewById(R.id.zoom_out_image_view);
  ImageView presetsImageView=(ImageView)findViewById(R.id.presets_image_view);
  ptzZoomLayout=(RelativeLayout)findViewById(R.id.ptz_zoom_control_layout);
  ptzMoveLayout=(RelativeLayout)findViewById(R.id.ptz_move_control_layout);
  ptzLeftImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).left(4).build());
    }
  }
);
  ptzRightImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).right(4).build());
    }
  }
);
  ptzUpImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).up(3).build());
    }
  }
);
  ptzDownImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).down(3).build());
    }
  }
);
  ptzHomeImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZHome(evercamCamera.getCameraId()));
    }
  }
);
  ptzZoomInImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).zoom(1).build());
    }
  }
);
  ptzZoomOutImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).zoom(-1).build());
    }
  }
);
  presetsImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (presetList.size() > 0) {
        final AlertDialog listDialog=new AlertDialog.Builder(VideoActivity.this).setNegativeButton(R.string.cancel,null).create();
        LayoutInflater mInflater=LayoutInflater.from(getApplicationContext());
        final View view=mInflater.inflate(R.layout.dialog_preset_list,null);
        ListView listView=(ListView)view.findViewById(R.id.presets_list_view);
        View header=getLayoutInflater().inflate(R.layout.header_preset_list,null);
        listView.addHeaderView(header);
        listDialog.setView(view);
        listView.setAdapter(new PresetsListAdapter(getApplicationContext(),R.layout.item_preset_list,presetList));
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
          @Override public void onItemClick(          AdapterView<?> parent,          View view,          int position,          long id){
            if (position == 0) {
              CustomedDialog.getCreatePresetDialog(VideoActivity.this,evercamCamera.getCameraId()).show();
            }
 else {
              PTZPreset preset=presetList.get(position - 1);
              PTZMoveTask.launch(new PTZPresetControl(evercamCamera.getCameraId(),preset.getToken()));
            }
            listDialog.cancel();
          }
        }
);
        listDialog.show();
      }
    }
  }
);
  playPauseImageView.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 (isProgressViewVisible())       return;
      if (paused) {
        timeCountTextView.setVisibility(View.VISIBLE);
        showProgressView(true);
        playPauseImageView.setImageBitmap(null);
        showAllControlMenus(true);
        playPauseImageView.setImageResource(R.drawable.ic_pause);
        startMediaPlayerAnimation();
        if (evercamCamera != null && !evercamCamera.getExternalRtspUrl().isEmpty()) {
          restartPlay();
        }
 else {
          showJpgView=true;
          loadJpgView();
        }
        paused=false;
      }
 else {
        timeCountTextView.setVisibility(View.INVISIBLE);
        clearControlMenuAnimation();
        if (fadeInAnimation != null && fadeInAnimation.hasStarted() && !fadeInAnimation.hasEnded()) {
          fadeInAnimation.cancel();
          fadeInAnimation.reset();
        }
        showAllControlMenus(true);
        playPauseImageView.setImageBitmap(null);
        playPauseImageView.setImageResource(R.drawable.ic_play);
        pausePlayer();
        paused=true;
        disconnectJpgView();
      }
    }
  }
);
  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 (isProgressViewVisible())       return;
      if (!paused && !end) {
        if (playPauseImageView.getVisibility() == View.VISIBLE) {
          showAllControlMenus(false);
          clearControlMenuAnimation();
          fadeInAnimation.reset();
        }
 else {
          showToolbar();
          playPauseImageView.setImageResource(R.drawable.ic_pause);
          showAllControlMenus(true);
          startMediaPlayerAnimation();
        }
      }
    }
  }
);
  snapshotMenuView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (!paused) {
        showAllControlMenus(false);
        clearControlMenuAnimation();
        fadeInAnimation.reset();
      }
      if (imageView.getVisibility() == View.VISIBLE) {
        Bitmap bitmap=getBitmapFromImageView(imageView);
        processSnapshot(bitmap,FileType.JPG);
      }
 else       if (surfaceView.getVisibility() == View.VISIBLE) {
        nativeRequestSample("String_Node_Str");
      }
    }
  }
);
}

Fixed version (ground truth):
private void initialPageElements(){
  imageViewLayout=(RelativeLayout)this.findViewById(R.id.camera_view_layout);
  imageView=(ImageView)this.findViewById(R.id.jpg_image_view);
  playPauseImageView=(ImageView)this.findViewById(R.id.play_pause_image_view);
  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.live_progress_view));
  progressView.setMinimumWidth(playPauseImageView.getWidth());
  progressView.setMinimumHeight(playPauseImageView.getHeight());
  progressView.canvasColor=Color.TRANSPARENT;
  progressView.setVisibility(View.VISIBLE);
  offlineTextView=(TextView)findViewById(R.id.offline_text_view);
  timeCountTextView=(TextView)findViewById(R.id.time_text_view);
  ImageView ptzLeftImageView=(ImageView)findViewById(R.id.arrow_left);
  ImageView ptzRightImageView=(ImageView)findViewById(R.id.arrow_right);
  ImageView ptzUpImageView=(ImageView)findViewById(R.id.arrow_up);
  ImageView ptzDownImageView=(ImageView)findViewById(R.id.arrow_down);
  ImageView ptzHomeImageView=(ImageView)findViewById(R.id.ptz_home);
  ImageView ptzZoomInImageView=(ImageView)findViewById(R.id.zoom_in_image_view);
  ImageView ptzZoomOutImageView=(ImageView)findViewById(R.id.zoom_out_image_view);
  ImageView presetsImageView=(ImageView)findViewById(R.id.presets_image_view);
  ptzZoomLayout=(RelativeLayout)findViewById(R.id.ptz_zoom_control_layout);
  ptzMoveLayout=(RelativeLayout)findViewById(R.id.ptz_move_control_layout);
  ptzLeftImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).left(4).build());
    }
  }
);
  ptzRightImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).right(4).build());
    }
  }
);
  ptzUpImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).up(3).build());
    }
  }
);
  ptzDownImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).down(3).build());
    }
  }
);
  ptzHomeImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZHome(evercamCamera.getCameraId()));
    }
  }
);
  ptzZoomInImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).zoom(1).build());
    }
  }
);
  ptzZoomOutImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      PTZMoveTask.launch(new PTZRelativeBuilder(evercamCamera.getCameraId()).zoom(-1).build());
    }
  }
);
  presetsImageView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (presetList.size() > 0) {
        final AlertDialog listDialog=new AlertDialog.Builder(VideoActivity.this).setNegativeButton(R.string.cancel,null).create();
        LayoutInflater mInflater=LayoutInflater.from(getApplicationContext());
        final View view=mInflater.inflate(R.layout.dialog_preset_list,null);
        ListView listView=(ListView)view.findViewById(R.id.presets_list_view);
        View header=getLayoutInflater().inflate(R.layout.header_preset_list,null);
        listView.addHeaderView(header);
        listDialog.setView(view);
        listView.setAdapter(new PresetsListAdapter(getApplicationContext(),R.layout.item_preset_list,presetList));
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
          @Override public void onItemClick(          AdapterView<?> parent,          View view,          int position,          long id){
            if (position == 0) {
              CustomedDialog.getCreatePresetDialog(VideoActivity.this,evercamCamera.getCameraId()).show();
            }
 else {
              PTZPreset preset=presetList.get(position - 1);
              PTZMoveTask.launch(new PTZPresetControl(evercamCamera.getCameraId(),preset.getToken()));
            }
            listDialog.cancel();
          }
        }
);
        listDialog.show();
      }
    }
  }
);
  playPauseImageView.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 (isProgressViewVisible())       return;
      if (paused) {
        timeCountTextView.setVisibility(View.VISIBLE);
        showProgressView(true);
        playPauseImageView.setImageBitmap(null);
        showAllControlMenus(true);
        playPauseImageView.setImageResource(R.drawable.ic_pause);
        startMediaPlayerAnimation();
        if (evercamCamera != null && !evercamCamera.getExternalRtspUrl().isEmpty()) {
          restartPlay();
        }
 else {
          showJpgView=true;
          loadJpgView();
        }
        paused=false;
      }
 else {
        timeCountTextView.setVisibility(View.INVISIBLE);
        clearControlMenuAnimation();
        if (fadeInAnimation != null && fadeInAnimation.hasStarted() && !fadeInAnimation.hasEnded()) {
          fadeInAnimation.cancel();
          fadeInAnimation.reset();
        }
        showAllControlMenus(true);
        playPauseImageView.setImageBitmap(null);
        playPauseImageView.setImageResource(R.drawable.ic_play);
        pausePlayer();
        paused=true;
        disconnectJpgView();
      }
    }
  }
);
  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 (isProgressViewVisible())       return;
      if (!paused && !end && offlineTextView.getVisibility() != View.VISIBLE) {
        if (playPauseImageView.getVisibility() == View.VISIBLE) {
          showAllControlMenus(false);
          clearControlMenuAnimation();
          fadeInAnimation.reset();
        }
 else {
          showToolbar();
          playPauseImageView.setImageResource(R.drawable.ic_pause);
          showAllControlMenus(true);
          startMediaPlayerAnimation();
        }
      }
    }
  }
);
  snapshotMenuView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (!paused) {
        showAllControlMenus(false);
        clearControlMenuAnimation();
        fadeInAnimation.reset();
      }
      if (imageView.getVisibility() == View.VISIBLE) {
        Bitmap bitmap=getBitmapFromImageView(imageView);
        processSnapshot(bitmap,FileType.JPG);
      }
 else       if (surfaceView.getVisibility() == View.VISIBLE) {
        nativeRequestSample("String_Node_Str");
      }
    }
  }
);
}