nus-yam/ex-repair huggingface dataset:
Program: 195645
Project: 195645
Buggy source:
private void positionSelector(int position,View sel,boolean manageHotspot,float x,float y){
  final boolean positionChanged=position != mSelectorPosition;
  if (position != INVALID_POSITION) {
    mSelectorPosition=position;
  }
  final Rect selectorRect=mSelectorRect;
  selectorRect.set(sel.getLeft(),sel.getTop(),sel.getRight(),sel.getBottom());
  if (sel instanceof SelectionBoundsAdjuster) {
    ((SelectionBoundsAdjuster)sel).adjustListItemSelectionBounds(selectorRect);
  }
  selectorRect.left-=mSelectionLeftPadding;
  selectorRect.top-=mSelectionTopPadding;
  selectorRect.right+=mSelectionRightPadding;
  selectorRect.bottom+=mSelectionBottomPadding;
  final Drawable selector=mSelector;
  if (selector != null) {
    if (positionChanged) {
      selector.setVisible(false,false);
      selector.setState(StateSet.NOTHING);
    }
    selector.setBounds(selectorRect);
    if (positionChanged) {
      if (getVisibility() == VISIBLE) {
        selector.setVisible(true,false);
      }
      selector.setState(getDrawableState());
    }
    if (manageHotspot) {
      selector.setHotspot(x,y);
    }
  }
  final boolean isChildViewEnabled=mIsChildViewEnabled;
  if (sel.isEnabled() != isChildViewEnabled) {
    mIsChildViewEnabled=!isChildViewEnabled;
    if (getSelectedItemPosition() != INVALID_POSITION) {
      refreshDrawableState();
    }
  }
}

Fixed version (ground truth):
private void positionSelector(int position,View sel,boolean manageHotspot,float x,float y){
  final boolean positionChanged=position != mSelectorPosition;
  if (position != INVALID_POSITION) {
    mSelectorPosition=position;
  }
  final Rect selectorRect=mSelectorRect;
  selectorRect.set(sel.getLeft(),sel.getTop(),sel.getRight(),sel.getBottom());
  if (sel instanceof SelectionBoundsAdjuster) {
    ((SelectionBoundsAdjuster)sel).adjustListItemSelectionBounds(selectorRect);
  }
  selectorRect.left-=mSelectionLeftPadding;
  selectorRect.top-=mSelectionTopPadding;
  selectorRect.right+=mSelectionRightPadding;
  selectorRect.bottom+=mSelectionBottomPadding;
  final Drawable selector=mSelector;
  if (selector != null) {
    if (positionChanged) {
      selector.setVisible(false,false);
      selector.setState(StateSet.NOTHING);
    }
    selector.setBounds(selectorRect);
    if (positionChanged) {
      if (getVisibility() == VISIBLE) {
        selector.setVisible(true,false);
      }
      updateSelectorState();
    }
    if (manageHotspot) {
      selector.setHotspot(x,y);
    }
  }
  final boolean isChildViewEnabled=mIsChildViewEnabled;
  if (sel.isEnabled() != isChildViewEnabled) {
    mIsChildViewEnabled=!isChildViewEnabled;
    if (getSelectedItemPosition() != INVALID_POSITION) {
      refreshDrawableState();
    }
  }
}
Program: 195647
Project: 195647
Buggy source:
/** 
 * <p>Enables or disables the duplication of the parent's state into this view. When duplication is enabled, this view gets its drawable state from its parent rather than from its own internal properties.</p> <p>Note: in the current implementation, setting this property to true after the view was added to a ViewGroup might have no effect at all. This property should always be used from XML or set to true before adding this view to a ViewGroup.</p> <p>Note: if this view's parent addStateFromChildren property is enabled and this property is enabled, an exception will be thrown.</p> <p>Note: if the child view uses and updates additionnal states which are unknown to the parent, these states should not be affected by this method.</p>
 * @param enabled True to enable duplication of the parent's drawable state, falseto disable it.
 * @see #getDrawableState()
 * @see #isDuplicateParentStateEnabled()
 */
public void setDuplicateParentStateEnabled(boolean enabled){
  setFlags(enabled ? DUPLICATE_PARENT_STATE : 0,DUPLICATE_PARENT_STATE);
}

