nus-yam/ex-repair huggingface dataset:
Program: 70
Project: 70
Buggy source:
public boolean performItemAction(MenuItem item,int flags){
  MenuItemImpl itemImpl=(MenuItemImpl)item;
  if (itemImpl == null || !itemImpl.isEnabled()) {
    return false;
  }
  boolean invoked=itemImpl.invoke();
  final ActionProvider provider=item.getActionProvider();
  final boolean providerHasSubMenu=provider != null && provider.hasSubMenu();
  if (itemImpl.hasCollapsibleActionView()) {
    invoked|=itemImpl.expandActionView();
    if (invoked)     close(true);
  }
 else   if (itemImpl.hasSubMenu() || providerHasSubMenu) {
    close(false);
    if (!itemImpl.hasSubMenu()) {
      itemImpl.setSubMenu(new SubMenuBuilder(getContext(),this,itemImpl));
    }
    final SubMenuBuilder subMenu=(SubMenuBuilder)itemImpl.getSubMenu();
    if (providerHasSubMenu) {
      provider.onPrepareSubMenu(subMenu);
    }
    invoked|=dispatchSubMenuSelected(subMenu);
    if (!invoked)     close(true);
  }
 else {
    if ((flags & FLAG_PERFORM_NO_CLOSE) == 0) {
      close(true);
    }
  }
  return invoked;
}

Fixed version (ground truth):
public boolean performItemAction(MenuItem item,MenuPresenter preferredPresenter,int flags){
  MenuItemImpl itemImpl=(MenuItemImpl)item;
  if (itemImpl == null || !itemImpl.isEnabled()) {
    return false;
  }
  boolean invoked=itemImpl.invoke();
  final ActionProvider provider=item.getActionProvider();
  final boolean providerHasSubMenu=provider != null && provider.hasSubMenu();
  if (itemImpl.hasCollapsibleActionView()) {
    invoked|=itemImpl.expandActionView();
    if (invoked)     close(true);
  }
 else   if (itemImpl.hasSubMenu() || providerHasSubMenu) {
    close(false);
    if (!itemImpl.hasSubMenu()) {
      itemImpl.setSubMenu(new SubMenuBuilder(getContext(),this,itemImpl));
    }
    final SubMenuBuilder subMenu=(SubMenuBuilder)itemImpl.getSubMenu();
    if (providerHasSubMenu) {
      provider.onPrepareSubMenu(subMenu);
    }
    invoked|=dispatchSubMenuSelected(subMenu,preferredPresenter);
    if (!invoked)     close(true);
  }
 else {
    if ((flags & FLAG_PERFORM_NO_CLOSE) == 0) {
      close(true);
    }
  }
  return invoked;
}
Program: 71
Project: 71
Buggy source:
void finishInstrumentationLocked(ProcessRecord app,int resultCode,Bundle results){
  if (app.instrumentationWatcher != null) {
    try {
      app.instrumentationWatcher.instrumentationFinished(app.instrumentationClass,resultCode,results);
    }
 catch (    RemoteException e) {
    }
  }
  if (app.instrumentationUiAutomationConnection != null) {
    try {
      app.instrumentationUiAutomationConnection.shutdown();
    }
 catch (    RemoteException re) {
    }
    mUserIsMonkey=false;
  }
  app.instrumentationWatcher=null;
  app.instrumentationUiAutomationConnection=null;
  app.instrumentationClass=null;
  app.instrumentationInfo=null;
  app.instrumentationProfileFile=null;
  app.instrumentationArguments=null;
  forceStopPackageLocked(app.info.packageName,-1,false,false,true,true,app.userId,"String_Node_Str");
}

Fixed version (ground truth):
void finishInstrumentationLocked(ProcessRecord app,int resultCode,Bundle results){
  if (app.instrumentationWatcher != null) {
    try {
      app.instrumentationWatcher.instrumentationFinished(app.instrumentationClass,resultCode,results);
    }
 catch (    RemoteException e) {
    }
  }
  if (app.instrumentationUiAutomationConnection != null) {
    try {
      app.instrumentationUiAutomationConnection.shutdown();
    }
 catch (    RemoteException re) {
    }
    mUserIsMonkey=false;
  }
  app.instrumentationWatcher=null;
  app.instrumentationUiAutomationConnection=null;
  app.instrumentationClass=null;
  app.instrumentationInfo=null;
  app.instrumentationProfileFile=null;
  app.instrumentationArguments=null;
  forceStopPackageLocked(app.info.packageName,-1,false,false,true,true,false,app.userId,"String_Node_Str");
}
Program: 73
Project: 73
Buggy source:
private void forceStopUserLocked(int userId,String reason){
  forceStopPackageLocked(null,-1,false,false,true,false,userId,reason);
  Intent intent=new Intent(Intent.ACTION_USER_STOPPED);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
  intent.putExtra(Intent.EXTRA_USER_HANDLE,userId);
  broadcastIntentLocked(null,null,intent,null,null,0,null,null,null,AppOpsManager.OP_NONE,false,false,MY_PID,Process.SYSTEM_UID,UserHandle.USER_ALL);
}

