Program: 196027
Project: 196027
Buggy source:
/** 
 * This alternate animation is created when we are doing a thumbnail transition, for the activity that is leaving, and the activity that is entering.
 */
Animation createAspectScaledThumbnailEnterExitAnimationLocked(int thumbTransitState,int appWidth,int appHeight,int orientation,int transit,Rect containingFrame,Rect contentInsets,boolean isFullScreen){
  Animation a;
  final int thumbWidthI=mNextAppTransitionStartWidth;
  final float thumbWidth=thumbWidthI > 0 ? thumbWidthI : 1;
  final int thumbHeightI=mNextAppTransitionStartHeight;
  final float thumbHeight=thumbHeightI > 0 ? thumbHeightI : 1;
  float scale=1f;
  int scaledTopDecor=0;
switch (thumbTransitState) {
case THUMBNAIL_TRANSITION_ENTER_SCALE_UP:
{
      if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        scale=thumbWidth / appWidth;
        scaledTopDecor=(int)(scale * contentInsets.top);
        int unscaledThumbHeight=(int)(thumbHeight / scale);
        mTmpFromClipRect.set(containingFrame);
        if (isFullScreen) {
          mTmpFromClipRect.top=contentInsets.top;
        }
        mTmpFromClipRect.bottom=(mTmpFromClipRect.top + unscaledThumbHeight);
        mTmpToClipRect.set(containingFrame);
      }
 else {
        scale=thumbHeight / (appHeight - contentInsets.top);
        scaledTopDecor=(int)(scale * contentInsets.top);
        int unscaledThumbWidth=(int)(thumbWidth / scale);
        int unscaledThumbHeight=(int)(thumbHeight / scale);
        mTmpFromClipRect.set(containingFrame);
        if (isFullScreen) {
          mTmpFromClipRect.top=contentInsets.top;
          mTmpFromClipRect.bottom=(mTmpFromClipRect.top + unscaledThumbHeight);
        }
        mTmpFromClipRect.right=(mTmpFromClipRect.left + unscaledThumbWidth);
        mTmpToClipRect.set(containingFrame);
      }
      mNextAppTransitionInsets.set(contentInsets);
      Animation scaleAnim=new ScaleAnimation(scale,1,scale,1,computePivot(mNextAppTransitionStartX,scale),computePivot(mNextAppTransitionStartY,scale));
      Animation clipAnim=new ClipRectAnimation(mTmpFromClipRect,mTmpToClipRect);
      Animation translateAnim=new TranslateAnimation(0,0,-scaledTopDecor,0);
      AnimationSet set=new AnimationSet(true);
      set.addAnimation(clipAnim);
      set.addAnimation(scaleAnim);
      set.addAnimation(translateAnim);
      a=set;
      break;
    }
case THUMBNAIL_TRANSITION_EXIT_SCALE_UP:
{
    if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
      a=new AlphaAnimation(1,0);
    }
 else {
      a=new AlphaAnimation(1,1);
    }
    break;
  }
case THUMBNAIL_TRANSITION_ENTER_SCALE_DOWN:
{
  if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
    a=new AlphaAnimation(0,1);
  }
 else {
    a=new AlphaAnimation(1,1);
  }
  break;
}
case THUMBNAIL_TRANSITION_EXIT_SCALE_DOWN:
{
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
  scale=thumbWidth / appWidth;
  scaledTopDecor=(int)(scale * contentInsets.top);
  int unscaledThumbHeight=(int)(thumbHeight / scale);
  mTmpFromClipRect.set(containingFrame);
  mTmpToClipRect.set(containingFrame);
  if (isFullScreen) {
    mTmpToClipRect.top=contentInsets.top;
  }
  mTmpToClipRect.bottom=(mTmpToClipRect.top + unscaledThumbHeight);
}
 else {
  scale=thumbHeight / (appHeight - contentInsets.top);
  scaledTopDecor=(int)(scale * contentInsets.top);
  int unscaledThumbWidth=(int)(thumbWidth / scale);
  int unscaledThumbHeight=(int)(thumbHeight / scale);
  mTmpFromClipRect.set(containingFrame);
  mTmpToClipRect.set(containingFrame);
  if (isFullScreen) {
    mTmpToClipRect.top=contentInsets.top;
    mTmpToClipRect.bottom=(mTmpToClipRect.top + unscaledThumbHeight);
  }
  mTmpToClipRect.right=(mTmpToClipRect.left + unscaledThumbWidth);
}
mNextAppTransitionInsets.set(contentInsets);
Animation scaleAnim=new ScaleAnimation(1,scale,1,scale,computePivot(mNextAppTransitionStartX,scale),computePivot(mNextAppTransitionStartY,scale));
Animation clipAnim=new ClipRectAnimation(mTmpFromClipRect,mTmpToClipRect);
Animation translateAnim=new TranslateAnimation(0,0,0,-scaledTopDecor);
AnimationSet set=new AnimationSet(true);
set.addAnimation(clipAnim);
set.addAnimation(scaleAnim);
set.addAnimation(translateAnim);
a=set;
a.setZAdjustment(Animation.ZORDER_TOP);
break;
}
default :
throw new RuntimeException("String_Node_Str");
}
return prepareThumbnailAnimationWithDuration(a,appWidth,appHeight,THUMBNAIL_APP_TRANSITION_DURATION,mThumbnailFastOutSlowInInterpolator);
}

