nus-yam/ex-repair huggingface dataset:
Program: 181691
Project: 181691
Buggy source:
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}

Fixed version (ground truth):
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true,false);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}
Program: 181699
Project: 181699
Buggy source:
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}

Fixed version (ground truth):
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true,false);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}
Program: 181707
Project: 181707
Buggy source:
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}

Fixed version (ground truth):
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true,false);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}
Program: 181708
Project: 181708
Buggy source:
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
}

Fixed version (ground truth):
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
synchronized (mCmdQueue) {
    if (mCmdQueue.size() == 0) {
synchronized (mCompletionHandlingLock) {
        if (mLooper != null) {
          mLooper.quit();
        }
        mCompletionThread=null;
      }
    }
  }
}
Program: 181709
Project: 181709
Buggy source:
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
mLooper.quit();
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}

Fixed version (ground truth):
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
  mLooper.quit();
}
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}
Program: 181710
Project: 181710
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
synchronized (mCompletionHandlingLock) {
      if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
        mLooper.quit();
      }
      mCompletionThread=new CreationAndCompletionThread(cmd);
synchronized (mCompletionThread) {
        mCompletionThread.start();
        mCompletionThread.wait();
      }
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 181711
Project: 181711
Buggy source:
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      onVisibilityChanged(visible);
    }
  }
}

Fixed version (ground truth):
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      if (visible) {
        updateSurface(false,false);
      }
      onVisibilityChanged(visible);
    }
  }
}
Program: 181712
Project: 181712
Buggy source:
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
  final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
  final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
  final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
  final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
  onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}

Fixed version (ground truth):
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (mSurfaceCreated) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
    final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
    final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
    final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
    final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
    onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  }
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 181713
Project: 181713
Buggy source:
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  reportSurfaceDestroyed();
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 181715
Project: 181715
Buggy source:
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      onVisibilityChanged(visible);
    }
  }
}

Fixed version (ground truth):
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      if (visible) {
        updateSurface(false,false);
      }
      onVisibilityChanged(visible);
    }
  }
}
Program: 181716
Project: 181716
Buggy source:
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
  final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
  final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
  final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
  final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
  onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}

Fixed version (ground truth):
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (mSurfaceCreated) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
    final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
    final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
    final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
    final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
    onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  }
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 181717
Project: 181717
Buggy source:
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  reportSurfaceDestroyed();
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 181721
Project: 181721
Buggy source:
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      onVisibilityChanged(visible);
    }
  }
}

Fixed version (ground truth):
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      if (visible) {
        updateSurface(false,false);
      }
      onVisibilityChanged(visible);
    }
  }
}
Program: 181722
Project: 181722
Buggy source:
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
  final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
  final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
  final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
  final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
  onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}

Fixed version (ground truth):
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (mSurfaceCreated) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
    final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
    final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
    final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
    final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
    onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  }
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 181723
Project: 181723
Buggy source:
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  reportSurfaceDestroyed();
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 181725
Project: 181725
Buggy source:
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
}

Fixed version (ground truth):
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
synchronized (mCmdQueue) {
    if (mCmdQueue.size() == 0) {
synchronized (mCompletionHandlingLock) {
        if (mLooper != null) {
          mLooper.quit();
        }
        mCompletionThread=null;
      }
    }
  }
}
Program: 181726
Project: 181726
Buggy source:
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
mLooper.quit();
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}

Fixed version (ground truth):
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
  mLooper.quit();
}
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}
Program: 181727
Project: 181727
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
synchronized (mCompletionHandlingLock) {
      if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
        mLooper.quit();
      }
      mCompletionThread=new CreationAndCompletionThread(cmd);
synchronized (mCompletionThread) {
        mCompletionThread.start();
        mCompletionThread.wait();
      }
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 181729
Project: 181729
Buggy source:
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
}

Fixed version (ground truth):
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
synchronized (mCmdQueue) {
    if (mCmdQueue.size() == 0) {
synchronized (mCompletionHandlingLock) {
        if (mLooper != null) {
          mLooper.quit();
        }
        mCompletionThread=null;
      }
    }
  }
}
Program: 181730
Project: 181730
Buggy source:
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
mLooper.quit();
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}