Fixed version (ground truth):
private void forceStopUserLocked(int userId,String reason){
  forceStopPackageLocked(null,-1,false,false,true,false,false,userId,reason);
  Intent intent=new Intent(Intent.ACTION_USER_STOPPED);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
  intent.putExtra(Intent.EXTRA_USER_HANDLE,userId);
  broadcastIntentLocked(null,null,intent,null,null,0,null,null,null,AppOpsManager.OP_NONE,false,false,MY_PID,Process.SYSTEM_UID,UserHandle.USER_ALL);
}
Program: 76
Project: 76
Buggy source:
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,false,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 78
Project: 78
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  mMenu.performItemAction(mAdapter.getItem(position),0);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  mMenu.performItemAction(mAdapter.getItem(position),this,0);
}
Program: 79
Project: 79
Buggy source:
private boolean dispatchSubMenuSelected(SubMenuBuilder subMenu){
  if (mPresenters.isEmpty())   return false;
  boolean result=false;
  for (  WeakReference<MenuPresenter> ref : mPresenters) {
    final MenuPresenter presenter=ref.get();
    if (presenter == null) {
      mPresenters.remove(ref);
    }
 else     if (!result) {
      result=presenter.onSubMenuSelected(subMenu);
    }
  }
  return result;
}

Fixed version (ground truth):
private boolean dispatchSubMenuSelected(SubMenuBuilder subMenu,MenuPresenter preferredPresenter){
  if (mPresenters.isEmpty())   return false;
  boolean result=false;
  if (preferredPresenter != null) {
    result=preferredPresenter.onSubMenuSelected(subMenu);
  }
  for (  WeakReference<MenuPresenter> ref : mPresenters) {
    final MenuPresenter presenter=ref.get();
    if (presenter == null) {
      mPresenters.remove(ref);
    }
 else     if (!result) {
      result=presenter.onSubMenuSelected(subMenu);
    }
  }
  return result;
}
Program: 80
Project: 80
Buggy source:
public boolean performItemAction(MenuItem item,int flags){
  MenuItemImpl itemImpl=(MenuItemImpl)item;
  if (itemImpl == null || !itemImpl.isEnabled()) {
    return false;
  }
  boolean invoked=itemImpl.invoke();
  final ActionProvider provider=item.getActionProvider();
  final boolean providerHasSubMenu=provider != null && provider.hasSubMenu();
  if (itemImpl.hasCollapsibleActionView()) {
    invoked|=itemImpl.expandActionView();
    if (invoked)     close(true);
  }
 else   if (itemImpl.hasSubMenu() || providerHasSubMenu) {
    close(false);
    if (!itemImpl.hasSubMenu()) {
      itemImpl.setSubMenu(new SubMenuBuilder(getContext(),this,itemImpl));
    }
    final SubMenuBuilder subMenu=(SubMenuBuilder)itemImpl.getSubMenu();
    if (providerHasSubMenu) {
      provider.onPrepareSubMenu(subMenu);
    }
    invoked|=dispatchSubMenuSelected(subMenu);
    if (!invoked)     close(true);
  }
 else {
    if ((flags & FLAG_PERFORM_NO_CLOSE) == 0) {
      close(true);
    }
  }
  return invoked;
}

