Program: 2009
Project: 2009
Buggy source:
@Override public void computeFrameLw(Rect pf,Rect df,Rect of,Rect cf,Rect vf){
  mHaveFrame=true;
  final int type=mAttrs.type;
  if (mAppToken != null) {
    mContainingFrame.set(getStackBounds());
  }
 else {
    mContainingFrame.set(pf);
  }
  mDisplayFrame.set(df);
  final int pw=mContainingFrame.width();
  final int ph=mContainingFrame.height();
  int w, h;
  if ((mAttrs.flags & WindowManager.LayoutParams.FLAG_SCALED) != 0) {
    if (mAttrs.width < 0) {
      w=pw;
    }
 else     if (mEnforceSizeCompat) {
      w=(int)(mAttrs.width * mGlobalScale + .5f);
    }
 else {
      w=mAttrs.width;
    }
    if (mAttrs.height < 0) {
      h=ph;
    }
 else     if (mEnforceSizeCompat) {
      h=(int)(mAttrs.height * mGlobalScale + .5f);
    }
 else {
      h=mAttrs.height;
    }
  }
 else {
    if (mAttrs.width == WindowManager.LayoutParams.MATCH_PARENT) {
      w=pw;
    }
 else     if (mEnforceSizeCompat) {
      w=(int)(mRequestedWidth * mGlobalScale + .5f);
    }
 else {
      w=mRequestedWidth;
    }
    if (mAttrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
      h=ph;
    }
 else     if (mEnforceSizeCompat) {
      h=(int)(mRequestedHeight * mGlobalScale + .5f);
    }
 else {
      h=mRequestedHeight;
    }
  }
  if (!mParentFrame.equals(pf)) {
    mParentFrame.set(pf);
    mContentChanged=true;
  }
  if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
    mLastRequestedWidth=mRequestedWidth;
    mLastRequestedHeight=mRequestedHeight;
    mContentChanged=true;
  }
  mOverscanFrame.set(of);
  mContentFrame.set(cf);
  mVisibleFrame.set(vf);
  final int fw=mFrame.width();
  final int fh=mFrame.height();
  float x, y;
  if (mEnforceSizeCompat) {
    x=mAttrs.x * mGlobalScale;
    y=mAttrs.y * mGlobalScale;
  }
 else {
    x=mAttrs.x;
    y=mAttrs.y;
  }
  Gravity.apply(mAttrs.gravity,w,h,mContainingFrame,(int)(x + mAttrs.horizontalMargin * pw),(int)(y + mAttrs.verticalMargin * ph),mFrame);
  Gravity.applyDisplay(mAttrs.gravity,df,mFrame);
  mContentFrame.set(Math.max(mContentFrame.left,mFrame.left),Math.max(mContentFrame.top,mFrame.top),Math.min(mContentFrame.right,mFrame.right),Math.min(mContentFrame.bottom,mFrame.bottom));
  mVisibleFrame.set(Math.max(mVisibleFrame.left,mFrame.left),Math.max(mVisibleFrame.top,mFrame.top),Math.min(mVisibleFrame.right,mFrame.right),Math.min(mVisibleFrame.bottom,mFrame.bottom));
  mOverscanInsets.set(mOverscanFrame.left - mFrame.left,mOverscanFrame.top - mFrame.top,mFrame.right - mOverscanFrame.right,mFrame.bottom - mOverscanFrame.bottom);
  mContentInsets.set(mContentFrame.left - mFrame.left,mContentFrame.top - mFrame.top,mFrame.right - mContentFrame.right,mFrame.bottom - mContentFrame.bottom);
  mVisibleInsets.set(mVisibleFrame.left - mFrame.left,mVisibleFrame.top - mFrame.top,mFrame.right - mVisibleFrame.right,mFrame.bottom - mVisibleFrame.bottom);
  mCompatFrame.set(mFrame);
  if (mEnforceSizeCompat) {
    mOverscanInsets.scale(mInvGlobalScale);
    mContentInsets.scale(mInvGlobalScale);
    mVisibleInsets.scale(mInvGlobalScale);
    mCompatFrame.scale(mInvGlobalScale);
  }
  if (mIsWallpaper && (fw != mFrame.width() || fh != mFrame.height())) {
    final DisplayInfo displayInfo=mDisplayContent.getDisplayInfo();
    mService.updateWallpaperOffsetLocked(this,displayInfo.appWidth,displayInfo.appHeight,false);
  }
  if (WindowManagerService.localLOGV) {
    Slog.v(TAG,"String_Node_Str" + mRequestedWidth + "String_Node_Str"+ mRequestedHeight+ "String_Node_Str"+ "String_Node_Str"+ pw+ "String_Node_Str"+ ph+ "String_Node_Str"+ mFrame.toShortString()+ "String_Node_Str"+ mContentInsets.toShortString()+ "String_Node_Str"+ mVisibleInsets.toShortString());
  }
}

