nus-yam/ex-repair huggingface dataset:
Program: 2464
Project: 2464
Buggy source:
public void forceStopPackage(final String packageName,int userId){
  if (checkCallingPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) != PackageManager.PERMISSION_GRANTED) {
    String msg="String_Node_Str" + Binder.getCallingPid() + "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ android.Manifest.permission.FORCE_STOP_PACKAGES;
    Slog.w(TAG,msg);
    throw new SecurityException(msg);
  }
  userId=handleIncomingUser(Binder.getCallingPid(),Binder.getCallingUid(),userId,true,true,"String_Node_Str",null);
  long callingId=Binder.clearCallingIdentity();
  try {
    IPackageManager pm=AppGlobals.getPackageManager();
synchronized (this) {
      int[] users=userId == UserHandle.USER_ALL ? getUsersLocked() : new int[]{userId};
      for (      int user : users) {
        int pkgUid=-1;
        try {
          pkgUid=pm.getPackageUid(packageName,user);
        }
 catch (        RemoteException e) {
        }
        if (pkgUid == -1) {
          Slog.w(TAG,"String_Node_Str" + packageName);
          continue;
        }
        try {
          pm.setPackageStoppedState(packageName,true,user);
        }
 catch (        RemoteException e) {
        }
catch (        IllegalArgumentException e) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ e);
        }
        if (isUserRunningLocked(user,false)) {
          forceStopPackageLocked(packageName,pkgUid);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(callingId);
  }
}

Fixed version (ground truth):
@Override public void forceStopPackage(final String packageName,int userId){
  if (checkCallingPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) != PackageManager.PERMISSION_GRANTED) {
    String msg="String_Node_Str" + Binder.getCallingPid() + "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ android.Manifest.permission.FORCE_STOP_PACKAGES;
    Slog.w(TAG,msg);
    throw new SecurityException(msg);
  }
  userId=handleIncomingUser(Binder.getCallingPid(),Binder.getCallingUid(),userId,true,true,"String_Node_Str",null);
  long callingId=Binder.clearCallingIdentity();
  try {
    IPackageManager pm=AppGlobals.getPackageManager();
synchronized (this) {
      int[] users=userId == UserHandle.USER_ALL ? getUsersLocked() : new int[]{userId};
      for (      int user : users) {
        int pkgUid=-1;
        try {
          pkgUid=pm.getPackageUid(packageName,user);
        }
 catch (        RemoteException e) {
        }
        if (pkgUid == -1) {
          Slog.w(TAG,"String_Node_Str" + packageName);
          continue;
        }
        try {
          pm.setPackageStoppedState(packageName,true,user);
        }
 catch (        RemoteException e) {
        }
catch (        IllegalArgumentException e) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ e);
        }
        if (isUserRunningLocked(user,false)) {
          forceStopPackageLocked(packageName,pkgUid);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(callingId);
  }
}
Program: 2465
Project: 2465
Buggy source:
public void killApplicationWithAppId(String pkg,int appid){
  if (pkg == null) {
    return;
  }
  if (appid < 0) {
    Slog.w(TAG,"String_Node_Str" + pkg);
    return;
  }
  int callerUid=Binder.getCallingUid();
  if (callerUid == Process.SYSTEM_UID) {
    Message msg=mHandler.obtainMessage(KILL_APPLICATION_MSG);
    msg.arg1=appid;
    msg.arg2=0;
    msg.obj=pkg;
    mHandler.sendMessage(msg);
  }
 else {
    throw new SecurityException(callerUid + "String_Node_Str" + pkg);
  }
}

Fixed version (ground truth):
@Override public void killApplicationWithAppId(String pkg,int appid){
  if (pkg == null) {
    return;
  }
  if (appid < 0) {
    Slog.w(TAG,"String_Node_Str" + pkg);
    return;
  }
  int callerUid=Binder.getCallingUid();
  if (callerUid == Process.SYSTEM_UID) {
    Message msg=mHandler.obtainMessage(KILL_APPLICATION_MSG);
    msg.arg1=appid;
    msg.arg2=0;
    msg.obj=pkg;
    mHandler.sendMessage(msg);
  }
 else {
    throw new SecurityException(callerUid + "String_Node_Str" + pkg);
  }
}
Program: 2467
Project: 2467
Buggy source:
void resumeTopActivityLocked(){
  final int start, end;
  if (isHomeStackMain()) {
    start=0;
    end=1;
  }
 else {
    start=1;
    end=mStacks.size();
  }
  for (int stackNdx=start; stackNdx < end; ++stackNdx) {
    mStacks.get(stackNdx).resumeTopActivityLocked(null);
  }
}

Fixed version (ground truth):
void resumeTopActivityLocked(){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    mStacks.get(stackNdx).resumeTopActivityLocked(null);
  }
}
Program: 2468
Project: 2468
Buggy source:
boolean allResumedActivitiesIdle(){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    if (mStacks.get(stackNdx).mResumedActivity == null || !mStacks.get(stackNdx).mResumedActivity.idle) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
boolean allResumedActivitiesIdle(){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    final ActivityRecord resumedActivity=mStacks.get(stackNdx).mResumedActivity;
    if (resumedActivity == null || !resumedActivity.idle) {
      return false;
    }
  }
  return true;
}
Program: 2469
Project: 2469
Buggy source:
/** 
 * Creates a new worker thread and saves the screenshot to the media store.
 */
private void saveScreenshotInWorkerThread(Runnable finisher){
  Log.d(TAG,"String_Node_Str");
  SaveImageInBackgroundData data=new SaveImageInBackgroundData();
  data.context=mContext;
  data.image=mScreenBitmap;
  data.iconSize=mNotificationIconSize;
  data.finisher=finisher;
  if (mSaveInBgTask != null) {
    mSaveInBgTask.cancel(false);
    Log.d(TAG,"String_Node_Str");
  }
  mSaveInBgTask=new SaveImageInBackgroundTask(mContext,data,mNotificationManager,SCREENSHOT_NOTIFICATION_ID).execute(data);
}