Fixed version (ground truth):
public boolean performItemAction(MenuItem item,MenuPresenter preferredPresenter,int flags){
  MenuItemImpl itemImpl=(MenuItemImpl)item;
  if (itemImpl == null || !itemImpl.isEnabled()) {
    return false;
  }
  boolean invoked=itemImpl.invoke();
  final ActionProvider provider=item.getActionProvider();
  final boolean providerHasSubMenu=provider != null && provider.hasSubMenu();
  if (itemImpl.hasCollapsibleActionView()) {
    invoked|=itemImpl.expandActionView();
    if (invoked)     close(true);
  }
 else   if (itemImpl.hasSubMenu() || providerHasSubMenu) {
    close(false);
    if (!itemImpl.hasSubMenu()) {
      itemImpl.setSubMenu(new SubMenuBuilder(getContext(),this,itemImpl));
    }
    final SubMenuBuilder subMenu=(SubMenuBuilder)itemImpl.getSubMenu();
    if (providerHasSubMenu) {
      provider.onPrepareSubMenu(subMenu);
    }
    invoked|=dispatchSubMenuSelected(subMenu,preferredPresenter);
    if (!invoked)     close(true);
  }
 else {
    if ((flags & FLAG_PERFORM_NO_CLOSE) == 0) {
      close(true);
    }
  }
  return invoked;
}
Program: 81
Project: 81
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  mMenu.performItemAction(mAdapter.getItem(position),0);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  mMenu.performItemAction(mAdapter.getItem(position),this,0);
}
Program: 82
Project: 82
Buggy source:
private boolean dispatchSubMenuSelected(SubMenuBuilder subMenu){
  if (mPresenters.isEmpty())   return false;
  boolean result=false;
  for (  WeakReference<MenuPresenter> ref : mPresenters) {
    final MenuPresenter presenter=ref.get();
    if (presenter == null) {
      mPresenters.remove(ref);
    }
 else     if (!result) {
      result=presenter.onSubMenuSelected(subMenu);
    }
  }
  return result;
}

Fixed version (ground truth):
private boolean dispatchSubMenuSelected(SubMenuBuilder subMenu,MenuPresenter preferredPresenter){
  if (mPresenters.isEmpty())   return false;
  boolean result=false;
  if (preferredPresenter != null) {
    result=preferredPresenter.onSubMenuSelected(subMenu);
  }
  for (  WeakReference<MenuPresenter> ref : mPresenters) {
    final MenuPresenter presenter=ref.get();
    if (presenter == null) {
      mPresenters.remove(ref);
    }
 else     if (!result) {
      result=presenter.onSubMenuSelected(subMenu);
    }
  }
  return result;
}
Program: 83
Project: 83
Buggy source:
public boolean performItemAction(MenuItem item,int flags){
  MenuItemImpl itemImpl=(MenuItemImpl)item;
  if (itemImpl == null || !itemImpl.isEnabled()) {
    return false;
  }
  boolean invoked=itemImpl.invoke();
  final ActionProvider provider=item.getActionProvider();
  final boolean providerHasSubMenu=provider != null && provider.hasSubMenu();
  if (itemImpl.hasCollapsibleActionView()) {
    invoked|=itemImpl.expandActionView();
    if (invoked)     close(true);
  }
 else   if (itemImpl.hasSubMenu() || providerHasSubMenu) {
    close(false);
    if (!itemImpl.hasSubMenu()) {
      itemImpl.setSubMenu(new SubMenuBuilder(getContext(),this,itemImpl));
    }
    final SubMenuBuilder subMenu=(SubMenuBuilder)itemImpl.getSubMenu();
    if (providerHasSubMenu) {
      provider.onPrepareSubMenu(subMenu);
    }
    invoked|=dispatchSubMenuSelected(subMenu);
    if (!invoked)     close(true);
  }
 else {
    if ((flags & FLAG_PERFORM_NO_CLOSE) == 0) {
      close(true);
    }
  }
  return invoked;
}

Fixed version (ground truth):
public boolean performItemAction(MenuItem item,MenuPresenter preferredPresenter,int flags){
  MenuItemImpl itemImpl=(MenuItemImpl)item;
  if (itemImpl == null || !itemImpl.isEnabled()) {
    return false;
  }
  boolean invoked=itemImpl.invoke();
  final ActionProvider provider=item.getActionProvider();
  final boolean providerHasSubMenu=provider != null && provider.hasSubMenu();
  if (itemImpl.hasCollapsibleActionView()) {
    invoked|=itemImpl.expandActionView();
    if (invoked)     close(true);
  }
 else   if (itemImpl.hasSubMenu() || providerHasSubMenu) {
    close(false);
    if (!itemImpl.hasSubMenu()) {
      itemImpl.setSubMenu(new SubMenuBuilder(getContext(),this,itemImpl));
    }
    final SubMenuBuilder subMenu=(SubMenuBuilder)itemImpl.getSubMenu();
    if (providerHasSubMenu) {
      provider.onPrepareSubMenu(subMenu);
    }
    invoked|=dispatchSubMenuSelected(subMenu,preferredPresenter);
    if (!invoked)     close(true);
  }
 else {
    if ((flags & FLAG_PERFORM_NO_CLOSE) == 0) {
      close(true);
    }
  }
  return invoked;
}
Program: 84
Project: 84
Buggy source:
void finishInstrumentationLocked(ProcessRecord app,int resultCode,Bundle results){
  if (app.instrumentationWatcher != null) {
    try {
      app.instrumentationWatcher.instrumentationFinished(app.instrumentationClass,resultCode,results);
    }
 catch (    RemoteException e) {
    }
  }
  if (app.instrumentationUiAutomationConnection != null) {
    try {
      app.instrumentationUiAutomationConnection.shutdown();
    }
 catch (    RemoteException re) {
    }
    mUserIsMonkey=false;
  }
  app.instrumentationWatcher=null;
  app.instrumentationUiAutomationConnection=null;
  app.instrumentationClass=null;
  app.instrumentationInfo=null;
  app.instrumentationProfileFile=null;
  app.instrumentationArguments=null;
  forceStopPackageLocked(app.info.packageName,-1,false,false,true,true,app.userId,"String_Node_Str");
}

