Program: 193631
Project: 193631
Buggy source:
@Override public void computeFrameLw(Rect pf,Rect df,Rect of,Rect cf,Rect vf,Rect dcf,Rect sf,Rect osf){
  if (mAppToken != null && mAppToken.mReplacingWindow && (mExiting || !mAppToken.mReplacingRemoveRequested)) {
    return;
  }
  mHaveFrame=true;
  final Task task=mAppToken != null ? getTask() : null;
  final boolean nonFullscreenTask=task != null && !task.isFullscreen();
  final boolean freeformWorkspace=task != null && task.inFreeformWorkspace();
  if (nonFullscreenTask) {
    task.getBounds(mContainingFrame);
    final WindowState imeWin=mService.mInputMethodWindow;
    if (imeWin != null && imeWin.isVisibleNow() && mService.mInputMethodTarget == this && mContainingFrame.bottom > cf.bottom) {
      mContainingFrame.top-=mContainingFrame.bottom - cf.bottom;
    }
    if (freeformWorkspace) {
      if (mContainingFrame.isEmpty()) {
        mContainingFrame.set(cf);
      }
    }
 else {
      if (!mContainingFrame.intersect(cf)) {
        mContainingFrame.set(cf);
      }
    }
    mDisplayFrame.set(mContainingFrame);
  }
 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);
  mDecorFrame.set(dcf);
  mStableFrame.set(sf);
  final boolean hasOutsets=osf != null;
  if (hasOutsets) {
    mOutsetFrame.set(osf);
  }
  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;
  }
  if (nonFullscreenTask) {
    w=Math.min(w,pw);
    h=Math.min(h,ph);
  }
  Gravity.apply(mAttrs.gravity,w,h,mContainingFrame,(int)(x + mAttrs.horizontalMargin * pw),(int)(y + mAttrs.verticalMargin * ph),mFrame);
  Gravity.applyDisplay(mAttrs.gravity,mDisplayFrame,mFrame);
  if (hasOutsets) {
    mOutsets.set(Math.max(mContentFrame.left - mOutsetFrame.left,0),Math.max(mContentFrame.top - mOutsetFrame.top,0),Math.max(mOutsetFrame.right - mContentFrame.right,0),Math.max(mOutsetFrame.bottom - mContentFrame.bottom,0));
  }
 else {
    mOutsets.set(0,0,0,0);
  }
  if (freeformWorkspace && !mFrame.isEmpty()) {
    final int height=Math.min(mFrame.height(),mContentFrame.height());
    final int width=Math.min(mContentFrame.width(),mFrame.width());
    final DisplayMetrics displayMetrics=getDisplayContent().getDisplayMetrics();
    final int minVisibleHeight=mService.dipToPixel(MINIMUM_VISIBLE_HEIGHT_IN_DP,displayMetrics);
    final int minVisibleWidth=mService.dipToPixel(MINIMUM_VISIBLE_WIDTH_IN_DP,displayMetrics);
    final int top=Math.max(mContentFrame.top,Math.min(mFrame.top,mContentFrame.bottom - minVisibleHeight));
    final int left=Math.max(mContentFrame.left + minVisibleWidth - width,Math.min(mFrame.left,mContentFrame.right - minVisibleWidth));
    mFrame.set(left,top,left + width,top + height);
    mContentFrame.set(mFrame);
    mVisibleFrame.set(mContentFrame);
    mStableFrame.set(mContentFrame);
  }
 else {
    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));
    mStableFrame.set(Math.max(mStableFrame.left,mFrame.left),Math.max(mStableFrame.top,mFrame.top),Math.min(mStableFrame.right,mFrame.right),Math.min(mStableFrame.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);
  mStableInsets.set(Math.max(mStableFrame.left - mFrame.left,0),Math.max(mStableFrame.top - mFrame.top,0),Math.max(mFrame.right - mStableFrame.right,0),Math.max(mFrame.bottom - mStableFrame.bottom,0));
  mCompatFrame.set(mFrame);
  if (mEnforceSizeCompat) {
    mOverscanInsets.scale(mInvGlobalScale);
    mContentInsets.scale(mInvGlobalScale);
    mVisibleInsets.scale(mInvGlobalScale);
    mStableInsets.scale(mInvGlobalScale);
    mOutsets.scale(mInvGlobalScale);
    mCompatFrame.scale(mInvGlobalScale);
  }
  if (mIsWallpaper && (fw != mFrame.width() || fh != mFrame.height())) {
    final DisplayContent displayContent=getDisplayContent();
    if (displayContent != null) {
      final DisplayInfo displayInfo=displayContent.getDisplayInfo();
      mService.mWallpaperControllerLocked.updateWallpaperOffset(this,displayInfo.logicalWidth,displayInfo.logicalHeight,false);
    }
  }
  if (DEBUG_LAYOUT || 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()+ "String_Node_Str"+ mStableInsets.toShortString()+ "String_Node_Str"+ mOutsets.toShortString());
}

