nus-yam/ex-repair huggingface dataset:
Program: 199538
Project: 199538
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: 199540
Project: 199540
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: 199541
Project: 199541
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: 199542
Project: 199542
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: 199543
Project: 199543
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: 199545
Project: 199545
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: 199546
Project: 199546
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: 199547
Project: 199547
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: 199548
Project: 199548
Buggy source:
public long getCurrentTimeUs(boolean refreshTime,boolean monotonic) throws IllegalStateException {
synchronized (this) {
    if (mPaused && !refreshTime) {
      return mLastReportedTime;
    }
    long nanoTime=System.nanoTime();
    if (refreshTime || nanoTime >= mLastNanoTime + MAX_NS_WITHOUT_POSITION_CHECK) {
      try {
        mLastTimeUs=mPlayer.getCurrentPosition() * 1000;
        mPaused=!mPlayer.isPlaying();
        if (DEBUG)         Log.v(TAG,(mPaused ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + mLastTimeUs);
      }
 catch (      IllegalStateException e) {
        if (mPausing) {
          mPausing=false;
          getEstimatedTime(nanoTime,monotonic);
          mPaused=true;
          if (DEBUG)           Log.d(TAG,"String_Node_Str" + mLastReportedTime);
          return mLastReportedTime;
        }
        throw e;
      }
      mLastNanoTime=nanoTime;
      if (monotonic && mLastTimeUs < mLastReportedTime) {
        mTimeAdjustment=mLastReportedTime - mLastTimeUs;
        if (mTimeAdjustment > 1000000) {
          mStopped=false;
          mSeeking=true;
          scheduleNotification(NOTIFY_SEEK,0);
        }
      }
 else {
        mTimeAdjustment=0;
      }
    }
    return getEstimatedTime(nanoTime,monotonic);
  }
}

Fixed version (ground truth):
public long getCurrentTimeUs(boolean refreshTime,boolean monotonic) throws IllegalStateException {
synchronized (this) {
    if (mPaused && !refreshTime) {
      return mLastReportedTime;
    }
    long nanoTime=System.nanoTime();
    if (refreshTime || nanoTime >= mLastNanoTime + MAX_NS_WITHOUT_POSITION_CHECK) {
      try {
        mLastTimeUs=mPlayer.getCurrentPosition() * 1000L;
        mPaused=!mPlayer.isPlaying();
        if (DEBUG)         Log.v(TAG,(mPaused ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + mLastTimeUs);
      }
 catch (      IllegalStateException e) {
        if (mPausing) {
          mPausing=false;
          getEstimatedTime(nanoTime,monotonic);
          mPaused=true;
          if (DEBUG)           Log.d(TAG,"String_Node_Str" + mLastReportedTime);
          return mLastReportedTime;
        }
        throw e;
      }
      mLastNanoTime=nanoTime;
      if (monotonic && mLastTimeUs < mLastReportedTime) {
        mTimeAdjustment=mLastReportedTime - mLastTimeUs;
        if (mTimeAdjustment > 1000000) {
          mStopped=false;
          mSeeking=true;
          scheduleNotification(NOTIFY_SEEK,0);
        }
      }
 else {
        mTimeAdjustment=0;
      }
    }
    return getEstimatedTime(nanoTime,monotonic);
  }
}
Program: 199552
Project: 199552
Buggy source:
/** 
 * Toggles the alternate recents activity 
 */
public void onToggleRecents(Display display,int layoutDirection,View statusBarView){
  Console.log(Constants.DebugFlags.App.RecentsComponent,"String_Node_Str","String_Node_Str" + mServiceIsBound);
  mStatusBarView=statusBarView;
  if (!mServiceIsBound) {
    bindToRecentsService(true);
    return;
  }
  try {
    startAlternateRecentsActivity();
  }
 catch (  ActivityNotFoundException e) {
    Console.logRawError("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Toggles the alternate recents activity 
 */
public void onToggleRecents(Display display,int layoutDirection,View statusBarView){
  Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey);
  Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey);
  Console.log(Constants.DebugFlags.App.RecentsComponent,"String_Node_Str","String_Node_Str" + mServiceIsBound);
  mStatusBarView=statusBarView;
  if (!mServiceIsBound) {
    bindToRecentsService(true);
    return;
  }
  try {
    startAlternateRecentsActivity();
  }
 catch (  ActivityNotFoundException e) {
    Console.logRawError("String_Node_Str",e);
  }
}
Program: 199553
Project: 199553
Buggy source:
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",getIntent().getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  WindowManager.LayoutParams wlp=getWindow().getAttributes();
  wlp.dimAmount=Constants.Values.Window.BackgroundDim;
  getWindow().setAttributes(wlp);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  mRecentsView=new RecentsView(this);
  mRecentsView.setCallbacks(this);
  mRecentsView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT));
  LayoutInflater inflater=LayoutInflater.from(this);
  mEmptyView=inflater.inflate(R.layout.recents_empty,mContainerView,false);
  mContainerView=new FrameLayout(this);
  mContainerView.addView(mRecentsView);
  mContainerView.addView(mEmptyView);
  setContentView(mContainerView);
  updateRecentsTasks();
}