Fixed version (ground truth):
void finishInstrumentationLocked(ProcessRecord app,int resultCode,Bundle results){
  if (app.instrumentationWatcher != null) {
    try {
      app.instrumentationWatcher.instrumentationFinished(app.instrumentationClass,resultCode,results);
    }
 catch (    RemoteException e) {
    }
  }
  if (app.instrumentationUiAutomationConnection != null) {
    try {
      app.instrumentationUiAutomationConnection.shutdown();
    }
 catch (    RemoteException re) {
    }
    mUserIsMonkey=false;
  }
  app.instrumentationWatcher=null;
  app.instrumentationUiAutomationConnection=null;
  app.instrumentationClass=null;
  app.instrumentationInfo=null;
  app.instrumentationProfileFile=null;
  app.instrumentationArguments=null;
  forceStopPackageLocked(app.info.packageName,-1,false,false,true,true,false,app.userId,"String_Node_Str");
}
Program: 86
Project: 86
Buggy source:
private void forceStopUserLocked(int userId,String reason){
  forceStopPackageLocked(null,-1,false,false,true,false,userId,reason);
  Intent intent=new Intent(Intent.ACTION_USER_STOPPED);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
  intent.putExtra(Intent.EXTRA_USER_HANDLE,userId);
  broadcastIntentLocked(null,null,intent,null,null,0,null,null,null,AppOpsManager.OP_NONE,false,false,MY_PID,Process.SYSTEM_UID,UserHandle.USER_ALL);
}

Fixed version (ground truth):
private void forceStopUserLocked(int userId,String reason){
  forceStopPackageLocked(null,-1,false,false,true,false,false,userId,reason);
  Intent intent=new Intent(Intent.ACTION_USER_STOPPED);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
  intent.putExtra(Intent.EXTRA_USER_HANDLE,userId);
  broadcastIntentLocked(null,null,intent,null,null,0,null,null,null,AppOpsManager.OP_NONE,false,false,MY_PID,Process.SYSTEM_UID,UserHandle.USER_ALL);
}
Program: 89
Project: 89
Buggy source:
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,false,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 91
Project: 91
Buggy source:
private void updateMinScale(int w,int h,TileSource source,boolean resetScale){
synchronized (mLock) {
    if (resetScale) {
      mRenderer.scale=1;
    }
    if (source != null) {
      final float[] imageDims=getImageDims();
      final float imageWidth=imageDims[0];
      final float imageHeight=imageDims[1];
      mMinScale=Math.max(w / imageWidth,h / imageHeight);
      mRenderer.scale=Math.max(mMinScale,mRenderer.scale);
    }
  }
}

Fixed version (ground truth):
private void updateMinScale(int w,int h,TileSource source,boolean resetScale){
synchronized (mLock) {
    if (resetScale) {
      mRenderer.scale=1;
    }
    if (source != null) {
      final float[] imageDims=getImageDims();
      final float imageWidth=imageDims[0];
      final float imageHeight=imageDims[1];
      mMinScale=Math.max(w / imageWidth,h / imageHeight);
      mRenderer.scale=Math.max(mMinScale,resetScale ? Float.MIN_VALUE : mRenderer.scale);
    }
  }
}
Program: 93
Project: 93
Buggy source:
public void run(){
  int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
  int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
  wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
}

Fixed version (ground truth):
public void run(){
  updateWallpaperDimensions(outWidth,outHeight);
  if (finishActivityWhenDone) {
    setResult(Activity.RESULT_OK);
    finish();
  }
}
Program: 94
Project: 94
Buggy source:
static public void suggestWallpaperDimension(Resources res,final SharedPreferences sharedPrefs,WindowManager windowManager,final WallpaperManager wallpaperManager){
  final Point defaultWallpaperSize=getDefaultWallpaperSize(res,windowManager);
  new Thread("String_Node_Str"){
    public void run(){
      int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
      int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
      wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
    }
  }
.start();
}