Fixed version (ground truth):
/** 
 * <p>Enables or disables the duplication of the parent's state into this view. When duplication is enabled, this view gets its drawable state from its parent rather than from its own internal properties.</p> <p>Note: in the current implementation, setting this property to true after the view was added to a ViewGroup might have no effect at all. This property should always be used from XML or set to true before adding this view to a ViewGroup.</p> <p>Note: if this view's parent addStateFromChildren property is enabled and this property is enabled, an exception will be thrown.</p> <p>Note: if the child view uses and updates additional states which are unknown to the parent, these states should not be affected by this method.</p>
 * @param enabled True to enable duplication of the parent's drawable state, falseto disable it.
 * @see #getDrawableState()
 * @see #isDuplicateParentStateEnabled()
 */
public void setDuplicateParentStateEnabled(boolean enabled){
  setFlags(enabled ? DUPLICATE_PARENT_STATE : 0,DUPLICATE_PARENT_STATE);
}
Program: 195648
Project: 195648
Buggy source:
/** 
 * Call this to try to give focus to a specific view or to one of its descendants. This is a special variant of   {@link #requestFocus() } that will allow views that are not focuable intouch mode to request focus when they are touched.
 * @return Whether this view or one of its descendants actually took focus.
 * @see #isInTouchMode()
 */
public final boolean requestFocusFromTouch(){
  if (isInTouchMode()) {
    ViewRootImpl viewRoot=getViewRootImpl();
    if (viewRoot != null) {
      viewRoot.ensureTouchMode(false);
    }
  }
  return requestFocus(View.FOCUS_DOWN);
}

Fixed version (ground truth):
/** 
 * Call this to try to give focus to a specific view or to one of its descendants. This is a special variant of   {@link #requestFocus() } that will allow views that are not focusable intouch mode to request focus when they are touched.
 * @return Whether this view or one of its descendants actually took focus.
 * @see #isInTouchMode()
 */
public final boolean requestFocusFromTouch(){
  if (isInTouchMode()) {
    ViewRootImpl viewRoot=getViewRootImpl();
    if (viewRoot != null) {
      viewRoot.ensureTouchMode(false);
    }
  }
  return requestFocus(View.FOCUS_DOWN);
}
Program: 195649
Project: 195649
Buggy source:
/** 
 * Define whether scrollbars will fade when the view is not scrolling.
 * @param fadeScrollbars wheter to enable fading
 * @attr ref android.R.styleable#View_fadeScrollbars
 */
public void setScrollbarFadingEnabled(boolean fadeScrollbars){
  initScrollCache();
  final ScrollabilityCache scrollabilityCache=mScrollCache;
  scrollabilityCache.fadeScrollBars=fadeScrollbars;
  if (fadeScrollbars) {
    scrollabilityCache.state=ScrollabilityCache.OFF;
  }
 else {
    scrollabilityCache.state=ScrollabilityCache.ON;
  }
}

Fixed version (ground truth):
/** 
 * Define whether scrollbars will fade when the view is not scrolling.
 * @param fadeScrollbars whether to enable fading
 * @attr ref android.R.styleable#View_fadeScrollbars
 */
public void setScrollbarFadingEnabled(boolean fadeScrollbars){
  initScrollCache();
  final ScrollabilityCache scrollabilityCache=mScrollCache;
  scrollabilityCache.fadeScrollBars=fadeScrollbars;
  if (fadeScrollbars) {
    scrollabilityCache.state=ScrollabilityCache.OFF;
  }
 else {
    scrollabilityCache.state=ScrollabilityCache.ON;
  }
}
Program: 195650
Project: 195650
Buggy source:
/** 
 * Returns true if this view has focus iteself, or is the ancestor of the view that has focus.
 * @return True if this view has or contains focus, false otherwise.
 */
@ViewDebug.ExportedProperty(category="String_Node_Str") public boolean hasFocus(){
  return (mPrivateFlags & PFLAG_FOCUSED) != 0;
}

Fixed version (ground truth):
/** 
 * Returns true if this view has focus itself, or is the ancestor of the view that has focus.
 * @return True if this view has or contains focus, false otherwise.
 */