Fixed version (ground truth):
@Override public void computeFrameLw(Rect pf,Rect df,Rect of,Rect cf,Rect vf,Rect dcf,Rect sf,Rect osf){
  if (mAppToken != null && mAppToken.mReplacingWindow && (mExiting || !mAppToken.mReplacingRemoveRequested)) {
    return;
  }
  mHaveFrame=true;
  final Task task=getTask();
  final boolean nonFullscreenTask=task != null && !task.isFullscreen();
  final boolean freeformWorkspace=task != null && task.inFreeformWorkspace();
  if (nonFullscreenTask) {
    task.getBounds(mContainingFrame);
    final WindowState imeWin=mService.mInputMethodWindow;
    if (imeWin != null && imeWin.isVisibleNow() && mService.mInputMethodTarget == this && mContainingFrame.bottom > cf.bottom) {
      mContainingFrame.top-=mContainingFrame.bottom - cf.bottom;
    }
    if (freeformWorkspace) {
      if (mContainingFrame.isEmpty()) {
        mContainingFrame.set(cf);
      }
    }
 else {
      if (!mContainingFrame.intersect(cf)) {
        mContainingFrame.set(cf);
      }
    }
    mDisplayFrame.set(mContainingFrame);
  }
 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);
  mDecorFrame.set(dcf);
  mStableFrame.set(sf);
  final boolean hasOutsets=osf != null;
  if (hasOutsets) {
    mOutsetFrame.set(osf);
  }
  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;
  }
  if (nonFullscreenTask) {
    w=Math.min(w,pw);
    h=Math.min(h,ph);
  }
  Gravity.apply(mAttrs.gravity,w,h,mContainingFrame,(int)(x + mAttrs.horizontalMargin * pw),(int)(y + mAttrs.verticalMargin * ph),mFrame);
  Gravity.applyDisplay(mAttrs.gravity,mDisplayFrame,mFrame);
  if (hasOutsets) {
    mOutsets.set(Math.max(mContentFrame.left - mOutsetFrame.left,0),Math.max(mContentFrame.top - mOutsetFrame.top,0),Math.max(mOutsetFrame.right - mContentFrame.right,0),Math.max(mOutsetFrame.bottom - mContentFrame.bottom,0));
  }
 else {
    mOutsets.set(0,0,0,0);
  }
  if (freeformWorkspace && !mFrame.isEmpty()) {
    final int height=Math.min(mFrame.height(),mContentFrame.height());
    final int width=Math.min(mContentFrame.width(),mFrame.width());
    final DisplayMetrics displayMetrics=getDisplayContent().getDisplayMetrics();
    final int minVisibleHeight=mService.dipToPixel(MINIMUM_VISIBLE_HEIGHT_IN_DP,displayMetrics);
    final int minVisibleWidth=mService.dipToPixel(MINIMUM_VISIBLE_WIDTH_IN_DP,displayMetrics);
    final int top=Math.max(mContentFrame.top,Math.min(mFrame.top,mContentFrame.bottom - minVisibleHeight));
    final int left=Math.max(mContentFrame.left + minVisibleWidth - width,Math.min(mFrame.left,mContentFrame.right - minVisibleWidth));
    mFrame.set(left,top,left + width,top + height);
    mContentFrame.set(mFrame);
    mVisibleFrame.set(mContentFrame);
    mStableFrame.set(mContentFrame);
  }
 else {
    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));
    mStableFrame.set(Math.max(mStableFrame.left,mFrame.left),Math.max(mStableFrame.top,mFrame.top),Math.min(mStableFrame.right,mFrame.right),Math.min(mStableFrame.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);
  mStableInsets.set(Math.max(mStableFrame.left - mFrame.left,0),Math.max(mStableFrame.top - mFrame.top,0),Math.max(mFrame.right - mStableFrame.right,0),Math.max(mFrame.bottom - mStableFrame.bottom,0));
  mCompatFrame.set(mFrame);
  if (mEnforceSizeCompat) {
    mOverscanInsets.scale(mInvGlobalScale);
    mContentInsets.scale(mInvGlobalScale);
    mVisibleInsets.scale(mInvGlobalScale);
    mStableInsets.scale(mInvGlobalScale);
    mOutsets.scale(mInvGlobalScale);
    mCompatFrame.scale(mInvGlobalScale);
  }
  if (mIsWallpaper && (fw != mFrame.width() || fh != mFrame.height())) {
    final DisplayContent displayContent=getDisplayContent();
    if (displayContent != null) {
      final DisplayInfo displayInfo=displayContent.getDisplayInfo();
      mService.mWallpaperControllerLocked.updateWallpaperOffset(this,displayInfo.logicalWidth,displayInfo.logicalHeight,false);
    }
  }
  if (DEBUG_LAYOUT || 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()+ "String_Node_Str"+ mStableInsets.toShortString()+ "String_Node_Str"+ mOutsets.toShortString());
}