Fixed version (ground truth):
static public void suggestWallpaperDimension(Resources res,final SharedPreferences sharedPrefs,WindowManager windowManager,final WallpaperManager wallpaperManager){
  final Point defaultWallpaperSize=getDefaultWallpaperSize(res,windowManager);
  new AsyncTask<Void,Void,Void>(){
    public Void doInBackground(    Void... args){
      int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
      int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
      wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
      return null;
    }
  }
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,(Void)null);
}
Program: 95
Project: 95
Buggy source:
@Override protected Boolean doInBackground(Void... params){
  return cropBitmap();
}

Fixed version (ground truth):
public Void doInBackground(Void... args){
  int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
  int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
  wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
  return null;
}
Program: 96
Project: 96
Buggy source:
void finishInstrumentationLocked(ProcessRecord app,int resultCode,Bundle results){
  if (app.instrumentationWatcher != null) {
    try {
      app.instrumentationWatcher.instrumentationFinished(app.instrumentationClass,resultCode,results);
    }
 catch (    RemoteException e) {
    }
  }
  if (app.instrumentationUiAutomationConnection != null) {
    try {
      app.instrumentationUiAutomationConnection.shutdown();
    }
 catch (    RemoteException re) {
    }
    mUserIsMonkey=false;
  }
  app.instrumentationWatcher=null;
  app.instrumentationUiAutomationConnection=null;
  app.instrumentationClass=null;
  app.instrumentationInfo=null;
  app.instrumentationProfileFile=null;
  app.instrumentationArguments=null;
  forceStopPackageLocked(app.info.packageName,-1,false,false,true,true,app.userId,"String_Node_Str");
}

Fixed version (ground truth):
void finishInstrumentationLocked(ProcessRecord app,int resultCode,Bundle results){
  if (app.instrumentationWatcher != null) {
    try {
      app.instrumentationWatcher.instrumentationFinished(app.instrumentationClass,resultCode,results);
    }
 catch (    RemoteException e) {
    }
  }
  if (app.instrumentationUiAutomationConnection != null) {
    try {
      app.instrumentationUiAutomationConnection.shutdown();
    }
 catch (    RemoteException re) {
    }
    mUserIsMonkey=false;
  }
  app.instrumentationWatcher=null;
  app.instrumentationUiAutomationConnection=null;
  app.instrumentationClass=null;
  app.instrumentationInfo=null;
  app.instrumentationProfileFile=null;
  app.instrumentationArguments=null;
  forceStopPackageLocked(app.info.packageName,-1,false,false,true,true,false,app.userId,"String_Node_Str");
}
Program: 98
Project: 98
Buggy source:
private void forceStopUserLocked(int userId,String reason){
  forceStopPackageLocked(null,-1,false,false,true,false,userId,reason);
  Intent intent=new Intent(Intent.ACTION_USER_STOPPED);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
  intent.putExtra(Intent.EXTRA_USER_HANDLE,userId);
  broadcastIntentLocked(null,null,intent,null,null,0,null,null,null,AppOpsManager.OP_NONE,false,false,MY_PID,Process.SYSTEM_UID,UserHandle.USER_ALL);
}

Fixed version (ground truth):
private void forceStopUserLocked(int userId,String reason){
  forceStopPackageLocked(null,-1,false,false,true,false,false,userId,reason);
  Intent intent=new Intent(Intent.ACTION_USER_STOPPED);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
  intent.putExtra(Intent.EXTRA_USER_HANDLE,userId);
  broadcastIntentLocked(null,null,intent,null,null,0,null,null,null,AppOpsManager.OP_NONE,false,false,MY_PID,Process.SYSTEM_UID,UserHandle.USER_ALL);
}
Program: 101
Project: 101
Buggy source:
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,false,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 104
Project: 104
Buggy source:
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        service.app.services.remove(service);
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}

Fixed version (ground truth):
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        if (!service.app.persistent) {
          service.app.services.remove(service);
        }
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}
Program: 106
Project: 106
Buggy source:
/** 
 * <p>Removes the specified Runnable from the message queue.</p>
 * @param action The Runnable to remove from the message handling queue
 * @return true if this view could ask the Handler to remove the Runnable,false otherwise. When the returned value is true, the Runnable may or may not have been actually removed from the message queue (for instance, if the Runnable was not in the queue already.)
 * @see #post
 * @see #postDelayed
 * @see #postOnAnimation
 * @see #postOnAnimationDelayed
 */