@ViewDebug.ExportedProperty(category="String_Node_Str") public boolean hasFocus(){
  return (mPrivateFlags & PFLAG_FOCUSED) != 0;
}
Program: 195652
Project: 195652
Buggy source:
/** 
 * Called when the current configuration of the resources being used by the application have changed.  You can use this to decide when to reload resources that can changed based on orientation and other configuration characterstics.  You only need to use this if you are not relying on the normal   {@link android.app.Activity} mechanism ofrecreating the activity instance upon a configuration change.
 * @param newConfig The new resource configuration.
 */
protected void onConfigurationChanged(Configuration newConfig){
}

Fixed version (ground truth):
/** 
 * Called when the current configuration of the resources being used by the application have changed.  You can use this to decide when to reload resources that can changed based on orientation and other configuration characteristics.  You only need to use this if you are not relying on the normal   {@link android.app.Activity} mechanism ofrecreating the activity instance upon a configuration change.
 * @param newConfig The new resource configuration.
 */
protected void onConfigurationChanged(Configuration newConfig){
}
Program: 195656
Project: 195656
Buggy source:
/** 
 * Adds any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. This method adds all focusable views regardless if we are in touch mode or only views focusable in touch mode if we are in touch mode or only views that can take accessibility focus if accessibility is enabeld depending on the focusable mode paramater.
 * @param views Focusable views found so far or null if all we are interested isthe number of focusables.
 * @param direction The direction of the focus.
 * @param focusableMode The type of focusables to be added.
 * @see #FOCUSABLES_ALL
 * @see #FOCUSABLES_TOUCH_MODE
 */
public void addFocusables(ArrayList<View> views,@FocusDirection int direction,@FocusableMode int focusableMode){
  if (views == null) {
    return;
  }
  if (!isFocusable()) {
    return;
  }
  if ((focusableMode & FOCUSABLES_TOUCH_MODE) == FOCUSABLES_TOUCH_MODE && isInTouchMode() && !isFocusableInTouchMode()) {
    return;
  }
  views.add(this);
}

Fixed version (ground truth):
/** 
 * Adds any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. This method adds all focusable views regardless if we are in touch mode or only views focusable in touch mode if we are in touch mode or only views that can take accessibility focus if accessibility is enabled depending on the focusable mode parameter.
 * @param views Focusable views found so far or null if all we are interested isthe number of focusables.
 * @param direction The direction of the focus.
 * @param focusableMode The type of focusables to be added.
 * @see #FOCUSABLES_ALL
 * @see #FOCUSABLES_TOUCH_MODE
 */
public void addFocusables(ArrayList<View> views,@FocusDirection int direction,@FocusableMode int focusableMode){
  if (views == null) {
    return;
  }
  if (!isFocusable()) {
    return;
  }
  if ((focusableMode & FOCUSABLES_TOUCH_MODE) == FOCUSABLES_TOUCH_MODE && isInTouchMode() && !isFocusableInTouchMode()) {
    return;
  }
  views.add(this);
}
Program: 195657
Project: 195657
Buggy source:
/** 
 * Return if the padding as been set thru relative values  {@link #setPaddingRelative(int,int,int,int)} or thru
 * @attr ref android.R.styleable#View_paddingStart or
 * @attr ref android.R.styleable#View_paddingEnd
 * @return true if the padding is relative or false if it is not.
 */
public boolean isPaddingRelative(){
  return (mUserPaddingStart != UNDEFINED_PADDING || mUserPaddingEnd != UNDEFINED_PADDING);
}

Fixed version (ground truth):
/** 
 * Return if the padding has been set through relative values  {@link #setPaddingRelative(int,int,int,int)} or through
 * @attr ref android.R.styleable#View_paddingStart or
 * @attr ref android.R.styleable#View_paddingEnd
 * @return true if the padding is relative or false if it is not.
 */
public boolean isPaddingRelative(){
  return (mUserPaddingStart != UNDEFINED_PADDING || mUserPaddingEnd != UNDEFINED_PADDING);
}
Program: 195658
Project: 195658
Buggy source:
/** 
 * This is a framework-internal mirror of onDetachedFromWindow() that's called after onDetachedFromWindow(). If you override this you *MUST* call super.onDetachedFromWindowInternal()! The super method should be called at the end of the overriden method to ensure subclasses are destroyed first
 * @hide
 */