Fixed version (ground truth):
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",getIntent().getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  WindowManager.LayoutParams wlp=getWindow().getAttributes();
  wlp.dimAmount=Constants.Values.Window.BackgroundDim;
  getWindow().setAttributes(wlp);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  mRecentsView=new RecentsView(this);
  mRecentsView.setCallbacks(this);
  mRecentsView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT));
  LayoutInflater inflater=LayoutInflater.from(this);
  mEmptyView=inflater.inflate(R.layout.recents_empty,mContainerView,false);
  mContainerView=new FrameLayout(this);
  mContainerView.addView(mRecentsView);
  mContainerView.addView(mEmptyView);
  setContentView(mContainerView);
  updateRecentsTasks();
}
Program: 199554
Project: 199554
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  updateRecentsTasks();
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  updateRecentsTasks();
}
Program: 199556
Project: 199556
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str",new Rect(left,top,right,bottom) + "String_Node_Str" + changed,Console.AnsiGreen);
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  top+=config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      final int width=child.getMeasuredWidth();
      final int height=child.getMeasuredHeight();
      child.layout(left,top,left + width,top + height);
    }
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str",new Rect(left,top,right,bottom) + "String_Node_Str" + changed,Console.AnsiGreen);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  top+=config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      final int width=child.getMeasuredWidth();
      final int height=child.getMeasuredHeight();
      child.layout(left,top,left + width,top + height);
    }
  }
}
Program: 199557
Project: 199557
Buggy source:
@Override public void run(){
  TaskViewTransform transform;
  View sourceView=tv;
  int offsetX=0;
  int offsetY=0;
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackTransform(stack.indexOfTask(task));
    offsetX=transform.rect.left;
    offsetY=transform.rect.top;
  }
 else {
    transform=stackView.getStackTransform(stack.indexOfTask(task));
  }
  ActivityOptions opts=null;
  int thumbnailWidth=transform.rect.width();
  int thumbnailHeight=transform.rect.height();
  if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(b);
    c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
    c.setBitmap(null);
    opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
  }
  Intent i=new Intent(task.key.intent);
  i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
  if (opts != null) {
    getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
  }
 else {
    getContext().startActivityAsUser(i,UserHandle.CURRENT);
  }
}

Fixed version (ground truth):
@Override public void run(){
  TaskViewTransform transform;
  View sourceView=tv;
  int offsetX=0;
  int offsetY=0;
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackTransform(stack.indexOfTask(task));
    offsetX=transform.rect.left;
    offsetY=transform.rect.top;
  }
 else {
    transform=stackView.getStackTransform(stack.indexOfTask(task));
  }
  ActivityOptions opts=null;
  int thumbnailWidth=transform.rect.width();
  int thumbnailHeight=transform.rect.height();
  if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(b);
    c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
    c.setBitmap(null);
    opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
  }
  Intent i=new Intent(task.key.intent);
  i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
  if (opts != null) {
    getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
  }
 else {
    getContext().startActivityAsUser(i,UserHandle.CURRENT);
  }
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey,"String_Node_Str");
}
Program: 199558
Project: 199558
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str","String_Node_Str" + width + "String_Node_Str"+ height,Console.AnsiGreen);
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  int childHeight=height - config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      child.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(childHeight,heightMode));
    }
  }
  setMeasuredDimension(width,height);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str","String_Node_Str" + width + "String_Node_Str"+ height,Console.AnsiGreen);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  int childHeight=height - config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      child.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(childHeight,heightMode));
    }
  }
  setMeasuredDimension(width,height);
}
Program: 199560
Project: 199560
Buggy source:
/** 
 * Animates this task view as it exits recents 
 */
public void animateOnLeavingRecents(final Runnable r){
  if (Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingUseClip) {
    mIconView.animateCircularClip(false,0f,Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration,0,new DecelerateInterpolator(),new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
);
  }
 else {
    mIconView.animate().alpha(0f).setDuration(Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration).setInterpolator(new DecelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
).start();
  }
}

Fixed version (ground truth):
/** 
 * Animates this task view as it exits recents 
 */