Fixed version (ground truth):
/** 
 * Creates a new worker thread and saves the screenshot to the media store.
 */
private void saveScreenshotInWorkerThread(Runnable finisher){
  SaveImageInBackgroundData data=new SaveImageInBackgroundData();
  data.context=mContext;
  data.image=mScreenBitmap;
  data.iconSize=mNotificationIconSize;
  data.finisher=finisher;
  if (mSaveInBgTask != null) {
    mSaveInBgTask.cancel(false);
  }
  mSaveInBgTask=new SaveImageInBackgroundTask(mContext,data,mNotificationManager,SCREENSHOT_NOTIFICATION_ID).execute(data);
}
Program: 2470
Project: 2470
Buggy source:
static void notifyScreenshotError(Context context,NotificationManager nManager){
  Log.d(TAG,"String_Node_Str");
  Resources r=context.getResources();
  Notification.Builder b=new Notification.Builder(context).setTicker(r.getString(R.string.screenshot_failed_title)).setContentTitle(r.getString(R.string.screenshot_failed_title)).setContentText(r.getString(R.string.screenshot_failed_text)).setSmallIcon(R.drawable.stat_notify_image_error).setWhen(System.currentTimeMillis()).setAutoCancel(true);
  Notification n=new Notification.BigTextStyle(b).bigText(r.getString(R.string.screenshot_failed_text)).build();
  nManager.notify(SCREENSHOT_NOTIFICATION_ID,n);
}

Fixed version (ground truth):
static void notifyScreenshotError(Context context,NotificationManager nManager){
  Resources r=context.getResources();
  Notification.Builder b=new Notification.Builder(context).setTicker(r.getString(R.string.screenshot_failed_title)).setContentTitle(r.getString(R.string.screenshot_failed_title)).setContentText(r.getString(R.string.screenshot_failed_text)).setSmallIcon(R.drawable.stat_notify_image_error).setWhen(System.currentTimeMillis()).setAutoCancel(true);
  Notification n=new Notification.BigTextStyle(b).bigText(r.getString(R.string.screenshot_failed_text)).build();
  nManager.notify(SCREENSHOT_NOTIFICATION_ID,n);
}
Program: 2471
Project: 2471
Buggy source:
@Override public void run(){
  mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
  mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  mScreenshotView.buildLayer();
  mScreenshotAnimation.start();
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
  mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  mScreenshotView.buildLayer();
  mScreenshotAnimation.start();
}
Program: 2473
Project: 2473
Buggy source:
/** 
 * Starts the animation after taking the screenshot
 */