protected void onDetachedFromWindowInternal(){
  mPrivateFlags&=~PFLAG_CANCEL_NEXT_UP_EVENT;
  mPrivateFlags3&=~PFLAG3_IS_LAID_OUT;
  removeUnsetPressCallback();
  removeLongPressCallback();
  removePerformClickCallback();
  removeSendViewScrolledAccessibilityEventCallback();
  stopNestedScroll();
  jumpDrawablesToCurrentState();
  destroyDrawingCache();
  cleanupDraw();
  mCurrentAnimation=null;
}

Fixed version (ground truth):
/** 
 * This is a framework-internal mirror of onDetachedFromWindow() that's called after onDetachedFromWindow(). If you override this you *MUST* call super.onDetachedFromWindowInternal()! The super method should be called at the end of the overridden method to ensure subclasses are destroyed first
 * @hide
 */
protected void onDetachedFromWindowInternal(){
  mPrivateFlags&=~PFLAG_CANCEL_NEXT_UP_EVENT;
  mPrivateFlags3&=~PFLAG3_IS_LAID_OUT;
  removeUnsetPressCallback();
  removeLongPressCallback();
  removePerformClickCallback();
  removeSendViewScrolledAccessibilityEventCallback();
  stopNestedScroll();
  jumpDrawablesToCurrentState();
  destroyDrawingCache();
  cleanupDraw();
  mCurrentAnimation=null;
}
Program: 195659
Project: 195659
Buggy source:
private void positionSelector(int position,View sel,boolean manageHotspot,float x,float y){
  final boolean positionChanged=position != mSelectorPosition;
  if (position != INVALID_POSITION) {
    mSelectorPosition=position;
  }
  final Rect selectorRect=mSelectorRect;
  selectorRect.set(sel.getLeft(),sel.getTop(),sel.getRight(),sel.getBottom());
  if (sel instanceof SelectionBoundsAdjuster) {
    ((SelectionBoundsAdjuster)sel).adjustListItemSelectionBounds(selectorRect);
  }
  selectorRect.left-=mSelectionLeftPadding;
  selectorRect.top-=mSelectionTopPadding;
  selectorRect.right+=mSelectionRightPadding;
  selectorRect.bottom+=mSelectionBottomPadding;
  final Drawable selector=mSelector;
  if (selector != null) {
    if (positionChanged) {
      selector.setVisible(false,false);
      selector.setState(StateSet.NOTHING);
    }
    selector.setBounds(selectorRect);
    if (positionChanged) {
      if (getVisibility() == VISIBLE) {
        selector.setVisible(true,false);
      }
      selector.setState(getDrawableState());
    }
    if (manageHotspot) {
      selector.setHotspot(x,y);
    }
  }
  final boolean isChildViewEnabled=mIsChildViewEnabled;
  if (sel.isEnabled() != isChildViewEnabled) {
    mIsChildViewEnabled=!isChildViewEnabled;
    if (getSelectedItemPosition() != INVALID_POSITION) {
      refreshDrawableState();
    }
  }
}

Fixed version (ground truth):
private void positionSelector(int position,View sel,boolean manageHotspot,float x,float y){
  final boolean positionChanged=position != mSelectorPosition;
  if (position != INVALID_POSITION) {
    mSelectorPosition=position;
  }
  final Rect selectorRect=mSelectorRect;
  selectorRect.set(sel.getLeft(),sel.getTop(),sel.getRight(),sel.getBottom());
  if (sel instanceof SelectionBoundsAdjuster) {
    ((SelectionBoundsAdjuster)sel).adjustListItemSelectionBounds(selectorRect);
  }
  selectorRect.left-=mSelectionLeftPadding;
  selectorRect.top-=mSelectionTopPadding;
  selectorRect.right+=mSelectionRightPadding;
  selectorRect.bottom+=mSelectionBottomPadding;
  final Drawable selector=mSelector;
  if (selector != null) {
    if (positionChanged) {
      selector.setVisible(false,false);
      selector.setState(StateSet.NOTHING);
    }
    selector.setBounds(selectorRect);
    if (positionChanged) {
      if (getVisibility() == VISIBLE) {
        selector.setVisible(true,false);
      }
      updateSelectorState();
    }
    if (manageHotspot) {
      selector.setHotspot(x,y);
    }
  }
  final boolean isChildViewEnabled=mIsChildViewEnabled;
  if (sel.isEnabled() != isChildViewEnabled) {
    mIsChildViewEnabled=!isChildViewEnabled;
    if (getSelectedItemPosition() != INVALID_POSITION) {
      refreshDrawableState();
    }
  }
}
Program: 195660
Project: 195660
Buggy source:
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,listener,true);
}