public boolean removeCallbacks(Runnable action){
  if (action != null) {
    final AttachInfo attachInfo=mAttachInfo;
    if (attachInfo != null) {
      attachInfo.mHandler.removeCallbacks(action);
      attachInfo.mViewRootImpl.mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION,action,null);
    }
 else {
      ViewRootImpl.getRunQueue().removeCallbacks(action);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * <p>Removes the specified Runnable from the message queue.</p>
 * @param action The Runnable to remove from the message handling queue
 * @return true if this view could ask the Handler to remove the Runnable,false otherwise. When the returned value is true, the Runnable may or may not have been actually removed from the message queue (for instance, if the Runnable was not in the queue already.)
 * @see #post
 * @see #postDelayed
 * @see #postOnAnimation
 * @see #postOnAnimationDelayed
 */
public boolean removeCallbacks(Runnable action){
  if (action != null) {
    final AttachInfo attachInfo=mAttachInfo;
    if (attachInfo != null) {
      attachInfo.mHandler.removeCallbacks(action);
      attachInfo.mViewRootImpl.mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION,action,null);
    }
    ViewRootImpl.getRunQueue().removeCallbacks(action);
  }
  return true;
}
Program: 107
Project: 107
Buggy source:
@Override public void unscheduleSelf(Runnable what){
  mCurFrame=-1;
  super.unscheduleSelf(what);
}

Fixed version (ground truth):
@Override public void unscheduleSelf(Runnable what){
  mCurFrame=-1;
  mAnimating=false;
  super.unscheduleSelf(what);
}
Program: 108
Project: 108
Buggy source:
/** 
 * <p>Indicates whether the animation is currently running or not.</p>
 * @return true if the animation is running, false otherwise
 */
public boolean isRunning(){
  return mCurFrame > -1;
}

Fixed version (ground truth):
/** 
 * <p>Indicates whether the animation is currently running or not.</p>
 * @return true if the animation is running, false otherwise
 */
public boolean isRunning(){
  return mAnimating;
}
Program: 109
Project: 109
Buggy source:
private void setFrame(int frame,boolean unschedule,boolean animate){
  if (frame >= mAnimationState.getChildCount()) {
    return;
  }
  mCurFrame=frame;
  selectDrawable(frame);
  if (unschedule) {
    unscheduleSelf(this);
  }
  if (animate) {
    mCurFrame=frame;
    scheduleSelf(this,SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]);
  }
}

Fixed version (ground truth):
private void setFrame(int frame,boolean unschedule,boolean animate){
  if (frame >= mAnimationState.getChildCount()) {
    return;
  }
  mCurFrame=frame;
  selectDrawable(frame);
  if (unschedule || animate) {
    unscheduleSelf(this);
  }
  if (animate) {
    mCurFrame=frame;
    mAnimating=true;
    scheduleSelf(this,SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]);
  }
}
Program: 110
Project: 110
Buggy source:
private void updateAnim(){
  Drawable drawable=mAttached ? getDrawable() : null;
  if (mAttached && mAnim != null) {
    mAnim.stop();
  }
  if (drawable instanceof AnimationDrawable) {
    mAnim=(AnimationDrawable)drawable;
    if (isShown()) {
      mAnim.start();
    }
  }
 else {
    mAnim=null;
  }
}

Fixed version (ground truth):
private void updateAnim(){
  Drawable drawable=getDrawable();
  if (mAttached && mAnim != null) {
    mAnim.stop();
  }
  if (drawable instanceof AnimationDrawable) {
    mAnim=(AnimationDrawable)drawable;
    if (isShown()) {
      mAnim.start();
    }
  }
 else {
    mAnim=null;
  }
}
Program: 112
Project: 112
Buggy source:
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        service.app.services.remove(service);
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}

Fixed version (ground truth):
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        if (!service.app.persistent) {
          service.app.services.remove(service);
        }
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}
Program: 115
Project: 115
Buggy source:
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        service.app.services.remove(service);
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}

Fixed version (ground truth):
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        if (!service.app.persistent) {
          service.app.services.remove(service);
        }
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}
Program: 118
Project: 118
Buggy source:
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        service.app.services.remove(service);
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}

Fixed version (ground truth):
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        if (!service.app.persistent) {
          service.app.services.remove(service);
        }
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}
Program: 121
Project: 121
Buggy source:
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        service.app.services.remove(service);
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}