private void startAnimation(final Runnable finisher,int w,int h,boolean statusBarVisible,boolean navBarVisible){
  Log.d(TAG,"String_Node_Str");
  mScreenshotView.setImageBitmap(mScreenBitmap);
  mScreenshotLayout.requestFocus();
  if (mScreenshotAnimation != null) {
    mScreenshotAnimation.end();
    mScreenshotAnimation.removeAllListeners();
    Log.d(TAG,"String_Node_Str");
  }
  mWindowManager.addView(mScreenshotLayout,mWindowLayoutParams);
  Log.d(TAG,"String_Node_Str");
  ValueAnimator screenshotDropInAnim=createScreenshotDropInAnimation();
  ValueAnimator screenshotFadeOutAnim=createScreenshotDropOutAnimation(w,h,statusBarVisible,navBarVisible);
  mScreenshotAnimation=new AnimatorSet();
  mScreenshotAnimation.playSequentially(screenshotDropInAnim,screenshotFadeOutAnim);
  mScreenshotAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      saveScreenshotInWorkerThread(finisher);
      mWindowManager.removeView(mScreenshotLayout);
      mScreenBitmap=null;
      mScreenshotView.setImageBitmap(null);
      Log.d(TAG,"String_Node_Str");
    }
  }
);
  mScreenshotLayout.post(new Runnable(){
    @Override public void run(){
      mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
      mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
      mScreenshotView.buildLayer();
      mScreenshotAnimation.start();
      Log.d(TAG,"String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Starts the animation after taking the screenshot
 */
private void startAnimation(final Runnable finisher,int w,int h,boolean statusBarVisible,boolean navBarVisible){
  mScreenshotView.setImageBitmap(mScreenBitmap);
  mScreenshotLayout.requestFocus();
  if (mScreenshotAnimation != null) {
    mScreenshotAnimation.end();
    mScreenshotAnimation.removeAllListeners();
  }
  mWindowManager.addView(mScreenshotLayout,mWindowLayoutParams);
  ValueAnimator screenshotDropInAnim=createScreenshotDropInAnimation();
  ValueAnimator screenshotFadeOutAnim=createScreenshotDropOutAnimation(w,h,statusBarVisible,navBarVisible);
  mScreenshotAnimation=new AnimatorSet();
  mScreenshotAnimation.playSequentially(screenshotDropInAnim,screenshotFadeOutAnim);
  mScreenshotAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      saveScreenshotInWorkerThread(finisher);
      mWindowManager.removeView(mScreenshotLayout);
      mScreenBitmap=null;
      mScreenshotView.setImageBitmap(null);
    }
  }
);
  mScreenshotLayout.post(new Runnable(){
    @Override public void run(){
      mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
      mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
      mScreenshotView.buildLayer();
      mScreenshotAnimation.start();
    }
  }
);
}
Program: 2475
Project: 2475
Buggy source:
/** 
 * Takes a screenshot of the current display and shows an animation.
 */
void takeScreenshot(Runnable finisher,boolean statusBarVisible,boolean navBarVisible){
  Log.d(TAG,"String_Node_Str");
  mDisplay.getRealMetrics(mDisplayMetrics);
  float[] dims={mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels};
  float degrees=getDegreesForRotation(mDisplay.getRotation());
  boolean requiresRotation=(degrees > 0);
  if (requiresRotation) {
    mDisplayMatrix.reset();
    mDisplayMatrix.preRotate(-degrees);
    mDisplayMatrix.mapPoints(dims);
    dims[0]=Math.abs(dims[0]);
    dims[1]=Math.abs(dims[1]);
    Log.d(TAG,"String_Node_Str");
  }
  mScreenBitmap=SurfaceControl.screenshot((int)dims[0],(int)dims[1]);
  if (mScreenBitmap == null) {
    notifyScreenshotError(mContext,mNotificationManager);
    finisher.run();
    Log.d(TAG,"String_Node_Str");
    return;
  }
  if (requiresRotation) {
    Bitmap ss=Bitmap.createBitmap(mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(ss);
    c.translate(ss.getWidth() / 2,ss.getHeight() / 2);
    c.rotate(degrees);
    c.translate(-dims[0] / 2,-dims[1] / 2);
    c.drawBitmap(mScreenBitmap,0,0,null);
    c.setBitmap(null);
    mScreenBitmap.recycle();
    mScreenBitmap=ss;
    Log.d(TAG,"String_Node_Str");
  }
  mScreenBitmap.setHasAlpha(false);
  mScreenBitmap.prepareToDraw();
  startAnimation(finisher,mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,statusBarVisible,navBarVisible);
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Takes a screenshot of the current display and shows an animation.
 */
void takeScreenshot(Runnable finisher,boolean statusBarVisible,boolean navBarVisible){
  mDisplay.getRealMetrics(mDisplayMetrics);
  float[] dims={mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels};
  float degrees=getDegreesForRotation(mDisplay.getRotation());
  boolean requiresRotation=(degrees > 0);
  if (requiresRotation) {
    mDisplayMatrix.reset();
    mDisplayMatrix.preRotate(-degrees);
    mDisplayMatrix.mapPoints(dims);
    dims[0]=Math.abs(dims[0]);
    dims[1]=Math.abs(dims[1]);
  }
  mScreenBitmap=SurfaceControl.screenshot((int)dims[0],(int)dims[1]);
  if (mScreenBitmap == null) {
    notifyScreenshotError(mContext,mNotificationManager);
    finisher.run();
    return;
  }
  if (requiresRotation) {
    Bitmap ss=Bitmap.createBitmap(mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(ss);
    c.translate(ss.getWidth() / 2,ss.getHeight() / 2);
    c.rotate(degrees);
    c.translate(-dims[0] / 2,-dims[1] / 2);
    c.drawBitmap(mScreenBitmap,0,0,null);
    c.setBitmap(null);
    mScreenBitmap.recycle();
    mScreenBitmap=ss;
  }
  mScreenBitmap.setHasAlpha(false);
  mScreenBitmap.prepareToDraw();
  startAnimation(finisher,mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,statusBarVisible,navBarVisible);
}
Program: 2476
Project: 2476
Buggy source:
void clearImage(){
  context=null;
  image=null;
  imageUri=null;
  iconSize=0;
}

Fixed version (ground truth):
void clearImage(){
  image=null;
  imageUri=null;
  iconSize=0;
}
Program: 2478
Project: 2478
Buggy source:
@Override protected void onPostExecute(SaveImageInBackgroundData params){
  if (isCancelled()) {
    params.finisher.run();
    params.clearImage();
    Log.d(TAG,"String_Node_Str");
    return;
  }
  if (params.result > 0) {
    GlobalScreenshot.notifyScreenshotError(params.context,mNotificationManager);
  }
 else {
    Resources r=params.context.getResources();
    Intent launchIntent=new Intent(Intent.ACTION_VIEW);
    launchIntent.setDataAndType(params.imageUri,"String_Node_Str");
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.setContentTitle(r.getString(R.string.screenshot_saved_title)).setContentText(r.getString(R.string.screenshot_saved_text)).setContentIntent(PendingIntent.getActivity(params.context,0,launchIntent,0)).setWhen(System.currentTimeMillis()).setAutoCancel(true);
    Notification n=mNotificationBuilder.build();
    n.flags&=~Notification.FLAG_NO_CLEAR;
    mNotificationManager.notify(mNotificationId,n);
  }
  params.finisher.run();
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override protected void onPostExecute(SaveImageInBackgroundData params){
  if (isCancelled()) {
    params.finisher.run();
    params.clearImage();
    params.clearContext();
    return;
  }
  if (params.result > 0) {
    GlobalScreenshot.notifyScreenshotError(params.context,mNotificationManager);
  }
 else {
    Resources r=params.context.getResources();
    Intent launchIntent=new Intent(Intent.ACTION_VIEW);
    launchIntent.setDataAndType(params.imageUri,"String_Node_Str");
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.setContentTitle(r.getString(R.string.screenshot_saved_title)).setContentText(r.getString(R.string.screenshot_saved_text)).setContentIntent(PendingIntent.getActivity(params.context,0,launchIntent,0)).setWhen(System.currentTimeMillis()).setAutoCancel(true);
    Notification n=mNotificationBuilder.build();
    n.flags&=~Notification.FLAG_NO_CLEAR;
    mNotificationManager.notify(mNotificationId,n);
  }
  params.finisher.run();
  params.clearContext();
}
Program: 2479
Project: 2479
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case 1:
    final Messenger callback=msg.replyTo;
  if (mScreenshot == null) {
    mScreenshot=new GlobalScreenshot(TakeScreenshotService.this);
    Log.d(TAG,"String_Node_Str");
  }
Log.d(TAG,"String_Node_Str");
mScreenshot.takeScreenshot(new Runnable(){
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
    Log.d(TAG,"String_Node_Str");
  }
 catch (  RemoteException e) {
  }
}
}
,msg.arg1 > 0,msg.arg2 > 0);
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case 1:
    final Messenger callback=msg.replyTo;
  if (mScreenshot == null) {
    mScreenshot=new GlobalScreenshot(TakeScreenshotService.this);
  }
mScreenshot.takeScreenshot(new Runnable(){
  @Override public void run(){
    Message reply=Message.obtain(null,1);
    try {
      callback.send(reply);
    }
 catch (    RemoteException e) {
    }
  }
}
,msg.arg1 > 0,msg.arg2 > 0);
}
}
Program: 2480
Project: 2480
Buggy source:
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
    Log.d(TAG,"String_Node_Str");
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
  }
 catch (  RemoteException e) {
  }
}
Program: 2485
Project: 2485
Buggy source:
/** 
 * Creates a new worker thread and saves the screenshot to the media store.
 */