public void animateOnLeavingRecents(final Runnable r){
  if (Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingUseClip) {
    mIconView.animateCircularClip(false,0f,Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration,0,new DecelerateInterpolator(),new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
);
  }
 else {
    mIconView.animate().alpha(0f).setStartDelay(0).setDuration(Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration).setInterpolator(new DecelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
).start();
  }
}
Program: 199561
Project: 199561
Buggy source:
/** 
 * Toggles the alternate recents activity 
 */
public void onToggleRecents(Display display,int layoutDirection,View statusBarView){
  Console.log(Constants.DebugFlags.App.RecentsComponent,"String_Node_Str","String_Node_Str" + mServiceIsBound);
  mStatusBarView=statusBarView;
  if (!mServiceIsBound) {
    bindToRecentsService(true);
    return;
  }
  try {
    startAlternateRecentsActivity();
  }
 catch (  ActivityNotFoundException e) {
    Console.logRawError("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Toggles the alternate recents activity 
 */
public void onToggleRecents(Display display,int layoutDirection,View statusBarView){
  Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey);
  Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey);
  Console.log(Constants.DebugFlags.App.RecentsComponent,"String_Node_Str","String_Node_Str" + mServiceIsBound);
  mStatusBarView=statusBarView;
  if (!mServiceIsBound) {
    bindToRecentsService(true);
    return;
  }
  try {
    startAlternateRecentsActivity();
  }
 catch (  ActivityNotFoundException e) {
    Console.logRawError("String_Node_Str",e);
  }
}
Program: 199562
Project: 199562
Buggy source:
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",getIntent().getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  WindowManager.LayoutParams wlp=getWindow().getAttributes();
  wlp.dimAmount=Constants.Values.Window.BackgroundDim;
  getWindow().setAttributes(wlp);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  mRecentsView=new RecentsView(this);
  mRecentsView.setCallbacks(this);
  mRecentsView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT));
  LayoutInflater inflater=LayoutInflater.from(this);
  mEmptyView=inflater.inflate(R.layout.recents_empty,mContainerView,false);
  mContainerView=new FrameLayout(this);
  mContainerView.addView(mRecentsView);
  mContainerView.addView(mEmptyView);
  setContentView(mContainerView);
  updateRecentsTasks();
}

Fixed version (ground truth):
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",getIntent().getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  WindowManager.LayoutParams wlp=getWindow().getAttributes();
  wlp.dimAmount=Constants.Values.Window.BackgroundDim;
  getWindow().setAttributes(wlp);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  mRecentsView=new RecentsView(this);
  mRecentsView.setCallbacks(this);
  mRecentsView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT));
  LayoutInflater inflater=LayoutInflater.from(this);
  mEmptyView=inflater.inflate(R.layout.recents_empty,mContainerView,false);
  mContainerView=new FrameLayout(this);
  mContainerView.addView(mRecentsView);
  mContainerView.addView(mEmptyView);
  setContentView(mContainerView);
  updateRecentsTasks();
}
Program: 199563
Project: 199563
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  updateRecentsTasks();
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  updateRecentsTasks();
}
Program: 199565
Project: 199565
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str",new Rect(left,top,right,bottom) + "String_Node_Str" + changed,Console.AnsiGreen);
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  top+=config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      final int width=child.getMeasuredWidth();
      final int height=child.getMeasuredHeight();
      child.layout(left,top,left + width,top + height);
    }
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str",new Rect(left,top,right,bottom) + "String_Node_Str" + changed,Console.AnsiGreen);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  top+=config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      final int width=child.getMeasuredWidth();
      final int height=child.getMeasuredHeight();
      child.layout(left,top,left + width,top + height);
    }
  }
}
Program: 199566
Project: 199566
Buggy source:
@Override public void run(){
  TaskViewTransform transform;
  View sourceView=tv;
  int offsetX=0;
  int offsetY=0;
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackTransform(stack.indexOfTask(task));
    offsetX=transform.rect.left;
    offsetY=transform.rect.top;
  }
 else {
    transform=stackView.getStackTransform(stack.indexOfTask(task));
  }
  ActivityOptions opts=null;
  int thumbnailWidth=transform.rect.width();
  int thumbnailHeight=transform.rect.height();
  if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(b);
    c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
    c.setBitmap(null);
    opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
  }
  Intent i=new Intent(task.key.intent);
  i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
  if (opts != null) {
    getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
  }
 else {
    getContext().startActivityAsUser(i,UserHandle.CURRENT);
  }
}