Fixed version (ground truth):
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param handler If <var>listener</var> is non-null this must be a validHandler on which to dispatch the callback; otherwise it should be null.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,handler,listener,true);
}
Program: 195661
Project: 195661
Buggy source:
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating to.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the final thumbnailof the animation.
 * @param startX The x end location of the bitmap, relative to <var>source</var>.
 * @param startY The y end location of the bitmap, relative to <var>source</var>.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,listener,false);
}

Fixed version (ground truth):
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating to.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the final thumbnailof the animation.
 * @param startX The x end location of the bitmap, relative to <var>source</var>.
 * @param startY The y end location of the bitmap, relative to <var>source</var>.
 * @param handler If <var>listener</var> is non-null this must be a validHandler on which to dispatch the callback; otherwise it should be null.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,handler,listener,false);
}
Program: 195662
Project: 195662
Buggy source:
private static ActivityOptions makeAspectScaledThumbnailAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener,boolean scaleUp){
  ActivityOptions opts=new ActivityOptions();
  opts.mPackageName=source.getContext().getPackageName();
  opts.mAnimationType=scaleUp ? ANIM_THUMBNAIL_ASPECT_SCALE_UP : ANIM_THUMBNAIL_ASPECT_SCALE_DOWN;
  opts.mThumbnail=thumbnail;
  int[] pts=new int[2];
  source.getLocationOnScreen(pts);
  opts.mStartX=pts[0] + startX;
  opts.mStartY=pts[1] + startY;
  opts.mWidth=targetWidth;
  opts.mHeight=targetHeight;
  opts.setOnAnimationStartedListener(source.getHandler(),listener);
  return opts;
}

Fixed version (ground truth):
private static ActivityOptions makeAspectScaledThumbnailAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener,boolean scaleUp){
  ActivityOptions opts=new ActivityOptions();
  opts.mPackageName=source.getContext().getPackageName();
  opts.mAnimationType=scaleUp ? ANIM_THUMBNAIL_ASPECT_SCALE_UP : ANIM_THUMBNAIL_ASPECT_SCALE_DOWN;
  opts.mThumbnail=thumbnail;
  int[] pts=new int[2];
  source.getLocationOnScreen(pts);
  opts.mStartX=pts[0] + startX;
  opts.mStartY=pts[1] + startY;
  opts.mWidth=targetWidth;
  opts.mHeight=targetHeight;
  opts.setOnAnimationStartedListener(handler,listener);
  return opts;
}
Program: 195663
Project: 195663
Buggy source:
/** 
 * Creates the activity options for an app->recents transition.
 */
ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStack stack,TaskStackView stackView){
  Task toTask=new Task();
  TaskViewTransform toTransform=getThumbnailTransitionTransform(stack,stackView,topTask.id,toTask);
  if (toTransform != null && toTask.key != null) {
    Rect toTaskRect=toTransform.rect;
    int toHeaderWidth=(int)(mHeaderBar.getMeasuredWidth() * toTransform.scale);
    int toHeaderHeight=(int)(mHeaderBar.getMeasuredHeight() * toTransform.scale);
    Bitmap thumbnail=Bitmap.createBitmap(toHeaderWidth,toHeaderHeight,Bitmap.Config.ARGB_8888);
    if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
      thumbnail.eraseColor(0xFFff0000);
    }
 else {
      Canvas c=new Canvas(thumbnail);
      c.scale(toTransform.scale,toTransform.scale);
      mHeaderBar.rebindToTask(toTask);
      mHeaderBar.draw(c);
      c.setBitmap(null);
    }
    mStartAnimationTriggered=false;
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,toTaskRect.left,toTaskRect.top,toTaskRect.width(),toTaskRect.height(),this);
  }
  return getUnknownTransitionActivityOptions();
}