private void saveScreenshotInWorkerThread(Runnable finisher){
  Log.d(TAG,"String_Node_Str");
  SaveImageInBackgroundData data=new SaveImageInBackgroundData();
  data.context=mContext;
  data.image=mScreenBitmap;
  data.iconSize=mNotificationIconSize;
  data.finisher=finisher;
  if (mSaveInBgTask != null) {
    mSaveInBgTask.cancel(false);
    Log.d(TAG,"String_Node_Str");
  }
  mSaveInBgTask=new SaveImageInBackgroundTask(mContext,data,mNotificationManager,SCREENSHOT_NOTIFICATION_ID).execute(data);
}

Fixed version (ground truth):
/** 
 * Creates a new worker thread and saves the screenshot to the media store.
 */
private void saveScreenshotInWorkerThread(Runnable finisher){
  SaveImageInBackgroundData data=new SaveImageInBackgroundData();
  data.context=mContext;
  data.image=mScreenBitmap;
  data.iconSize=mNotificationIconSize;
  data.finisher=finisher;
  if (mSaveInBgTask != null) {
    mSaveInBgTask.cancel(false);
  }
  mSaveInBgTask=new SaveImageInBackgroundTask(mContext,data,mNotificationManager,SCREENSHOT_NOTIFICATION_ID).execute(data);
}
Program: 2486
Project: 2486
Buggy source:
static void notifyScreenshotError(Context context,NotificationManager nManager){
  Log.d(TAG,"String_Node_Str");
  Resources r=context.getResources();
  Notification.Builder b=new Notification.Builder(context).setTicker(r.getString(R.string.screenshot_failed_title)).setContentTitle(r.getString(R.string.screenshot_failed_title)).setContentText(r.getString(R.string.screenshot_failed_text)).setSmallIcon(R.drawable.stat_notify_image_error).setWhen(System.currentTimeMillis()).setAutoCancel(true);
  Notification n=new Notification.BigTextStyle(b).bigText(r.getString(R.string.screenshot_failed_text)).build();
  nManager.notify(SCREENSHOT_NOTIFICATION_ID,n);
}

Fixed version (ground truth):
static void notifyScreenshotError(Context context,NotificationManager nManager){
  Resources r=context.getResources();
  Notification.Builder b=new Notification.Builder(context).setTicker(r.getString(R.string.screenshot_failed_title)).setContentTitle(r.getString(R.string.screenshot_failed_title)).setContentText(r.getString(R.string.screenshot_failed_text)).setSmallIcon(R.drawable.stat_notify_image_error).setWhen(System.currentTimeMillis()).setAutoCancel(true);
  Notification n=new Notification.BigTextStyle(b).bigText(r.getString(R.string.screenshot_failed_text)).build();
  nManager.notify(SCREENSHOT_NOTIFICATION_ID,n);
}
Program: 2487
Project: 2487
Buggy source:
@Override public void run(){
  mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
  mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  mScreenshotView.buildLayer();
  mScreenshotAnimation.start();
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
  mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  mScreenshotView.buildLayer();
  mScreenshotAnimation.start();
}
Program: 2489
Project: 2489
Buggy source:
/** 
 * Starts the animation after taking the screenshot
 */