Fixed version (ground truth):
@Override public void computeFrameLw(Rect pf,Rect df,Rect of,Rect cf,Rect vf){
  mHaveFrame=true;
  final int type=mAttrs.type;
  if (mAppToken != null) {
    mContainingFrame.set(getStackBounds());
  }
 else {
    mContainingFrame.set(pf);
  }
  mDisplayFrame.set(df);
  final int pw=mContainingFrame.width();
  final int ph=mContainingFrame.height();
  int w, h;
  if ((mAttrs.flags & WindowManager.LayoutParams.FLAG_SCALED) != 0) {
    if (mAttrs.width < 0) {
      w=pw;
    }
 else     if (mEnforceSizeCompat) {
      w=(int)(mAttrs.width * mGlobalScale + .5f);
    }
 else {
      w=mAttrs.width;
    }
    if (mAttrs.height < 0) {
      h=ph;
    }
 else     if (mEnforceSizeCompat) {
      h=(int)(mAttrs.height * mGlobalScale + .5f);
    }
 else {
      h=mAttrs.height;
    }
  }
 else {
    if (mAttrs.width == WindowManager.LayoutParams.MATCH_PARENT) {
      w=pw;
    }
 else     if (mEnforceSizeCompat) {
      w=(int)(mRequestedWidth * mGlobalScale + .5f);
    }
 else {
      w=mRequestedWidth;
    }
    if (mAttrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
      h=ph;
    }
 else     if (mEnforceSizeCompat) {
      h=(int)(mRequestedHeight * mGlobalScale + .5f);
    }
 else {
      h=mRequestedHeight;
    }
  }
  if (!mParentFrame.equals(pf)) {
    mParentFrame.set(pf);
    mContentChanged=true;
  }
  if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
    mLastRequestedWidth=mRequestedWidth;
    mLastRequestedHeight=mRequestedHeight;
    mContentChanged=true;
  }
  mOverscanFrame.set(of);
  mContentFrame.set(cf);
  mVisibleFrame.set(vf);
  final int fw=mFrame.width();
  final int fh=mFrame.height();
  float x, y;
  if (mEnforceSizeCompat) {
    x=mAttrs.x * mGlobalScale;
    y=mAttrs.y * mGlobalScale;
  }
 else {
    x=mAttrs.x;
    y=mAttrs.y;
  }
  Gravity.apply(mAttrs.gravity,w,h,mContainingFrame,(int)(x + mAttrs.horizontalMargin * pw),(int)(y + mAttrs.verticalMargin * ph),mFrame);
  Gravity.applyDisplay(mAttrs.gravity,df,mFrame);
  mContentFrame.set(Math.max(mContentFrame.left,mFrame.left),Math.max(mContentFrame.top,mFrame.top),Math.min(mContentFrame.right,mFrame.right),Math.min(mContentFrame.bottom,mFrame.bottom));
  mVisibleFrame.set(Math.max(mVisibleFrame.left,mFrame.left),Math.max(mVisibleFrame.top,mFrame.top),Math.min(mVisibleFrame.right,mFrame.right),Math.min(mVisibleFrame.bottom,mFrame.bottom));
  mOverscanInsets.set(Math.max(mOverscanFrame.left - mFrame.left,0),Math.max(mOverscanFrame.top - mFrame.top,0),Math.max(mFrame.right - mOverscanFrame.right,0),Math.max(mFrame.bottom - mOverscanFrame.bottom,0));
  mContentInsets.set(mContentFrame.left - mFrame.left,mContentFrame.top - mFrame.top,mFrame.right - mContentFrame.right,mFrame.bottom - mContentFrame.bottom);
  mVisibleInsets.set(mVisibleFrame.left - mFrame.left,mVisibleFrame.top - mFrame.top,mFrame.right - mVisibleFrame.right,mFrame.bottom - mVisibleFrame.bottom);
  mCompatFrame.set(mFrame);
  if (mEnforceSizeCompat) {
    mOverscanInsets.scale(mInvGlobalScale);
    mContentInsets.scale(mInvGlobalScale);
    mVisibleInsets.scale(mInvGlobalScale);
    mCompatFrame.scale(mInvGlobalScale);
  }
  if (mIsWallpaper && (fw != mFrame.width() || fh != mFrame.height())) {
    final DisplayInfo displayInfo=mDisplayContent.getDisplayInfo();
    mService.updateWallpaperOffsetLocked(this,displayInfo.appWidth,displayInfo.appHeight,false);
  }
  if (WindowManagerService.localLOGV) {
    Slog.v(TAG,"String_Node_Str" + mRequestedWidth + "String_Node_Str"+ mRequestedHeight+ "String_Node_Str"+ "String_Node_Str"+ pw+ "String_Node_Str"+ ph+ "String_Node_Str"+ mFrame.toShortString()+ "String_Node_Str"+ mContentInsets.toShortString()+ "String_Node_Str"+ mVisibleInsets.toShortString());
  }
}