Fixed version (ground truth):
/** 
 * Creates the activity options for an app->recents transition.
 */
ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStack stack,TaskStackView stackView){
  Task toTask=new Task();
  TaskViewTransform toTransform=getThumbnailTransitionTransform(stack,stackView,topTask.id,toTask);
  if (toTransform != null && toTask.key != null) {
    Rect toTaskRect=toTransform.rect;
    int toHeaderWidth=(int)(mHeaderBar.getMeasuredWidth() * toTransform.scale);
    int toHeaderHeight=(int)(mHeaderBar.getMeasuredHeight() * toTransform.scale);
    Bitmap thumbnail=Bitmap.createBitmap(toHeaderWidth,toHeaderHeight,Bitmap.Config.ARGB_8888);
    if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
      thumbnail.eraseColor(0xFFff0000);
    }
 else {
      Canvas c=new Canvas(thumbnail);
      c.scale(toTransform.scale,toTransform.scale);
      mHeaderBar.rebindToTask(toTask);
      mHeaderBar.draw(c);
      c.setBitmap(null);
    }
    mStartAnimationTriggered=false;
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,toTaskRect.left,toTaskRect.top,toTaskRect.width(),toTaskRect.height(),mHandler,this);
  }
  return getUnknownTransitionActivityOptions();
}
Program: 195665
Project: 195665
Buggy source:
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,listener,true);
}

Fixed version (ground truth):
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param handler If <var>listener</var> is non-null this must be a validHandler on which to dispatch the callback; otherwise it should be null.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,handler,listener,true);
}
Program: 195666
Project: 195666
Buggy source:
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating to.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the final thumbnailof the animation.
 * @param startX The x end location of the bitmap, relative to <var>source</var>.
 * @param startY The y end location of the bitmap, relative to <var>source</var>.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,listener,false);
}

Fixed version (ground truth):
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating to.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the final thumbnailof the animation.
 * @param startX The x end location of the bitmap, relative to <var>source</var>.
 * @param startY The y end location of the bitmap, relative to <var>source</var>.
 * @param handler If <var>listener</var> is non-null this must be a validHandler on which to dispatch the callback; otherwise it should be null.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,handler,listener,false);
}
Program: 195667
Project: 195667
Buggy source:
private static ActivityOptions makeAspectScaledThumbnailAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener,boolean scaleUp){
  ActivityOptions opts=new ActivityOptions();
  opts.mPackageName=source.getContext().getPackageName();
  opts.mAnimationType=scaleUp ? ANIM_THUMBNAIL_ASPECT_SCALE_UP : ANIM_THUMBNAIL_ASPECT_SCALE_DOWN;
  opts.mThumbnail=thumbnail;
  int[] pts=new int[2];
  source.getLocationOnScreen(pts);
  opts.mStartX=pts[0] + startX;
  opts.mStartY=pts[1] + startY;
  opts.mWidth=targetWidth;
  opts.mHeight=targetHeight;
  opts.setOnAnimationStartedListener(source.getHandler(),listener);
  return opts;
}

Fixed version (ground truth):
private static ActivityOptions makeAspectScaledThumbnailAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener,boolean scaleUp){
  ActivityOptions opts=new ActivityOptions();
  opts.mPackageName=source.getContext().getPackageName();
  opts.mAnimationType=scaleUp ? ANIM_THUMBNAIL_ASPECT_SCALE_UP : ANIM_THUMBNAIL_ASPECT_SCALE_DOWN;
  opts.mThumbnail=thumbnail;
  int[] pts=new int[2];
  source.getLocationOnScreen(pts);
  opts.mStartX=pts[0] + startX;
  opts.mStartY=pts[1] + startY;
  opts.mWidth=targetWidth;
  opts.mHeight=targetHeight;
  opts.setOnAnimationStartedListener(handler,listener);
  return opts;
}
Program: 195668
Project: 195668
Buggy source:
/** 
 * Creates the activity options for an app->recents transition.
 */
ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStack stack,TaskStackView stackView){
  Task toTask=new Task();
  TaskViewTransform toTransform=getThumbnailTransitionTransform(stack,stackView,topTask.id,toTask);
  if (toTransform != null && toTask.key != null) {
    Rect toTaskRect=toTransform.rect;
    int toHeaderWidth=(int)(mHeaderBar.getMeasuredWidth() * toTransform.scale);
    int toHeaderHeight=(int)(mHeaderBar.getMeasuredHeight() * toTransform.scale);
    Bitmap thumbnail=Bitmap.createBitmap(toHeaderWidth,toHeaderHeight,Bitmap.Config.ARGB_8888);
    if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
      thumbnail.eraseColor(0xFFff0000);
    }
 else {
      Canvas c=new Canvas(thumbnail);
      c.scale(toTransform.scale,toTransform.scale);
      mHeaderBar.rebindToTask(toTask);
      mHeaderBar.draw(c);
      c.setBitmap(null);
    }
    mStartAnimationTriggered=false;
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,toTaskRect.left,toTaskRect.top,toTaskRect.width(),toTaskRect.height(),this);
  }
  return getUnknownTransitionActivityOptions();
}

