nus-yam/ex-repair huggingface dataset:
Program: 41634
Project: 41634
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: 41642
Project: 41642
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: 41650
Project: 41650
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: 41651
Project: 41651
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: 41652
Project: 41652
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: 41653
Project: 41653
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: 41655
Project: 41655
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: 41656
Project: 41656
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: 41657
Project: 41657
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: 41666
Project: 41666
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: 41667
Project: 41667
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: 41668
Project: 41668
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: 41669
Project: 41669
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: 41671
Project: 41671
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: 41672
Project: 41672
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: 41673
Project: 41673
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: 41675
Project: 41675
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: 41676
Project: 41676
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: 41677
Project: 41677
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: 41680
Project: 41680
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: 41681
Project: 41681
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: 41682
Project: 41682
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: 41683
Project: 41683
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: 41684
Project: 41684
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: 41685
Project: 41685
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: 41686
Project: 41686
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: 41687
Project: 41687
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: 41688
Project: 41688
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: 41690
Project: 41690
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: 41691
Project: 41691
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: 41692
Project: 41692
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: 41693
Project: 41693
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: 41694
Project: 41694
Buggy source:
private void cancelA2dpDeviceTimeout(String address){
  mAudioHandler.removeMessages(MSG_BTA2DP_DOCK_TIMEOUT);
}

Fixed version (ground truth):
private void cancelA2dpDeviceTimeout(){
  mAudioHandler.removeMessages(MSG_BTA2DP_DOCK_TIMEOUT);
}
Program: 41695
Project: 41695
Buggy source:
private void cancelA2dpDeviceTimeout(String address){
  mAudioHandler.removeMessages(MSG_BTA2DP_DOCK_TIMEOUT);
}

Fixed version (ground truth):
private void cancelA2dpDeviceTimeout(){
  mAudioHandler.removeMessages(MSG_BTA2DP_DOCK_TIMEOUT);
}
Program: 41696
Project: 41696
Buggy source:
private final boolean updateOomAdjLocked(){
  boolean didOomAdj=true;
  final HistoryRecord TOP_ACT=resumedAppLocked();
  final ProcessRecord TOP_APP=TOP_ACT != null ? TOP_ACT.app : null;
  if (false) {
    RuntimeException e=new RuntimeException();
    e.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + TOP_ACT,e);
  }
  mAdjSeq++;
  int numSlots=HIDDEN_APP_MAX_ADJ - HIDDEN_APP_MIN_ADJ + 1;
  int factor=(mLruProcesses.size() - 4) / numSlots;
  if (factor < 1)   factor=1;
  int step=0;
  int numHidden=0;
  int i=mLruProcesses.size();
  int curHiddenAdj=HIDDEN_APP_MIN_ADJ;
  while (i > 0) {
    i--;
    ProcessRecord app=mLruProcesses.get(i);
    if (updateOomAdjLocked(app,curHiddenAdj,TOP_APP)) {
      if (curHiddenAdj < EMPTY_APP_ADJ && app.curAdj == curHiddenAdj) {
        step++;
        if (step >= factor) {
          step=0;
          curHiddenAdj++;
        }
      }
      if (app.curAdj >= HIDDEN_APP_MIN_ADJ) {
        numHidden++;
        if (numHidden > MAX_HIDDEN_APPS) {
          Slog.i(TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str"+ numHidden+ "String_Node_Str"+ MAX_HIDDEN_APPS);
          EventLog.writeEvent(EventLogTags.AM_KILL,app.pid,app.processName,app.setAdj,"String_Node_Str");
          Process.killProcess(app.pid);
        }
      }
    }
 else {
      didOomAdj=false;
    }
  }
  return ENFORCE_PROCESS_LIMIT || mProcessLimit > 0 ? false : didOomAdj;
}

Fixed version (ground truth):
private final boolean updateOomAdjLocked(){
  boolean didOomAdj=true;
  final HistoryRecord TOP_ACT=resumedAppLocked();
  final ProcessRecord TOP_APP=TOP_ACT != null ? TOP_ACT.app : null;
  if (false) {
    RuntimeException e=new RuntimeException();
    e.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + TOP_ACT,e);
  }
  mAdjSeq++;
  int numSlots=HIDDEN_APP_MAX_ADJ - HIDDEN_APP_MIN_ADJ + 1;
  int factor=(mLruProcesses.size() - 4) / numSlots;
  if (factor < 1)   factor=1;
  int step=0;
  int numHidden=0;
  int i=mLruProcesses.size();
  int curHiddenAdj=HIDDEN_APP_MIN_ADJ;
  while (i > 0) {
    i--;
    ProcessRecord app=mLruProcesses.get(i);
    if (updateOomAdjLocked(app,curHiddenAdj,TOP_APP)) {
      if (curHiddenAdj < EMPTY_APP_ADJ && app.curAdj == curHiddenAdj) {
        step++;
        if (step >= factor) {
          step=0;
          curHiddenAdj++;
        }
      }
      if (app.curAdj >= HIDDEN_APP_MIN_ADJ) {
        if (!app.killedBackground) {
          numHidden++;
          if (numHidden > MAX_HIDDEN_APPS) {
            Slog.i(TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str"+ numHidden+ "String_Node_Str"+ MAX_HIDDEN_APPS);
            EventLog.writeEvent(EventLogTags.AM_KILL,app.pid,app.processName,app.setAdj,"String_Node_Str");
            app.killedBackground=true;
            Process.killProcess(app.pid);
          }
        }
      }
    }
 else {
      didOomAdj=false;
    }
  }
  return ENFORCE_PROCESS_LIMIT || mProcessLimit > 0 ? false : didOomAdj;
}
Program: 41698
Project: 41698
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));
  }
}