private void startAnimation(final Runnable finisher,int w,int h,boolean statusBarVisible,boolean navBarVisible){
  Log.d(TAG,"String_Node_Str");
  mScreenshotView.setImageBitmap(mScreenBitmap);
  mScreenshotLayout.requestFocus();
  if (mScreenshotAnimation != null) {
    mScreenshotAnimation.end();
    mScreenshotAnimation.removeAllListeners();
    Log.d(TAG,"String_Node_Str");
  }
  mWindowManager.addView(mScreenshotLayout,mWindowLayoutParams);
  Log.d(TAG,"String_Node_Str");
  ValueAnimator screenshotDropInAnim=createScreenshotDropInAnimation();
  ValueAnimator screenshotFadeOutAnim=createScreenshotDropOutAnimation(w,h,statusBarVisible,navBarVisible);
  mScreenshotAnimation=new AnimatorSet();
  mScreenshotAnimation.playSequentially(screenshotDropInAnim,screenshotFadeOutAnim);
  mScreenshotAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      saveScreenshotInWorkerThread(finisher);
      mWindowManager.removeView(mScreenshotLayout);
      mScreenBitmap=null;
      mScreenshotView.setImageBitmap(null);
      Log.d(TAG,"String_Node_Str");
    }
  }
);
  mScreenshotLayout.post(new Runnable(){
    @Override public void run(){
      mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
      mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
      mScreenshotView.buildLayer();
      mScreenshotAnimation.start();
      Log.d(TAG,"String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Starts the animation after taking the screenshot
 */
private void startAnimation(final Runnable finisher,int w,int h,boolean statusBarVisible,boolean navBarVisible){
  mScreenshotView.setImageBitmap(mScreenBitmap);
  mScreenshotLayout.requestFocus();
  if (mScreenshotAnimation != null) {
    mScreenshotAnimation.end();
    mScreenshotAnimation.removeAllListeners();
  }
  mWindowManager.addView(mScreenshotLayout,mWindowLayoutParams);
  ValueAnimator screenshotDropInAnim=createScreenshotDropInAnimation();
  ValueAnimator screenshotFadeOutAnim=createScreenshotDropOutAnimation(w,h,statusBarVisible,navBarVisible);
  mScreenshotAnimation=new AnimatorSet();
  mScreenshotAnimation.playSequentially(screenshotDropInAnim,screenshotFadeOutAnim);
  mScreenshotAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      saveScreenshotInWorkerThread(finisher);
      mWindowManager.removeView(mScreenshotLayout);
      mScreenBitmap=null;
      mScreenshotView.setImageBitmap(null);
    }
  }
);
  mScreenshotLayout.post(new Runnable(){
    @Override public void run(){
      mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
      mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
      mScreenshotView.buildLayer();
      mScreenshotAnimation.start();
    }
  }
);
}
Program: 2491
Project: 2491
Buggy source:
/** 
 * Takes a screenshot of the current display and shows an animation.
 */
void takeScreenshot(Runnable finisher,boolean statusBarVisible,boolean navBarVisible){
  Log.d(TAG,"String_Node_Str");
  mDisplay.getRealMetrics(mDisplayMetrics);
  float[] dims={mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels};
  float degrees=getDegreesForRotation(mDisplay.getRotation());
  boolean requiresRotation=(degrees > 0);
  if (requiresRotation) {
    mDisplayMatrix.reset();
    mDisplayMatrix.preRotate(-degrees);
    mDisplayMatrix.mapPoints(dims);
    dims[0]=Math.abs(dims[0]);
    dims[1]=Math.abs(dims[1]);
    Log.d(TAG,"String_Node_Str");
  }
  mScreenBitmap=SurfaceControl.screenshot((int)dims[0],(int)dims[1]);
  if (mScreenBitmap == null) {
    notifyScreenshotError(mContext,mNotificationManager);
    finisher.run();
    Log.d(TAG,"String_Node_Str");
    return;
  }
  if (requiresRotation) {
    Bitmap ss=Bitmap.createBitmap(mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(ss);
    c.translate(ss.getWidth() / 2,ss.getHeight() / 2);
    c.rotate(degrees);
    c.translate(-dims[0] / 2,-dims[1] / 2);
    c.drawBitmap(mScreenBitmap,0,0,null);
    c.setBitmap(null);
    mScreenBitmap.recycle();
    mScreenBitmap=ss;
    Log.d(TAG,"String_Node_Str");
  }
  mScreenBitmap.setHasAlpha(false);
  mScreenBitmap.prepareToDraw();
  startAnimation(finisher,mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,statusBarVisible,navBarVisible);
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Takes a screenshot of the current display and shows an animation.
 */
void takeScreenshot(Runnable finisher,boolean statusBarVisible,boolean navBarVisible){
  mDisplay.getRealMetrics(mDisplayMetrics);
  float[] dims={mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels};
  float degrees=getDegreesForRotation(mDisplay.getRotation());
  boolean requiresRotation=(degrees > 0);
  if (requiresRotation) {
    mDisplayMatrix.reset();
    mDisplayMatrix.preRotate(-degrees);
    mDisplayMatrix.mapPoints(dims);
    dims[0]=Math.abs(dims[0]);
    dims[1]=Math.abs(dims[1]);
  }
  mScreenBitmap=SurfaceControl.screenshot((int)dims[0],(int)dims[1]);
  if (mScreenBitmap == null) {
    notifyScreenshotError(mContext,mNotificationManager);
    finisher.run();
    return;
  }
  if (requiresRotation) {
    Bitmap ss=Bitmap.createBitmap(mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(ss);
    c.translate(ss.getWidth() / 2,ss.getHeight() / 2);
    c.rotate(degrees);
    c.translate(-dims[0] / 2,-dims[1] / 2);
    c.drawBitmap(mScreenBitmap,0,0,null);
    c.setBitmap(null);
    mScreenBitmap.recycle();
    mScreenBitmap=ss;
  }
  mScreenBitmap.setHasAlpha(false);
  mScreenBitmap.prepareToDraw();
  startAnimation(finisher,mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,statusBarVisible,navBarVisible);
}
Program: 2492
Project: 2492
Buggy source:
void clearImage(){
  context=null;
  image=null;
  imageUri=null;
  iconSize=0;
}

Fixed version (ground truth):
void clearImage(){
  image=null;
  imageUri=null;
  iconSize=0;
}
Program: 2494
Project: 2494
Buggy source:
@Override protected void onPostExecute(SaveImageInBackgroundData params){
  if (isCancelled()) {
    params.finisher.run();
    params.clearImage();
    Log.d(TAG,"String_Node_Str");
    return;
  }
  if (params.result > 0) {
    GlobalScreenshot.notifyScreenshotError(params.context,mNotificationManager);
  }
 else {
    Resources r=params.context.getResources();
    Intent launchIntent=new Intent(Intent.ACTION_VIEW);
    launchIntent.setDataAndType(params.imageUri,"String_Node_Str");
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.setContentTitle(r.getString(R.string.screenshot_saved_title)).setContentText(r.getString(R.string.screenshot_saved_text)).setContentIntent(PendingIntent.getActivity(params.context,0,launchIntent,0)).setWhen(System.currentTimeMillis()).setAutoCancel(true);
    Notification n=mNotificationBuilder.build();
    n.flags&=~Notification.FLAG_NO_CLEAR;
    mNotificationManager.notify(mNotificationId,n);
  }
  params.finisher.run();
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override protected void onPostExecute(SaveImageInBackgroundData params){
  if (isCancelled()) {
    params.finisher.run();
    params.clearImage();
    params.clearContext();
    return;
  }
  if (params.result > 0) {
    GlobalScreenshot.notifyScreenshotError(params.context,mNotificationManager);
  }
 else {
    Resources r=params.context.getResources();
    Intent launchIntent=new Intent(Intent.ACTION_VIEW);
    launchIntent.setDataAndType(params.imageUri,"String_Node_Str");
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.setContentTitle(r.getString(R.string.screenshot_saved_title)).setContentText(r.getString(R.string.screenshot_saved_text)).setContentIntent(PendingIntent.getActivity(params.context,0,launchIntent,0)).setWhen(System.currentTimeMillis()).setAutoCancel(true);
    Notification n=mNotificationBuilder.build();
    n.flags&=~Notification.FLAG_NO_CLEAR;
    mNotificationManager.notify(mNotificationId,n);
  }
  params.finisher.run();
  params.clearContext();
}
Program: 2495
Project: 2495
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case 1:
    final Messenger callback=msg.replyTo;
  if (mScreenshot == null) {
    mScreenshot=new GlobalScreenshot(TakeScreenshotService.this);
    Log.d(TAG,"String_Node_Str");
  }
Log.d(TAG,"String_Node_Str");
mScreenshot.takeScreenshot(new Runnable(){
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
    Log.d(TAG,"String_Node_Str");
  }
 catch (  RemoteException e) {
  }
}
}
,msg.arg1 > 0,msg.arg2 > 0);
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case 1:
    final Messenger callback=msg.replyTo;
  if (mScreenshot == null) {
    mScreenshot=new GlobalScreenshot(TakeScreenshotService.this);
  }
mScreenshot.takeScreenshot(new Runnable(){
  @Override public void run(){
    Message reply=Message.obtain(null,1);
    try {
      callback.send(reply);
    }
 catch (    RemoteException e) {
    }
  }
}
,msg.arg1 > 0,msg.arg2 > 0);
}
}
Program: 2496
Project: 2496
Buggy source:
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
    Log.d(TAG,"String_Node_Str");
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
  }
 catch (  RemoteException e) {
  }
}
Program: 2497
Project: 2497
Buggy source:
/** 
 * Creates a new worker thread and saves the screenshot to the media store.
 */