Fixed version (ground truth):
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
  mLooper.quit();
}
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}
Program: 181731
Project: 181731
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
synchronized (mCompletionHandlingLock) {
      if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
        mLooper.quit();
      }
      mCompletionThread=new CreationAndCompletionThread(cmd);
synchronized (mCompletionThread) {
        mCompletionThread.start();
        mCompletionThread.wait();
      }
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 181732
Project: 181732
Buggy source:
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      onVisibilityChanged(visible);
    }
  }
}

Fixed version (ground truth):
void reportVisibility(){
  if (!mDestroyed) {
    boolean visible=mVisible && mScreenOn;
    if (mReportedVisible != visible) {
      mReportedVisible=visible;
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + visible + "String_Node_Str"+ this);
      if (visible) {
        updateSurface(false,false);
      }
      onVisibilityChanged(visible);
    }
  }
}
Program: 181733
Project: 181733
Buggy source:
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
  final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
  final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
  final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
  final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
  onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}

Fixed version (ground truth):
void doOffsetsChanged(){
  if (mDestroyed) {
    return;
  }
  float xOffset;
  float yOffset;
  float xOffsetStep;
  float yOffsetStep;
  boolean sync;
synchronized (mLock) {
    xOffset=mPendingXOffset;
    yOffset=mPendingYOffset;
    xOffsetStep=mPendingXOffsetStep;
    yOffsetStep=mPendingYOffsetStep;
    sync=mPendingSync;
    mPendingSync=false;
    mOffsetMessageEnqueued=false;
  }
  if (mSurfaceCreated) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ xOffset+ "String_Node_Str"+ yOffset);
    final int availw=mIWallpaperEngine.mReqWidth - mCurWidth;
    final int xPixels=availw > 0 ? -(int)(availw * xOffset + .5f) : 0;
    final int availh=mIWallpaperEngine.mReqHeight - mCurHeight;
    final int yPixels=availh > 0 ? -(int)(availh * yOffset + .5f) : 0;
    onOffsetsChanged(xOffset,yOffset,xOffsetStep,yOffsetStep,xPixels,yPixels);
  }
  if (sync) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mSession.wallpaperOffsetsComplete(mWindow.asBinder());
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 181734
Project: 181734
Buggy source:
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  reportSurfaceDestroyed();
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + mSurfaceHolder.getSurface() + "String_Node_Str"+ this);
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 181736
Project: 181736
Buggy source:
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
}

Fixed version (ground truth):
public void onCompletion(MediaPlayer mp){
  if (mAudioManager != null) {
    mAudioManager.abandonAudioFocus(null);
  }
synchronized (mCmdQueue) {
    if (mCmdQueue.size() == 0) {
synchronized (mCompletionHandlingLock) {
        if (mLooper != null) {
          mLooper.quit();
        }
        mCompletionThread=null;
      }
    }
  }
}
Program: 181737
Project: 181737
Buggy source:
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
mLooper.quit();
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}

Fixed version (ground truth):
public void run(){
  while (true) {
    Command cmd=null;
synchronized (mCmdQueue) {
      if (mDebug)       Log.d(mTag,"String_Node_Str");
      cmd=mCmdQueue.removeFirst();
    }
switch (cmd.code) {
case PLAY:
      if (mDebug)       Log.d(mTag,"String_Node_Str");
    startSound(cmd);
  break;
case STOP:
if (mDebug) Log.d(mTag,"String_Node_Str");
if (mPlayer != null) {
long delay=SystemClock.uptimeMillis() - cmd.requestTime;
if (delay > 1000) {
  Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
}
mPlayer.stop();
mPlayer.release();
mPlayer=null;
mAudioManager.abandonAudioFocus(null);
mAudioManager=null;
if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
  mLooper.quit();
}
}
 else {
Log.w(mTag,"String_Node_Str");
}
break;
}
synchronized (mCmdQueue) {
if (mCmdQueue.size() == 0) {
mThread=null;
releaseWakeLock();
return;
}
}
}
}
Program: 181738
Project: 181738
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
synchronized (mCompletionHandlingLock) {
      if ((mLooper != null) && (mLooper.getThread().getState() != Thread.State.TERMINATED)) {
        mLooper.quit();
      }
      mCompletionThread=new CreationAndCompletionThread(cmd);
synchronized (mCompletionThread) {
        mCompletionThread.start();
        mCompletionThread.wait();
      }
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 181739
Project: 181739
Buggy source:
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_CANCEL,listener));
  }
}