Fixed version (ground truth):
/** 
 * Creates the activity options for an app->recents transition.
 */
ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStack stack,TaskStackView stackView){
  Task toTask=new Task();
  TaskViewTransform toTransform=getThumbnailTransitionTransform(stack,stackView,topTask.id,toTask);
  if (toTransform != null && toTask.key != null) {
    Rect toTaskRect=toTransform.rect;
    int toHeaderWidth=(int)(mHeaderBar.getMeasuredWidth() * toTransform.scale);
    int toHeaderHeight=(int)(mHeaderBar.getMeasuredHeight() * toTransform.scale);
    Bitmap thumbnail=Bitmap.createBitmap(toHeaderWidth,toHeaderHeight,Bitmap.Config.ARGB_8888);
    if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
      thumbnail.eraseColor(0xFFff0000);
    }
 else {
      Canvas c=new Canvas(thumbnail);
      c.scale(toTransform.scale,toTransform.scale);
      mHeaderBar.rebindToTask(toTask);
      mHeaderBar.draw(c);
      c.setBitmap(null);
    }
    mStartAnimationTriggered=false;
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,toTaskRect.left,toTaskRect.top,toTaskRect.width(),toTaskRect.height(),mHandler,this);
  }
  return getUnknownTransitionActivityOptions();
}
Program: 195670
Project: 195670
Buggy source:
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,listener,true);
}

Fixed version (ground truth):
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param handler If <var>listener</var> is non-null this must be a validHandler on which to dispatch the callback; otherwise it should be null.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,handler,listener,true);
}
Program: 195671
Project: 195671
Buggy source:
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating to.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the final thumbnailof the animation.
 * @param startX The x end location of the bitmap, relative to <var>source</var>.
 * @param startY The y end location of the bitmap, relative to <var>source</var>.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,listener,false);
}

Fixed version (ground truth):
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating to.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the final thumbnailof the animation.
 * @param startX The x end location of the bitmap, relative to <var>source</var>.
 * @param startY The y end location of the bitmap, relative to <var>source</var>.
 * @param handler If <var>listener</var> is non-null this must be a validHandler on which to dispatch the callback; otherwise it should be null.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,handler,listener,false);
}
Program: 195672
Project: 195672
Buggy source:
private static ActivityOptions makeAspectScaledThumbnailAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener,boolean scaleUp){
  ActivityOptions opts=new ActivityOptions();
  opts.mPackageName=source.getContext().getPackageName();
  opts.mAnimationType=scaleUp ? ANIM_THUMBNAIL_ASPECT_SCALE_UP : ANIM_THUMBNAIL_ASPECT_SCALE_DOWN;
  opts.mThumbnail=thumbnail;
  int[] pts=new int[2];
  source.getLocationOnScreen(pts);
  opts.mStartX=pts[0] + startX;
  opts.mStartY=pts[1] + startY;
  opts.mWidth=targetWidth;
  opts.mHeight=targetHeight;
  opts.setOnAnimationStartedListener(source.getHandler(),listener);
  return opts;
}