Fixed version (ground truth):
@Override public void run(){
  TaskViewTransform transform;
  View sourceView=tv;
  int offsetX=0;
  int offsetY=0;
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackTransform(stack.indexOfTask(task));
    offsetX=transform.rect.left;
    offsetY=transform.rect.top;
  }
 else {
    transform=stackView.getStackTransform(stack.indexOfTask(task));
  }
  ActivityOptions opts=null;
  int thumbnailWidth=transform.rect.width();
  int thumbnailHeight=transform.rect.height();
  if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(b);
    c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
    c.setBitmap(null);
    opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
  }
  Intent i=new Intent(task.key.intent);
  i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
  if (opts != null) {
    getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
  }
 else {
    getContext().startActivityAsUser(i,UserHandle.CURRENT);
  }
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey,"String_Node_Str");
}
Program: 199567
Project: 199567
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str","String_Node_Str" + width + "String_Node_Str"+ height,Console.AnsiGreen);
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  int childHeight=height - config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      child.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(childHeight,heightMode));
    }
  }
  setMeasuredDimension(width,height);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str","String_Node_Str" + width + "String_Node_Str"+ height,Console.AnsiGreen);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  int childHeight=height - config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      child.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(childHeight,heightMode));
    }
  }
  setMeasuredDimension(width,height);
}
Program: 199569
Project: 199569
Buggy source:
/** 
 * Animates this task view as it exits recents 
 */
public void animateOnLeavingRecents(final Runnable r){
  if (Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingUseClip) {
    mIconView.animateCircularClip(false,0f,Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration,0,new DecelerateInterpolator(),new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
);
  }
 else {
    mIconView.animate().alpha(0f).setDuration(Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration).setInterpolator(new DecelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
).start();
  }
}

Fixed version (ground truth):
/** 
 * Animates this task view as it exits recents 
 */
public void animateOnLeavingRecents(final Runnable r){
  if (Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingUseClip) {
    mIconView.animateCircularClip(false,0f,Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration,0,new DecelerateInterpolator(),new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
);
  }
 else {
    mIconView.animate().alpha(0f).setStartDelay(0).setDuration(Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration).setInterpolator(new DecelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
).start();
  }
}
Program: 199570
Project: 199570
Buggy source:
/** 
 * Toggles the alternate recents activity 
 */
public void onToggleRecents(Display display,int layoutDirection,View statusBarView){
  Console.log(Constants.DebugFlags.App.RecentsComponent,"String_Node_Str","String_Node_Str" + mServiceIsBound);
  mStatusBarView=statusBarView;
  if (!mServiceIsBound) {
    bindToRecentsService(true);
    return;
  }
  try {
    startAlternateRecentsActivity();
  }
 catch (  ActivityNotFoundException e) {
    Console.logRawError("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Toggles the alternate recents activity 
 */
public void onToggleRecents(Display display,int layoutDirection,View statusBarView){
  Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey);
  Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey);
  Console.log(Constants.DebugFlags.App.RecentsComponent,"String_Node_Str","String_Node_Str" + mServiceIsBound);
  mStatusBarView=statusBarView;
  if (!mServiceIsBound) {
    bindToRecentsService(true);
    return;
  }
  try {
    startAlternateRecentsActivity();
  }
 catch (  ActivityNotFoundException e) {
    Console.logRawError("String_Node_Str",e);
  }
}
Program: 199571
Project: 199571
Buggy source:
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",getIntent().getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  WindowManager.LayoutParams wlp=getWindow().getAttributes();
  wlp.dimAmount=Constants.Values.Window.BackgroundDim;
  getWindow().setAttributes(wlp);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  mRecentsView=new RecentsView(this);
  mRecentsView.setCallbacks(this);
  mRecentsView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT));
  LayoutInflater inflater=LayoutInflater.from(this);
  mEmptyView=inflater.inflate(R.layout.recents_empty,mContainerView,false);
  mContainerView=new FrameLayout(this);
  mContainerView.addView(mRecentsView);
  mContainerView.addView(mEmptyView);
  setContentView(mContainerView);
  updateRecentsTasks();
}

