nus-yam/ex-repair huggingface dataset:
Program: 22543
Project: 22543
Buggy source:
public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_BACK) {
    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null) {
            ds.startTracking(event,this);
            return true;
          }
        }
      }
    }
 else     if (event.getAction() == KeyEvent.ACTION_UP && event.isTracking() && !event.isCanceled()) {
      mMenu.close(true);
      dialog.dismiss();
      return true;
    }
  }
  return mMenu.performShortcut(keyCode,event,0);
}

Fixed version (ground truth):
public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_BACK) {
    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null) {
            ds.startTracking(event,this);
            return true;
          }
        }
      }
    }
 else     if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null && ds.isTracking(event)) {
            mMenu.close(true);
            dialog.dismiss();
            return true;
          }
        }
      }
    }
  }
  return mMenu.performShortcut(keyCode,event,0);
}
Program: 22546
Project: 22546
Buggy source:
public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_BACK) {
    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null) {
            ds.startTracking(event,this);
            return true;
          }
        }
      }
    }
 else     if (event.getAction() == KeyEvent.ACTION_UP && event.isTracking() && !event.isCanceled()) {
      mMenu.close(true);
      dialog.dismiss();
      return true;
    }
  }
  return mMenu.performShortcut(keyCode,event,0);
}

Fixed version (ground truth):
public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_BACK) {
    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null) {
            ds.startTracking(event,this);
            return true;
          }
        }
      }
    }
 else     if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null && ds.isTracking(event)) {
            mMenu.close(true);
            dialog.dismiss();
            return true;
          }
        }
      }
    }
  }
  return mMenu.performShortcut(keyCode,event,0);
}
Program: 22547
Project: 22547
Buggy source:
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}

Fixed version (ground truth):
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  if ((durationHint < AUDIOFOCUS_GAIN) || (durationHint > AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK)) {
    Log.e(TAG,"String_Node_Str");
    return status;
  }
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}
Program: 22548
Project: 22548
Buggy source:
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}

Fixed version (ground truth):
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    removeFocusStackEntry(clientId,false);
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}
Program: 22549
Project: 22549
Buggy source:
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}

Fixed version (ground truth):
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  if ((durationHint < AUDIOFOCUS_GAIN) || (durationHint > AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK)) {
    Log.e(TAG,"String_Node_Str");
    return status;
  }
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}
Program: 22550
Project: 22550
Buggy source:
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}

Fixed version (ground truth):
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    removeFocusStackEntry(clientId,false);
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}
Program: 22551
Project: 22551
Buggy source:
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}

Fixed version (ground truth):
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  if ((durationHint < AUDIOFOCUS_GAIN) || (durationHint > AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK)) {
    Log.e(TAG,"String_Node_Str");
    return status;
  }
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}
Program: 22552
Project: 22552
Buggy source:
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}

Fixed version (ground truth):
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    removeFocusStackEntry(clientId,false);
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}
Program: 22553
Project: 22553
Buggy source:
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}