private void saveScreenshotInWorkerThread(Runnable finisher){
  Log.d(TAG,"String_Node_Str");
  SaveImageInBackgroundData data=new SaveImageInBackgroundData();
  data.context=mContext;
  data.image=mScreenBitmap;
  data.iconSize=mNotificationIconSize;
  data.finisher=finisher;
  if (mSaveInBgTask != null) {
    mSaveInBgTask.cancel(false);
    Log.d(TAG,"String_Node_Str");
  }
  mSaveInBgTask=new SaveImageInBackgroundTask(mContext,data,mNotificationManager,SCREENSHOT_NOTIFICATION_ID).execute(data);
}

Fixed version (ground truth):
/** 
 * Creates a new worker thread and saves the screenshot to the media store.
 */
private void saveScreenshotInWorkerThread(Runnable finisher){
  SaveImageInBackgroundData data=new SaveImageInBackgroundData();
  data.context=mContext;
  data.image=mScreenBitmap;
  data.iconSize=mNotificationIconSize;
  data.finisher=finisher;
  if (mSaveInBgTask != null) {
    mSaveInBgTask.cancel(false);
  }
  mSaveInBgTask=new SaveImageInBackgroundTask(mContext,data,mNotificationManager,SCREENSHOT_NOTIFICATION_ID).execute(data);
}
Program: 2498
Project: 2498
Buggy source:
static void notifyScreenshotError(Context context,NotificationManager nManager){
  Log.d(TAG,"String_Node_Str");
  Resources r=context.getResources();
  Notification.Builder b=new Notification.Builder(context).setTicker(r.getString(R.string.screenshot_failed_title)).setContentTitle(r.getString(R.string.screenshot_failed_title)).setContentText(r.getString(R.string.screenshot_failed_text)).setSmallIcon(R.drawable.stat_notify_image_error).setWhen(System.currentTimeMillis()).setAutoCancel(true);
  Notification n=new Notification.BigTextStyle(b).bigText(r.getString(R.string.screenshot_failed_text)).build();
  nManager.notify(SCREENSHOT_NOTIFICATION_ID,n);
}

Fixed version (ground truth):
static void notifyScreenshotError(Context context,NotificationManager nManager){
  Resources r=context.getResources();
  Notification.Builder b=new Notification.Builder(context).setTicker(r.getString(R.string.screenshot_failed_title)).setContentTitle(r.getString(R.string.screenshot_failed_title)).setContentText(r.getString(R.string.screenshot_failed_text)).setSmallIcon(R.drawable.stat_notify_image_error).setWhen(System.currentTimeMillis()).setAutoCancel(true);
  Notification n=new Notification.BigTextStyle(b).bigText(r.getString(R.string.screenshot_failed_text)).build();
  nManager.notify(SCREENSHOT_NOTIFICATION_ID,n);
}
Program: 2499
Project: 2499
Buggy source:
@Override public void run(){
  mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
  mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  mScreenshotView.buildLayer();
  mScreenshotAnimation.start();
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
  mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  mScreenshotView.buildLayer();
  mScreenshotAnimation.start();
}
Program: 2501
Project: 2501
Buggy source:
/** 
 * Starts the animation after taking the screenshot
 */