Fixed version (ground truth):
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",getIntent().getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  WindowManager.LayoutParams wlp=getWindow().getAttributes();
  wlp.dimAmount=Constants.Values.Window.BackgroundDim;
  getWindow().setAttributes(wlp);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  mRecentsView=new RecentsView(this);
  mRecentsView.setCallbacks(this);
  mRecentsView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT));
  LayoutInflater inflater=LayoutInflater.from(this);
  mEmptyView=inflater.inflate(R.layout.recents_empty,mContainerView,false);
  mContainerView=new FrameLayout(this);
  mContainerView.addView(mRecentsView);
  mContainerView.addView(mEmptyView);
  setContentView(mContainerView);
  updateRecentsTasks();
}
Program: 199572
Project: 199572
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  updateRecentsTasks();
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
  Console.log(Constants.DebugFlags.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsTaskLoader.initialize(this);
  RecentsConfiguration.reinitialize(this);
  updateRecentsTasks();
}
Program: 199574
Project: 199574
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str",new Rect(left,top,right,bottom) + "String_Node_Str" + changed,Console.AnsiGreen);
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  top+=config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      final int width=child.getMeasuredWidth();
      final int height=child.getMeasuredHeight();
      child.layout(left,top,left + width,top + height);
    }
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str",new Rect(left,top,right,bottom) + "String_Node_Str" + changed,Console.AnsiGreen);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  top+=config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      final int width=child.getMeasuredWidth();
      final int height=child.getMeasuredHeight();
      child.layout(left,top,left + width,top + height);
    }
  }
}
Program: 199575
Project: 199575
Buggy source:
@Override public void run(){
  TaskViewTransform transform;
  View sourceView=tv;
  int offsetX=0;
  int offsetY=0;
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackTransform(stack.indexOfTask(task));
    offsetX=transform.rect.left;
    offsetY=transform.rect.top;
  }
 else {
    transform=stackView.getStackTransform(stack.indexOfTask(task));
  }
  ActivityOptions opts=null;
  int thumbnailWidth=transform.rect.width();
  int thumbnailHeight=transform.rect.height();
  if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(b);
    c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
    c.setBitmap(null);
    opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
  }
  Intent i=new Intent(task.key.intent);
  i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
  if (opts != null) {
    getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
  }
 else {
    getContext().startActivityAsUser(i,UserHandle.CURRENT);
  }
}

Fixed version (ground truth):
@Override public void run(){
  TaskViewTransform transform;
  View sourceView=tv;
  int offsetX=0;
  int offsetY=0;
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackTransform(stack.indexOfTask(task));
    offsetX=transform.rect.left;
    offsetY=transform.rect.top;
  }
 else {
    transform=stackView.getStackTransform(stack.indexOfTask(task));
  }
  ActivityOptions opts=null;
  int thumbnailWidth=transform.rect.width();
  int thumbnailHeight=transform.rect.height();
  if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(b);
    c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
    c.setBitmap(null);
    opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
  }
  Intent i=new Intent(task.key.intent);
  i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
  if (opts != null) {
    getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
  }
 else {
    getContext().startActivityAsUser(i,UserHandle.CURRENT);
  }
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey,"String_Node_Str");
}
Program: 199576
Project: 199576
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str","String_Node_Str" + width + "String_Node_Str"+ height,Console.AnsiGreen);
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  int childHeight=height - config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      child.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(childHeight,heightMode));
    }
  }
  setMeasuredDimension(width,height);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  Console.log(Constants.DebugFlags.UI.MeasureAndLayout,"String_Node_Str","String_Node_Str" + width + "String_Node_Str"+ height,Console.AnsiGreen);
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,Constants.DebugFlags.App.TimeRecentsStartupKey,"String_Node_Str");
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  int childHeight=height - config.systemInsets.top;
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      child.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(childHeight,heightMode));
    }
  }
  setMeasuredDimension(width,height);
}
Program: 199578
Project: 199578
Buggy source:
/** 
 * Animates this task view as it exits recents 
 */
public void animateOnLeavingRecents(final Runnable r){
  if (Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingUseClip) {
    mIconView.animateCircularClip(false,0f,Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration,0,new DecelerateInterpolator(),new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
);
  }
 else {
    mIconView.animate().alpha(0f).setDuration(Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration).setInterpolator(new DecelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
).start();
  }
}

Fixed version (ground truth):
/** 
 * Animates this task view as it exits recents 
 */
public void animateOnLeavingRecents(final Runnable r){
  if (Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingUseClip) {
    mIconView.animateCircularClip(false,0f,Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration,0,new DecelerateInterpolator(),new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
);
  }
 else {
    mIconView.animate().alpha(0f).setStartDelay(0).setDuration(Constants.Values.TaskView.Animation.TaskIconOnLeavingDuration).setInterpolator(new DecelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        r.run();
      }
    }
).start();
  }
}
Program: 199579
Project: 199579
Buggy source:
public KeyguardPatternView(Context context,AttributeSet attrs){
  super(context,attrs);
}

Fixed version (ground truth):
public KeyguardPatternView(Context context,AttributeSet attrs){
  super(context,attrs);
  mKeyguardUpdateMonitor=KeyguardUpdateMonitor.getInstance(mContext);
}