Fixed version (ground truth):
/** 
 * Request audio focus. Send a request to obtain the audio focus for a specific stream type
 * @param l the listener to be notified of audio focus changes
 * @param streamType the main audio stream type affected by the focus request
 * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus requestis temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use  {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok forthe previous focus owner to keep playing if it ducks its audio output. Use  {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration suchas the playback of a song or a video.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int requestAudioFocus(OnAudioFocusChangeListener l,int streamType,int durationHint){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  if ((durationHint < AUDIOFOCUS_GAIN) || (durationHint > AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK)) {
    Log.e(TAG,"String_Node_Str");
    return status;
  }
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.requestAudioFocus(streamType,durationHint,mICallBack,mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}
Program: 22554
Project: 22554
Buggy source:
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}

Fixed version (ground truth):
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    removeFocusStackEntry(clientId,false);
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}
Program: 22555
Project: 22555
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 22556
Project: 22556
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 22557
Project: 22557
Buggy source:
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
synchronized (this) {
      if (mCurWidth != w || mCurHeight != h) {
        mCurWidth=w;
        mCurHeight=h;
      }
      if (reportDraw) {
        try {
          surfaceView.mSession.finishDrawing(surfaceView.mWindow);
        }
 catch (        RemoteException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
    surfaceView.mSurfaceLock.lock();
    try {
      if (reportDraw) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mReportDrawNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
 else       if (surfaceView.mWinFrame.width() != w || surfaceView.mWinFrame.height() != h) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
    }
  finally {
      surfaceView.mSurfaceLock.unlock();
    }
  }
}
Program: 22558
Project: 22558
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
case UPDATE_WINDOW_MSG:
{
updateWindow(false);
}
break;
}
}
Program: 22560
Project: 22560
Buggy source:
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mLastDimWidth=dw;
      mLastDimHeight=dh;
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
 else   if (mLastDimWidth != dw || mLastDimHeight != dh) {
    mLastDimWidth=dw;
    mLastDimHeight=dh;
    mDimSurface.setSize(dw,dh);
  }
}
Program: 22562
Project: 22562
Buggy source:
private final int indexOfTokenLocked(IBinder token){
  int count=mHistory.size();
  HistoryRecord r=null;
  int index=-1;
  for (int i=count - 1; i >= 0; i--) {
    Object o=mHistory.get(i);
    if (o == token) {
      r=(HistoryRecord)o;
      index=i;
      break;
    }
  }
  return index;
}

Fixed version (ground truth):
private final int indexOfTokenLocked(IBinder token){
  int count=mHistory.size();
  int index=-1;
  for (int i=count - 1; i >= 0; i--) {
    Object o=mHistory.get(i);
    if (o == token) {
      index=i;
      break;
    }
  }
  return index;
}
Program: 22568
Project: 22568
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 22569
Project: 22569
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 22570
Project: 22570
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 22571
Project: 22571
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (getChildCount() > 0) {
      View child=getChildAt(0);
      x=clamp(x,getWidth() - mPaddingRight - mPaddingLeft,child.getWidth());
      y=clamp(y,getHeight() - mPaddingBottom - mPaddingTop,child.getHeight());
      if (x != oldX || y != oldY) {
        mScrollX=x;
        mScrollY=y;
        onScrollChanged(x,y,oldX,oldY);
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 22572
Project: 22572
Buggy source:
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mLastDimWidth=dw;
      mLastDimHeight=dh;
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
 else   if (mLastDimWidth != dw || mLastDimHeight != dh) {
    mLastDimWidth=dw;
    mLastDimHeight=dh;
    mDimSurface.setSize(dw,dh);
  }
}
Program: 22574
Project: 22574
Buggy source:
private final int indexOfTokenLocked(IBinder token){
  int count=mHistory.size();
  HistoryRecord r=null;
  int index=-1;
  for (int i=count - 1; i >= 0; i--) {
    Object o=mHistory.get(i);
    if (o == token) {
      r=(HistoryRecord)o;
      index=i;
      break;
    }
  }
  return index;
}

Fixed version (ground truth):
private final int indexOfTokenLocked(IBinder token){
  int count=mHistory.size();
  int index=-1;
  for (int i=count - 1; i >= 0; i--) {
    Object o=mHistory.get(i);
    if (o == token) {
      index=i;
      break;
    }
  }
  return index;
}
Program: 22576
Project: 22576
Buggy source:
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mLastDimWidth=dw;
      mLastDimHeight=dh;
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
 else   if (mLastDimWidth != dw || mLastDimHeight != dh) {
    mLastDimWidth=dw;
    mLastDimHeight=dh;
    mDimSurface.setSize(dw,dh);
  }
}
Program: 22578
Project: 22578
Buggy source:
private final int indexOfTokenLocked(IBinder token){
  int count=mHistory.size();
  HistoryRecord r=null;
  int index=-1;
  for (int i=count - 1; i >= 0; i--) {
    Object o=mHistory.get(i);
    if (o == token) {
      r=(HistoryRecord)o;
      index=i;
      break;
    }
  }
  return index;
}

Fixed version (ground truth):
private final int indexOfTokenLocked(IBinder token){
  int count=mHistory.size();
  int index=-1;
  for (int i=count - 1; i >= 0; i--) {
    Object o=mHistory.get(i);
    if (o == token) {
      index=i;
      break;
    }
  }
  return index;
}
Program: 22580
Project: 22580
Buggy source:
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
synchronized (this) {
      if (mCurWidth != w || mCurHeight != h) {
        mCurWidth=w;
        mCurHeight=h;
      }
      if (reportDraw) {
        try {
          surfaceView.mSession.finishDrawing(surfaceView.mWindow);
        }
 catch (        RemoteException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
    surfaceView.mSurfaceLock.lock();
    try {
      if (reportDraw) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mReportDrawNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
 else       if (surfaceView.mWinFrame.width() != w || surfaceView.mWinFrame.height() != h) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
    }
  finally {
      surfaceView.mSurfaceLock.unlock();
    }
  }
}
Program: 22581
Project: 22581
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
case UPDATE_WINDOW_MSG:
{
updateWindow(false);
}
break;
}
}
Program: 22583
Project: 22583
Buggy source:
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
synchronized (this) {
      if (mCurWidth != w || mCurHeight != h) {
        mCurWidth=w;
        mCurHeight=h;
      }
      if (reportDraw) {
        try {
          surfaceView.mSession.finishDrawing(surfaceView.mWindow);
        }
 catch (        RemoteException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
    surfaceView.mSurfaceLock.lock();
    try {
      if (reportDraw) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mReportDrawNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
 else       if (surfaceView.mWinFrame.width() != w || surfaceView.mWinFrame.height() != h) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
    }
  finally {
      surfaceView.mSurfaceLock.unlock();
    }
  }
}
Program: 22584
Project: 22584
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
case UPDATE_WINDOW_MSG:
{
updateWindow(false);
}
break;
}
}
Program: 22586
Project: 22586
Buggy source:
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
synchronized (this) {
      if (mCurWidth != w || mCurHeight != h) {
        mCurWidth=w;
        mCurHeight=h;
      }
      if (reportDraw) {
        try {
          surfaceView.mSession.finishDrawing(surfaceView.mWindow);
        }
 catch (        RemoteException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw,Configuration newConfig){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
    surfaceView.mSurfaceLock.lock();
    try {
      if (reportDraw) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mReportDrawNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
 else       if (surfaceView.mWinFrame.width() != w || surfaceView.mWinFrame.height() != h) {
        surfaceView.mUpdateWindowNeeded=true;
        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
      }
    }
  finally {
      surfaceView.mSurfaceLock.unlock();
    }
  }
}
Program: 22587
Project: 22587
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case KEEP_SCREEN_ON_MSG:
{
      setKeepScreenOn(msg.arg1 != 0);
    }
  break;
case GET_NEW_SURFACE_MSG:
{
  handleGetNewSurface();
}
break;
case UPDATE_WINDOW_MSG:
{
updateWindow(false);
}
break;
}
}