Fixed version (ground truth):
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_CANCEL,listener));
  }
}
Program: 181740
Project: 181740
Buggy source:
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_START_LISTENING,new StartListeningArgs(recognizerIntent,listener)));
  }
}

Fixed version (ground truth):
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_START_LISTENING,mInternalService.new StartListeningArgs(recognizerIntent,listener)));
  }
}
Program: 181741
Project: 181741
Buggy source:
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_STOP_LISTENING,listener));
  }
}

Fixed version (ground truth):
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_STOP_LISTENING,listener));
  }
}
Program: 181742
Project: 181742
Buggy source:
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
}

Fixed version (ground truth):
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
  mListener.mInternalListener=null;
}
Program: 181743
Project: 181743
Buggy source:
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_CANCEL,listener));
  }
}

Fixed version (ground truth):
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_CANCEL,listener));
  }
}
Program: 181744
Project: 181744
Buggy source:
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_START_LISTENING,new StartListeningArgs(recognizerIntent,listener)));
  }
}

Fixed version (ground truth):
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_START_LISTENING,mInternalService.new StartListeningArgs(recognizerIntent,listener)));
  }
}
Program: 181745
Project: 181745
Buggy source:
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_STOP_LISTENING,listener));
  }
}

Fixed version (ground truth):
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_STOP_LISTENING,listener));
  }
}
Program: 181746
Project: 181746
Buggy source:
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
}

Fixed version (ground truth):
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
  mListener.mInternalListener=null;
}
Program: 181747
Project: 181747
Buggy source:
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_CANCEL,listener));
  }
}

Fixed version (ground truth):
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_CANCEL,listener));
  }
}
Program: 181748
Project: 181748
Buggy source:
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_START_LISTENING,new StartListeningArgs(recognizerIntent,listener)));
  }
}

Fixed version (ground truth):
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_START_LISTENING,mInternalService.new StartListeningArgs(recognizerIntent,listener)));
  }
}
Program: 181749
Project: 181749
Buggy source:
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_STOP_LISTENING,listener));
  }
}

Fixed version (ground truth):
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_STOP_LISTENING,listener));
  }
}
Program: 181750
Project: 181750
Buggy source:
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
}

Fixed version (ground truth):
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
  mListener.mInternalListener=null;
}
Program: 181751
Project: 181751
Buggy source:
void killAppAtUsersRequest(ProcessRecord app,Dialog fromDialog){
synchronized (this) {
    app.crashing=false;
    app.crashingReport=null;
    app.notResponding=false;
    app.notRespondingReport=null;
    if (app.anrDialog == fromDialog) {
      app.anrDialog=null;
    }
    if (app.waitDialog == fromDialog) {
      app.waitDialog=null;
    }
    if (app.pid > 0 && app.pid != MY_PID) {
      handleAppCrashLocked(app);
      Slog.i(ActivityManagerService.TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str");
      Process.killProcess(app.pid);
    }
  }
}

Fixed version (ground truth):
void killAppAtUsersRequest(ProcessRecord app,Dialog fromDialog){
synchronized (this) {
    app.crashing=false;
    app.crashingReport=null;
    app.notResponding=false;
    app.notRespondingReport=null;
    if (app.anrDialog == fromDialog) {
      app.anrDialog=null;
    }
    if (app.waitDialog == fromDialog) {
      app.waitDialog=null;
    }
    if (app.pid > 0 && app.pid != MY_PID) {
      handleAppCrashLocked(app);
      Slog.i(ActivityManagerService.TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str");
      EventLog.writeEvent(EventLogTags.AM_KILL,app.pid,app.processName,app.setAdj,"String_Node_Str");
      Process.killProcess(app.pid);
    }
  }
}