Fixed version (ground truth):
private boolean collectForceStopServicesLocked(String name,int userId,boolean evenPersistent,boolean doit,ArrayMap<ComponentName,ServiceRecord> services,ArrayList<ServiceRecord> result){
  boolean didSomething=false;
  for (int i=0; i < services.size(); i++) {
    ServiceRecord service=services.valueAt(i);
    if ((name == null || service.packageName.equals(name)) && (service.app == null || evenPersistent || !service.app.persistent)) {
      if (!doit) {
        return true;
      }
      didSomething=true;
      Slog.i(TAG,"String_Node_Str" + service);
      if (service.app != null) {
        service.app.removed=true;
        if (!service.app.persistent) {
          service.app.services.remove(service);
        }
      }
      service.app=null;
      service.isolatedProc=null;
      result.add(service);
    }
  }
  return didSomething;
}
Program: 123
Project: 123
Buggy source:
/** 
 * <p>Removes the specified Runnable from the message queue.</p>
 * @param action The Runnable to remove from the message handling queue
 * @return true if this view could ask the Handler to remove the Runnable,false otherwise. When the returned value is true, the Runnable may or may not have been actually removed from the message queue (for instance, if the Runnable was not in the queue already.)
 * @see #post
 * @see #postDelayed
 * @see #postOnAnimation
 * @see #postOnAnimationDelayed
 */
public boolean removeCallbacks(Runnable action){
  if (action != null) {
    final AttachInfo attachInfo=mAttachInfo;
    if (attachInfo != null) {
      attachInfo.mHandler.removeCallbacks(action);
      attachInfo.mViewRootImpl.mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION,action,null);
    }
 else {
      ViewRootImpl.getRunQueue().removeCallbacks(action);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * <p>Removes the specified Runnable from the message queue.</p>
 * @param action The Runnable to remove from the message handling queue
 * @return true if this view could ask the Handler to remove the Runnable,false otherwise. When the returned value is true, the Runnable may or may not have been actually removed from the message queue (for instance, if the Runnable was not in the queue already.)
 * @see #post
 * @see #postDelayed
 * @see #postOnAnimation
 * @see #postOnAnimationDelayed
 */
public boolean removeCallbacks(Runnable action){
  if (action != null) {
    final AttachInfo attachInfo=mAttachInfo;
    if (attachInfo != null) {
      attachInfo.mHandler.removeCallbacks(action);
      attachInfo.mViewRootImpl.mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION,action,null);
    }
    ViewRootImpl.getRunQueue().removeCallbacks(action);
  }
  return true;
}
Program: 124
Project: 124
Buggy source:
@Override public void unscheduleSelf(Runnable what){
  mCurFrame=-1;
  super.unscheduleSelf(what);
}

Fixed version (ground truth):
@Override public void unscheduleSelf(Runnable what){
  mCurFrame=-1;
  mAnimating=false;
  super.unscheduleSelf(what);
}
Program: 125
Project: 125
Buggy source:
/** 
 * <p>Indicates whether the animation is currently running or not.</p>
 * @return true if the animation is running, false otherwise
 */
public boolean isRunning(){
  return mCurFrame > -1;
}

Fixed version (ground truth):
/** 
 * <p>Indicates whether the animation is currently running or not.</p>
 * @return true if the animation is running, false otherwise
 */
public boolean isRunning(){
  return mAnimating;
}
Program: 126
Project: 126
Buggy source:
private void setFrame(int frame,boolean unschedule,boolean animate){
  if (frame >= mAnimationState.getChildCount()) {
    return;
  }
  mCurFrame=frame;
  selectDrawable(frame);
  if (unschedule) {
    unscheduleSelf(this);
  }
  if (animate) {
    mCurFrame=frame;
    scheduleSelf(this,SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]);
  }
}

Fixed version (ground truth):
private void setFrame(int frame,boolean unschedule,boolean animate){
  if (frame >= mAnimationState.getChildCount()) {
    return;
  }
  mCurFrame=frame;
  selectDrawable(frame);
  if (unschedule || animate) {
    unscheduleSelf(this);
  }
  if (animate) {
    mCurFrame=frame;
    mAnimating=true;
    scheduleSelf(this,SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]);
  }
}
Program: 127
Project: 127
Buggy source:
private void updateAnim(){
  Drawable drawable=mAttached ? getDrawable() : null;
  if (mAttached && mAnim != null) {
    mAnim.stop();
  }
  if (drawable instanceof AnimationDrawable) {
    mAnim=(AnimationDrawable)drawable;
    if (isShown()) {
      mAnim.start();
    }
  }
 else {
    mAnim=null;
  }
}