Fixed version (ground truth):
private static ActivityOptions makeAspectScaledThumbnailAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener,boolean scaleUp){
  ActivityOptions opts=new ActivityOptions();
  opts.mPackageName=source.getContext().getPackageName();
  opts.mAnimationType=scaleUp ? ANIM_THUMBNAIL_ASPECT_SCALE_UP : ANIM_THUMBNAIL_ASPECT_SCALE_DOWN;
  opts.mThumbnail=thumbnail;
  int[] pts=new int[2];
  source.getLocationOnScreen(pts);
  opts.mStartX=pts[0] + startX;
  opts.mStartY=pts[1] + startY;
  opts.mWidth=targetWidth;
  opts.mHeight=targetHeight;
  opts.setOnAnimationStartedListener(handler,listener);
  return opts;
}
Program: 195673
Project: 195673
Buggy source:
/** 
 * Creates the activity options for an app->recents transition.
 */
ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStack stack,TaskStackView stackView){
  Task toTask=new Task();
  TaskViewTransform toTransform=getThumbnailTransitionTransform(stack,stackView,topTask.id,toTask);
  if (toTransform != null && toTask.key != null) {
    Rect toTaskRect=toTransform.rect;
    int toHeaderWidth=(int)(mHeaderBar.getMeasuredWidth() * toTransform.scale);
    int toHeaderHeight=(int)(mHeaderBar.getMeasuredHeight() * toTransform.scale);
    Bitmap thumbnail=Bitmap.createBitmap(toHeaderWidth,toHeaderHeight,Bitmap.Config.ARGB_8888);
    if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
      thumbnail.eraseColor(0xFFff0000);
    }
 else {
      Canvas c=new Canvas(thumbnail);
      c.scale(toTransform.scale,toTransform.scale);
      mHeaderBar.rebindToTask(toTask);
      mHeaderBar.draw(c);
      c.setBitmap(null);
    }
    mStartAnimationTriggered=false;
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,toTaskRect.left,toTaskRect.top,toTaskRect.width(),toTaskRect.height(),this);
  }
  return getUnknownTransitionActivityOptions();
}

Fixed version (ground truth):
/** 
 * Creates the activity options for an app->recents transition.
 */
ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStack stack,TaskStackView stackView){
  Task toTask=new Task();
  TaskViewTransform toTransform=getThumbnailTransitionTransform(stack,stackView,topTask.id,toTask);
  if (toTransform != null && toTask.key != null) {
    Rect toTaskRect=toTransform.rect;
    int toHeaderWidth=(int)(mHeaderBar.getMeasuredWidth() * toTransform.scale);
    int toHeaderHeight=(int)(mHeaderBar.getMeasuredHeight() * toTransform.scale);
    Bitmap thumbnail=Bitmap.createBitmap(toHeaderWidth,toHeaderHeight,Bitmap.Config.ARGB_8888);
    if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
      thumbnail.eraseColor(0xFFff0000);
    }
 else {
      Canvas c=new Canvas(thumbnail);
      c.scale(toTransform.scale,toTransform.scale);
      mHeaderBar.rebindToTask(toTask);
      mHeaderBar.draw(c);
      c.setBitmap(null);
    }
    mStartAnimationTriggered=false;
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,toTaskRect.left,toTaskRect.top,toTaskRect.width(),toTaskRect.height(),mHandler,this);
  }
  return getUnknownTransitionActivityOptions();
}
Program: 195675
Project: 195675
Buggy source:
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,listener,true);
}

Fixed version (ground truth):
/** 
 * Create an ActivityOptions specifying an animation where the new activity window and a thumbnail is aspect-scaled to a new location.
 * @param source The View that this thumbnail is animating from.  Thisdefines the coordinate space for <var>startX</var> and <var>startY</var>.
 * @param thumbnail The bitmap that will be shown as the initial thumbnailof the animation.
 * @param startX The x starting location of the bitmap, relative to <var>source</var>.
 * @param startY The y starting location of the bitmap, relative to <var>source</var>.
 * @param handler If <var>listener</var> is non-null this must be a validHandler on which to dispatch the callback; otherwise it should be null.
 * @param listener Optional OnAnimationStartedListener to find out when therequested animation has started running.  If for some reason the animation is not executed, the callback will happen immediately.
 * @return Returns a new ActivityOptions object that you can use tosupply these options as the options Bundle when starting an activity.
 * @hide
 */
public static ActivityOptions makeThumbnailAspectScaleUpAnimation(View source,Bitmap thumbnail,int startX,int startY,int targetWidth,int targetHeight,Handler handler,OnAnimationStartedListener listener){
  return makeAspectScaledThumbnailAnimation(source,thumbnail,startX,startY,targetWidth,targetHeight,handler,listener,true);
}