private void startAnimation(final Runnable finisher,int w,int h,boolean statusBarVisible,boolean navBarVisible){
  Log.d(TAG,"String_Node_Str");
  mScreenshotView.setImageBitmap(mScreenBitmap);
  mScreenshotLayout.requestFocus();
  if (mScreenshotAnimation != null) {
    mScreenshotAnimation.end();
    mScreenshotAnimation.removeAllListeners();
    Log.d(TAG,"String_Node_Str");
  }
  mWindowManager.addView(mScreenshotLayout,mWindowLayoutParams);
  Log.d(TAG,"String_Node_Str");
  ValueAnimator screenshotDropInAnim=createScreenshotDropInAnimation();
  ValueAnimator screenshotFadeOutAnim=createScreenshotDropOutAnimation(w,h,statusBarVisible,navBarVisible);
  mScreenshotAnimation=new AnimatorSet();
  mScreenshotAnimation.playSequentially(screenshotDropInAnim,screenshotFadeOutAnim);
  mScreenshotAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      saveScreenshotInWorkerThread(finisher);
      mWindowManager.removeView(mScreenshotLayout);
      mScreenBitmap=null;
      mScreenshotView.setImageBitmap(null);
      Log.d(TAG,"String_Node_Str");
    }
  }
);
  mScreenshotLayout.post(new Runnable(){
    @Override public void run(){
      mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
      mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
      mScreenshotView.buildLayer();
      mScreenshotAnimation.start();
      Log.d(TAG,"String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Starts the animation after taking the screenshot
 */
private void startAnimation(final Runnable finisher,int w,int h,boolean statusBarVisible,boolean navBarVisible){
  mScreenshotView.setImageBitmap(mScreenBitmap);
  mScreenshotLayout.requestFocus();
  if (mScreenshotAnimation != null) {
    mScreenshotAnimation.end();
    mScreenshotAnimation.removeAllListeners();
  }
  mWindowManager.addView(mScreenshotLayout,mWindowLayoutParams);
  ValueAnimator screenshotDropInAnim=createScreenshotDropInAnimation();
  ValueAnimator screenshotFadeOutAnim=createScreenshotDropOutAnimation(w,h,statusBarVisible,navBarVisible);
  mScreenshotAnimation=new AnimatorSet();
  mScreenshotAnimation.playSequentially(screenshotDropInAnim,screenshotFadeOutAnim);
  mScreenshotAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      saveScreenshotInWorkerThread(finisher);
      mWindowManager.removeView(mScreenshotLayout);
      mScreenBitmap=null;
      mScreenshotView.setImageBitmap(null);
    }
  }
);
  mScreenshotLayout.post(new Runnable(){
    @Override public void run(){
      mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
      mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
      mScreenshotView.buildLayer();
      mScreenshotAnimation.start();
    }
  }
);
}
Program: 2503
Project: 2503
Buggy source:
/** 
 * Takes a screenshot of the current display and shows an animation.
 */
void takeScreenshot(Runnable finisher,boolean statusBarVisible,boolean navBarVisible){
  Log.d(TAG,"String_Node_Str");
  mDisplay.getRealMetrics(mDisplayMetrics);
  float[] dims={mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels};
  float degrees=getDegreesForRotation(mDisplay.getRotation());
  boolean requiresRotation=(degrees > 0);
  if (requiresRotation) {
    mDisplayMatrix.reset();
    mDisplayMatrix.preRotate(-degrees);
    mDisplayMatrix.mapPoints(dims);
    dims[0]=Math.abs(dims[0]);
    dims[1]=Math.abs(dims[1]);
    Log.d(TAG,"String_Node_Str");
  }
  mScreenBitmap=SurfaceControl.screenshot((int)dims[0],(int)dims[1]);
  if (mScreenBitmap == null) {
    notifyScreenshotError(mContext,mNotificationManager);
    finisher.run();
    Log.d(TAG,"String_Node_Str");
    return;
  }
  if (requiresRotation) {
    Bitmap ss=Bitmap.createBitmap(mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(ss);
    c.translate(ss.getWidth() / 2,ss.getHeight() / 2);
    c.rotate(degrees);
    c.translate(-dims[0] / 2,-dims[1] / 2);
    c.drawBitmap(mScreenBitmap,0,0,null);
    c.setBitmap(null);
    mScreenBitmap.recycle();
    mScreenBitmap=ss;
    Log.d(TAG,"String_Node_Str");
  }
  mScreenBitmap.setHasAlpha(false);
  mScreenBitmap.prepareToDraw();
  startAnimation(finisher,mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,statusBarVisible,navBarVisible);
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Takes a screenshot of the current display and shows an animation.
 */
void takeScreenshot(Runnable finisher,boolean statusBarVisible,boolean navBarVisible){
  mDisplay.getRealMetrics(mDisplayMetrics);
  float[] dims={mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels};
  float degrees=getDegreesForRotation(mDisplay.getRotation());
  boolean requiresRotation=(degrees > 0);
  if (requiresRotation) {
    mDisplayMatrix.reset();
    mDisplayMatrix.preRotate(-degrees);
    mDisplayMatrix.mapPoints(dims);
    dims[0]=Math.abs(dims[0]);
    dims[1]=Math.abs(dims[1]);
  }
  mScreenBitmap=SurfaceControl.screenshot((int)dims[0],(int)dims[1]);
  if (mScreenBitmap == null) {
    notifyScreenshotError(mContext,mNotificationManager);
    finisher.run();
    return;
  }
  if (requiresRotation) {
    Bitmap ss=Bitmap.createBitmap(mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(ss);
    c.translate(ss.getWidth() / 2,ss.getHeight() / 2);
    c.rotate(degrees);
    c.translate(-dims[0] / 2,-dims[1] / 2);
    c.drawBitmap(mScreenBitmap,0,0,null);
    c.setBitmap(null);
    mScreenBitmap.recycle();
    mScreenBitmap=ss;
  }
  mScreenBitmap.setHasAlpha(false);
  mScreenBitmap.prepareToDraw();
  startAnimation(finisher,mDisplayMetrics.widthPixels,mDisplayMetrics.heightPixels,statusBarVisible,navBarVisible);
}
Program: 2504
Project: 2504
Buggy source:
void clearImage(){
  context=null;
  image=null;
  imageUri=null;
  iconSize=0;
}

Fixed version (ground truth):
void clearImage(){
  image=null;
  imageUri=null;
  iconSize=0;
}
Program: 2506
Project: 2506
Buggy source:
@Override protected void onPostExecute(SaveImageInBackgroundData params){
  if (isCancelled()) {
    params.finisher.run();
    params.clearImage();
    Log.d(TAG,"String_Node_Str");
    return;
  }
  if (params.result > 0) {
    GlobalScreenshot.notifyScreenshotError(params.context,mNotificationManager);
  }
 else {
    Resources r=params.context.getResources();
    Intent launchIntent=new Intent(Intent.ACTION_VIEW);
    launchIntent.setDataAndType(params.imageUri,"String_Node_Str");
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.setContentTitle(r.getString(R.string.screenshot_saved_title)).setContentText(r.getString(R.string.screenshot_saved_text)).setContentIntent(PendingIntent.getActivity(params.context,0,launchIntent,0)).setWhen(System.currentTimeMillis()).setAutoCancel(true);
    Notification n=mNotificationBuilder.build();
    n.flags&=~Notification.FLAG_NO_CLEAR;
    mNotificationManager.notify(mNotificationId,n);
  }
  params.finisher.run();
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override protected void onPostExecute(SaveImageInBackgroundData params){
  if (isCancelled()) {
    params.finisher.run();
    params.clearImage();
    params.clearContext();
    return;
  }
  if (params.result > 0) {
    GlobalScreenshot.notifyScreenshotError(params.context,mNotificationManager);
  }
 else {
    Resources r=params.context.getResources();
    Intent launchIntent=new Intent(Intent.ACTION_VIEW);
    launchIntent.setDataAndType(params.imageUri,"String_Node_Str");
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.setContentTitle(r.getString(R.string.screenshot_saved_title)).setContentText(r.getString(R.string.screenshot_saved_text)).setContentIntent(PendingIntent.getActivity(params.context,0,launchIntent,0)).setWhen(System.currentTimeMillis()).setAutoCancel(true);
    Notification n=mNotificationBuilder.build();
    n.flags&=~Notification.FLAG_NO_CLEAR;
    mNotificationManager.notify(mNotificationId,n);
  }
  params.finisher.run();
  params.clearContext();
}
Program: 2507
Project: 2507
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case 1:
    final Messenger callback=msg.replyTo;
  if (mScreenshot == null) {
    mScreenshot=new GlobalScreenshot(TakeScreenshotService.this);
    Log.d(TAG,"String_Node_Str");
  }
Log.d(TAG,"String_Node_Str");
mScreenshot.takeScreenshot(new Runnable(){
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
    Log.d(TAG,"String_Node_Str");
  }
 catch (  RemoteException e) {
  }
}
}
,msg.arg1 > 0,msg.arg2 > 0);
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case 1:
    final Messenger callback=msg.replyTo;
  if (mScreenshot == null) {
    mScreenshot=new GlobalScreenshot(TakeScreenshotService.this);
  }
mScreenshot.takeScreenshot(new Runnable(){
  @Override public void run(){
    Message reply=Message.obtain(null,1);
    try {
      callback.send(reply);
    }
 catch (    RemoteException e) {
    }
  }
}
,msg.arg1 > 0,msg.arg2 > 0);
}
}
Program: 2508
Project: 2508
Buggy source:
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
    Log.d(TAG,"String_Node_Str");
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Message reply=Message.obtain(null,1);
  try {
    callback.send(reply);
  }
 catch (  RemoteException e) {
  }
}
Program: 2510
Project: 2510
Buggy source:
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  if (layoutDirection != this.mLayoutDirection) {
    this.mLayoutDirection=layoutDirection;
    this.mNeedResolution=isMarginRelative();
  }
}