Fixed version (ground truth):
private void updateAnim(){
  Drawable drawable=getDrawable();
  if (mAttached && mAnim != null) {
    mAnim.stop();
  }
  if (drawable instanceof AnimationDrawable) {
    mAnim=(AnimationDrawable)drawable;
    if (isShown()) {
      mAnim.start();
    }
  }
 else {
    mAnim=null;
  }
}
Program: 128
Project: 128
Buggy source:
/** 
 * <p>Removes the specified Runnable from the message queue.</p>
 * @param action The Runnable to remove from the message handling queue
 * @return true if this view could ask the Handler to remove the Runnable,false otherwise. When the returned value is true, the Runnable may or may not have been actually removed from the message queue (for instance, if the Runnable was not in the queue already.)
 * @see #post
 * @see #postDelayed
 * @see #postOnAnimation
 * @see #postOnAnimationDelayed
 */
public boolean removeCallbacks(Runnable action){
  if (action != null) {
    final AttachInfo attachInfo=mAttachInfo;
    if (attachInfo != null) {
      attachInfo.mHandler.removeCallbacks(action);
      attachInfo.mViewRootImpl.mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION,action,null);
    }
 else {
      ViewRootImpl.getRunQueue().removeCallbacks(action);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * <p>Removes the specified Runnable from the message queue.</p>
 * @param action The Runnable to remove from the message handling queue
 * @return true if this view could ask the Handler to remove the Runnable,false otherwise. When the returned value is true, the Runnable may or may not have been actually removed from the message queue (for instance, if the Runnable was not in the queue already.)
 * @see #post
 * @see #postDelayed
 * @see #postOnAnimation
 * @see #postOnAnimationDelayed
 */
public boolean removeCallbacks(Runnable action){
  if (action != null) {
    final AttachInfo attachInfo=mAttachInfo;
    if (attachInfo != null) {
      attachInfo.mHandler.removeCallbacks(action);
      attachInfo.mViewRootImpl.mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION,action,null);
    }
    ViewRootImpl.getRunQueue().removeCallbacks(action);
  }
  return true;
}
Program: 129
Project: 129
Buggy source:
@Override public void unscheduleSelf(Runnable what){
  mCurFrame=-1;
  super.unscheduleSelf(what);
}

Fixed version (ground truth):
@Override public void unscheduleSelf(Runnable what){
  mCurFrame=-1;
  mAnimating=false;
  super.unscheduleSelf(what);
}
Program: 130
Project: 130
Buggy source:
/** 
 * <p>Indicates whether the animation is currently running or not.</p>
 * @return true if the animation is running, false otherwise
 */
public boolean isRunning(){
  return mCurFrame > -1;
}

Fixed version (ground truth):
/** 
 * <p>Indicates whether the animation is currently running or not.</p>
 * @return true if the animation is running, false otherwise
 */
public boolean isRunning(){
  return mAnimating;
}
Program: 131
Project: 131
Buggy source:
private void setFrame(int frame,boolean unschedule,boolean animate){
  if (frame >= mAnimationState.getChildCount()) {
    return;
  }
  mCurFrame=frame;
  selectDrawable(frame);
  if (unschedule) {
    unscheduleSelf(this);
  }
  if (animate) {
    mCurFrame=frame;
    scheduleSelf(this,SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]);
  }
}

Fixed version (ground truth):
private void setFrame(int frame,boolean unschedule,boolean animate){
  if (frame >= mAnimationState.getChildCount()) {
    return;
  }
  mCurFrame=frame;
  selectDrawable(frame);
  if (unschedule || animate) {
    unscheduleSelf(this);
  }
  if (animate) {
    mCurFrame=frame;
    mAnimating=true;
    scheduleSelf(this,SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]);
  }
}
Program: 132
Project: 132
Buggy source:
private void updateAnim(){
  Drawable drawable=mAttached ? getDrawable() : null;
  if (mAttached && mAnim != null) {
    mAnim.stop();
  }
  if (drawable instanceof AnimationDrawable) {
    mAnim=(AnimationDrawable)drawable;
    if (isShown()) {
      mAnim.start();
    }
  }
 else {
    mAnim=null;
  }
}

Fixed version (ground truth):
private void updateAnim(){
  Drawable drawable=getDrawable();
  if (mAttached && mAnim != null) {
    mAnim.stop();
  }
  if (drawable instanceof AnimationDrawable) {
    mAnim=(AnimationDrawable)drawable;
    if (isShown()) {
      mAnim.start();
    }
  }
 else {
    mAnim=null;
  }
}