Fixed version (ground truth):
/** 
 * This alternate animation is created when we are doing a thumbnail transition, for the activity that is leaving, and the activity that is entering.
 */
Animation createAspectScaledThumbnailEnterExitAnimationLocked(int thumbTransitState,int appWidth,int appHeight,int orientation,int transit,Rect containingFrame,Rect contentInsets,boolean isFullScreen){
  Animation a;
  final int thumbWidthI=mNextAppTransitionStartWidth;
  final float thumbWidth=thumbWidthI > 0 ? thumbWidthI : 1;
  final int thumbHeightI=mNextAppTransitionStartHeight;
  final float thumbHeight=thumbHeightI > 0 ? thumbHeightI : 1;
  float scale=1f;
  int scaledTopDecor=0;
switch (thumbTransitState) {
case THUMBNAIL_TRANSITION_ENTER_SCALE_UP:
{
      if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        scale=thumbWidth / appWidth;
        scaledTopDecor=(int)(scale * contentInsets.top);
        int unscaledThumbHeight=(int)(thumbHeight / scale);
        mTmpFromClipRect.set(containingFrame);
        if (isFullScreen) {
          mTmpFromClipRect.top=contentInsets.top;
        }
        mTmpFromClipRect.bottom=(mTmpFromClipRect.top + unscaledThumbHeight);
        mTmpToClipRect.set(containingFrame);
      }
 else {
        scale=thumbHeight / (appHeight - contentInsets.top);
        scaledTopDecor=(int)(scale * contentInsets.top);
        int unscaledThumbWidth=(int)(thumbWidth / scale);
        int unscaledThumbHeight=(int)(thumbHeight / scale);
        mTmpFromClipRect.set(containingFrame);
        if (isFullScreen) {
          mTmpFromClipRect.top=contentInsets.top;
          mTmpFromClipRect.bottom=(mTmpFromClipRect.top + unscaledThumbHeight);
        }
        mTmpFromClipRect.right=(mTmpFromClipRect.left + unscaledThumbWidth);
        mTmpToClipRect.set(containingFrame);
      }
      mNextAppTransitionInsets.set(contentInsets);
      Animation scaleAnim=new ScaleAnimation(scale,1,scale,1,computePivot(mNextAppTransitionStartX,scale),computePivot(mNextAppTransitionStartY,scale));
      Animation clipAnim=new ClipRectAnimation(mTmpFromClipRect,mTmpToClipRect);
      Animation translateAnim=new TranslateAnimation(0,0,-scaledTopDecor,0);
      AnimationSet set=new AnimationSet(true);
      set.addAnimation(clipAnim);
      set.addAnimation(scaleAnim);
      set.addAnimation(translateAnim);
      a=set;
      break;
    }
case THUMBNAIL_TRANSITION_EXIT_SCALE_UP:
{
    if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
      a=new AlphaAnimation(1,0);
    }
 else {
      a=new AlphaAnimation(1,1);
    }
    break;
  }
case THUMBNAIL_TRANSITION_ENTER_SCALE_DOWN:
{
  if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
    a=new AlphaAnimation(0,1);
  }
 else {
    a=new AlphaAnimation(1,1);
  }
  break;
}
case THUMBNAIL_TRANSITION_EXIT_SCALE_DOWN:
{
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
  scale=thumbWidth / appWidth;
  scaledTopDecor=(int)(scale * contentInsets.top);
  int unscaledThumbHeight=(int)(thumbHeight / scale);
  mTmpFromClipRect.set(containingFrame);
  mTmpToClipRect.set(containingFrame);
  if (isFullScreen) {
    mTmpToClipRect.top=contentInsets.top;
  }
  mTmpToClipRect.bottom=(mTmpToClipRect.top + unscaledThumbHeight);
}
 else {
  scale=thumbHeight / (appHeight - contentInsets.top);
  scaledTopDecor=(int)(scale * contentInsets.top);
  int unscaledThumbWidth=(int)(thumbWidth / scale);
  int unscaledThumbHeight=(int)(thumbHeight / scale);
  mTmpFromClipRect.set(containingFrame);
  mTmpToClipRect.set(containingFrame);
  if (isFullScreen) {
    mTmpToClipRect.top=contentInsets.top;
    mTmpToClipRect.bottom=(mTmpToClipRect.top + unscaledThumbHeight);
  }
  mTmpToClipRect.right=(mTmpToClipRect.left + unscaledThumbWidth);
}
mNextAppTransitionInsets.set(contentInsets);
Animation scaleAnim=new ScaleAnimation(1,scale,1,scale,computePivot(mNextAppTransitionStartX,scale),computePivot(mNextAppTransitionStartY,scale));
Animation clipAnim=new ClipRectAnimation(mTmpFromClipRect,mTmpToClipRect);
Animation translateAnim=new TranslateAnimation(0,0,0,-scaledTopDecor);
AnimationSet set=new AnimationSet(true);
set.addAnimation(clipAnim);
set.addAnimation(scaleAnim);
set.addAnimation(translateAnim);
a=set;
a.setZAdjustment(Animation.ZORDER_TOP);
break;
}
default :
throw new RuntimeException("String_Node_Str");
}
int duration=Math.max(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION,THUMBNAIL_APP_TRANSITION_DURATION);
return prepareThumbnailAnimationWithDuration(a,appWidth,appHeight,duration,mThumbnailFastOutSlowInInterpolator);
}