Fixed version (ground truth):
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  if (layoutDirection != (mMarginFlags & LAYOUT_DIRECTION_MASK)) {
    mMarginFlags&=~LAYOUT_DIRECTION_MASK;
    mMarginFlags|=(layoutDirection & LAYOUT_DIRECTION_MASK);
    if (isMarginRelative()) {
      mMarginFlags|=NEED_RESOLUTION_MASK;
    }
 else {
      mMarginFlags&=~NEED_RESOLUTION_MASK;
    }
  }
}
Program: 2511
Project: 2511
Buggy source:
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_MARGIN_RELATIVE)   return startMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_MARGIN_RELATIVE)   return startMargin;
  if ((mMarginFlags & NEED_RESOLUTION_MASK) == NEED_RESOLUTION_MASK) {
    doResolveMargins();
  }
switch (mMarginFlags & LAYOUT_DIRECTION_MASK) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}
Program: 2512
Project: 2512
Buggy source:
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mLeftMarginUndefined=false;
  mRightMarginUndefined=false;
  mNeedResolution=isMarginRelative();
}

Fixed version (ground truth):
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mMarginFlags&=~LEFT_MARGIN_UNDEFINED_MASK;
  mMarginFlags&=~RIGHT_MARGIN_UNDEFINED_MASK;
  if (isMarginRelative()) {
    mMarginFlags|=NEED_RESOLUTION_MASK;
  }
 else {
    mMarginFlags&=~NEED_RESOLUTION_MASK;
  }
}
Program: 2513
Project: 2513
Buggy source:
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (mLayoutDirection == View.LAYOUT_DIRECTION_RTL);
}

Fixed version (ground truth):
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return ((mMarginFlags & LAYOUT_DIRECTION_MASK) == View.LAYOUT_DIRECTION_RTL);
}