Program: 191659
Project: 191659
Buggy source:
@Override public void computeFrameLw(Rect pf,Rect df,Rect of,Rect cf,Rect vf,Rect dcf,Rect sf,Rect osf){
  if (mWillReplaceWindow && (mAnimatingExit || !mReplacingRemoveRequested)) {
    return;
  }
  mHaveFrame=true;
  final Task task=getTask();
  final boolean fullscreenTask=!isInMultiWindowMode();
  final boolean windowsAreFloating=task != null && task.isFloating();
  if (fullscreenTask) {
    mInsetFrame.setEmpty();
  }
 else {
    task.getTempInsetBounds(mInsetFrame);
  }
  final Rect layoutContainingFrame;
  final Rect layoutDisplayFrame;
  final int layoutXDiff;
  final int layoutYDiff;
  if (mInsetFrame.isEmpty() && (fullscreenTask || layoutInParentFrame())) {
    mContainingFrame.set(pf);
    mDisplayFrame.set(df);
    layoutDisplayFrame=df;
    layoutContainingFrame=pf;
    layoutXDiff=0;
    layoutYDiff=0;
  }
 else {
    task.getBounds(mContainingFrame);
    if (mAppToken != null && !mAppToken.mFrozenBounds.isEmpty()) {
      Rect frozen=mAppToken.mFrozenBounds.peek();
      mContainingFrame.right=mContainingFrame.left + frozen.width();
      mContainingFrame.bottom=mContainingFrame.top + frozen.height();
    }
    final WindowState imeWin=mService.mInputMethodWindow;
    if (imeWin != null && imeWin.isVisibleNow() && mService.mInputMethodTarget == this) {
      if (windowsAreFloating && mContainingFrame.bottom > cf.bottom) {
        mContainingFrame.top-=mContainingFrame.bottom - cf.bottom;
      }
 else       if (mContainingFrame.bottom > pf.bottom) {
        mContainingFrame.bottom=pf.bottom;
      }
    }
    if (windowsAreFloating) {
      if (mContainingFrame.isEmpty()) {
        mContainingFrame.set(cf);
      }
    }
    mDisplayFrame.set(mContainingFrame);
    layoutXDiff=!mInsetFrame.isEmpty() ? mInsetFrame.left - mContainingFrame.left : 0;
    layoutYDiff=!mInsetFrame.isEmpty() ? mInsetFrame.top - mContainingFrame.top : 0;
    layoutContainingFrame=!mInsetFrame.isEmpty() ? mInsetFrame : mContainingFrame;
    mTmpRect.set(0,0,mDisplayContent.getDisplayInfo().logicalWidth,mDisplayContent.getDisplayInfo().logicalHeight);
    subtractInsets(mDisplayFrame,layoutContainingFrame,df,mTmpRect);
    if (!layoutInParentFrame()) {
      subtractInsets(mContainingFrame,layoutContainingFrame,pf,mTmpRect);
      subtractInsets(mInsetFrame,layoutContainingFrame,pf,mTmpRect);
    }
    layoutDisplayFrame=df;
    layoutDisplayFrame.intersect(layoutContainingFrame);
  }
  final int pw=mContainingFrame.width();
  final int ph=mContainingFrame.height();
  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();
  applyGravityAndUpdateFrame(layoutContainingFrame,layoutDisplayFrame);
  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 (windowsAreFloating && !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=WindowManagerService.dipToPixel(MINIMUM_VISIBLE_HEIGHT_IN_DP,displayMetrics);
    final int minVisibleWidth=WindowManagerService.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   if (mAttrs.type == TYPE_DOCK_DIVIDER) {
    mDisplayContent.getDockedDividerController().positionDockedStackedDivider(mFrame);
    mContentFrame.set(mFrame);
    if (!mFrame.equals(mLastFrame)) {
      mMovedByResize=true;
    }
  }
 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));
  }
  if (fullscreenTask && !windowsAreFloating) {
    mOverscanInsets.set(Math.max(mOverscanFrame.left - layoutContainingFrame.left,0),Math.max(mOverscanFrame.top - layoutContainingFrame.top,0),Math.max(layoutContainingFrame.right - mOverscanFrame.right,0),Math.max(layoutContainingFrame.bottom - mOverscanFrame.bottom,0));
  }
  if (mAttrs.type == TYPE_DOCK_DIVIDER) {
    mStableInsets.set(Math.max(mStableFrame.left - mDisplayFrame.left,0),Math.max(mStableFrame.top - mDisplayFrame.top,0),Math.max(mDisplayFrame.right - mStableFrame.right,0),Math.max(mDisplayFrame.bottom - mStableFrame.bottom,0));
    mContentInsets.setEmpty();
    mVisibleInsets.setEmpty();
  }
 else {
    getDisplayContent().getLogicalDisplayRect(mTmpRect);
    boolean overrideRightInset=!fullscreenTask && mFrame.right > mTmpRect.right;
    boolean overrideBottomInset=!fullscreenTask && mFrame.bottom > mTmpRect.bottom;
    mContentInsets.set(mContentFrame.left - mFrame.left,mContentFrame.top - mFrame.top,overrideRightInset ? mTmpRect.right - mContentFrame.right : mFrame.right - mContentFrame.right,overrideBottomInset ? mTmpRect.bottom - mContentFrame.bottom : mFrame.bottom - mContentFrame.bottom);
    mVisibleInsets.set(mVisibleFrame.left - mFrame.left,mVisibleFrame.top - mFrame.top,overrideRightInset ? mTmpRect.right - mVisibleFrame.right : mFrame.right - mVisibleFrame.right,overrideBottomInset ? mTmpRect.bottom - mVisibleFrame.bottom : mFrame.bottom - mVisibleFrame.bottom);
    mStableInsets.set(Math.max(mStableFrame.left - mFrame.left,0),Math.max(mStableFrame.top - mFrame.top,0),overrideRightInset ? Math.max(mTmpRect.right - mStableFrame.right,0) : Math.max(mFrame.right - mStableFrame.right,0),overrideBottomInset ? Math.max(mTmpRect.bottom - mStableFrame.bottom,0) : Math.max(mFrame.bottom - mStableFrame.bottom,0));
  }
  mFrame.offset(-layoutXDiff,-layoutYDiff);
  mCompatFrame.offset(-layoutXDiff,-layoutYDiff);
  mContentFrame.offset(-layoutXDiff,-layoutYDiff);
  mVisibleFrame.offset(-layoutXDiff,-layoutYDiff);
  mStableFrame.offset(-layoutXDiff,-layoutYDiff);
  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 (mWillReplaceWindow && (mAnimatingExit || !mReplacingRemoveRequested)) {
    return;
  }
  mHaveFrame=true;
  final Task task=getTask();
  final boolean fullscreenTask=!isInMultiWindowMode();
  final boolean windowsAreFloating=task != null && task.isFloating();
  if (fullscreenTask) {
    mInsetFrame.setEmpty();
  }
 else {
    task.getTempInsetBounds(mInsetFrame);
  }
  final Rect layoutContainingFrame;
  final Rect layoutDisplayFrame;
  final int layoutXDiff;
  final int layoutYDiff;
  if (fullscreenTask || layoutInParentFrame()) {
    mContainingFrame.set(pf);
    mDisplayFrame.set(df);
    layoutDisplayFrame=df;
    layoutContainingFrame=pf;
    layoutXDiff=0;
    layoutYDiff=0;
  }
 else {
    task.getBounds(mContainingFrame);
    if (mAppToken != null && !mAppToken.mFrozenBounds.isEmpty()) {
      Rect frozen=mAppToken.mFrozenBounds.peek();
      mContainingFrame.right=mContainingFrame.left + frozen.width();
      mContainingFrame.bottom=mContainingFrame.top + frozen.height();
    }
    final WindowState imeWin=mService.mInputMethodWindow;
    if (imeWin != null && imeWin.isVisibleNow() && mService.mInputMethodTarget == this) {
      if (windowsAreFloating && mContainingFrame.bottom > cf.bottom) {
        mContainingFrame.top-=mContainingFrame.bottom - cf.bottom;
      }
 else       if (mContainingFrame.bottom > pf.bottom) {
        mContainingFrame.bottom=pf.bottom;
      }
    }
    if (windowsAreFloating) {
      if (mContainingFrame.isEmpty()) {
        mContainingFrame.set(cf);
      }
    }
    mDisplayFrame.set(mContainingFrame);
    layoutXDiff=!mInsetFrame.isEmpty() ? mInsetFrame.left - mContainingFrame.left : 0;
    layoutYDiff=!mInsetFrame.isEmpty() ? mInsetFrame.top - mContainingFrame.top : 0;
    layoutContainingFrame=!mInsetFrame.isEmpty() ? mInsetFrame : mContainingFrame;
    mTmpRect.set(0,0,mDisplayContent.getDisplayInfo().logicalWidth,mDisplayContent.getDisplayInfo().logicalHeight);
    subtractInsets(mDisplayFrame,layoutContainingFrame,df,mTmpRect);
    if (!layoutInParentFrame()) {
      subtractInsets(mContainingFrame,layoutContainingFrame,pf,mTmpRect);
      subtractInsets(mInsetFrame,layoutContainingFrame,pf,mTmpRect);
    }
    layoutDisplayFrame=df;
    layoutDisplayFrame.intersect(layoutContainingFrame);
  }
  final int pw=mContainingFrame.width();
  final int ph=mContainingFrame.height();
  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();
  applyGravityAndUpdateFrame(layoutContainingFrame,layoutDisplayFrame);
  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 (windowsAreFloating && !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=WindowManagerService.dipToPixel(MINIMUM_VISIBLE_HEIGHT_IN_DP,displayMetrics);
    final int minVisibleWidth=WindowManagerService.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   if (mAttrs.type == TYPE_DOCK_DIVIDER) {
    mDisplayContent.getDockedDividerController().positionDockedStackedDivider(mFrame);
    mContentFrame.set(mFrame);
    if (!mFrame.equals(mLastFrame)) {
      mMovedByResize=true;
    }
  }
 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));
  }
  if (fullscreenTask && !windowsAreFloating) {
    mOverscanInsets.set(Math.max(mOverscanFrame.left - layoutContainingFrame.left,0),Math.max(mOverscanFrame.top - layoutContainingFrame.top,0),Math.max(layoutContainingFrame.right - mOverscanFrame.right,0),Math.max(layoutContainingFrame.bottom - mOverscanFrame.bottom,0));
  }
  if (mAttrs.type == TYPE_DOCK_DIVIDER) {
    mStableInsets.set(Math.max(mStableFrame.left - mDisplayFrame.left,0),Math.max(mStableFrame.top - mDisplayFrame.top,0),Math.max(mDisplayFrame.right - mStableFrame.right,0),Math.max(mDisplayFrame.bottom - mStableFrame.bottom,0));
    mContentInsets.setEmpty();
    mVisibleInsets.setEmpty();
  }
 else {
    getDisplayContent().getLogicalDisplayRect(mTmpRect);
    boolean overrideRightInset=!fullscreenTask && mFrame.right > mTmpRect.right;
    boolean overrideBottomInset=!fullscreenTask && mFrame.bottom > mTmpRect.bottom;
    mContentInsets.set(mContentFrame.left - mFrame.left,mContentFrame.top - mFrame.top,overrideRightInset ? mTmpRect.right - mContentFrame.right : mFrame.right - mContentFrame.right,overrideBottomInset ? mTmpRect.bottom - mContentFrame.bottom : mFrame.bottom - mContentFrame.bottom);
    mVisibleInsets.set(mVisibleFrame.left - mFrame.left,mVisibleFrame.top - mFrame.top,overrideRightInset ? mTmpRect.right - mVisibleFrame.right : mFrame.right - mVisibleFrame.right,overrideBottomInset ? mTmpRect.bottom - mVisibleFrame.bottom : mFrame.bottom - mVisibleFrame.bottom);
    mStableInsets.set(Math.max(mStableFrame.left - mFrame.left,0),Math.max(mStableFrame.top - mFrame.top,0),overrideRightInset ? Math.max(mTmpRect.right - mStableFrame.right,0) : Math.max(mFrame.right - mStableFrame.right,0),overrideBottomInset ? Math.max(mTmpRect.bottom - mStableFrame.bottom,0) : Math.max(mFrame.bottom - mStableFrame.bottom,0));
  }
  mFrame.offset(-layoutXDiff,-layoutYDiff);
  mCompatFrame.offset(-layoutXDiff,-layoutYDiff);
  mContentFrame.offset(-layoutXDiff,-layoutYDiff);
  mVisibleFrame.offset(-layoutXDiff,-layoutYDiff);
  mStableFrame.offset(-layoutXDiff,-layoutYDiff);
  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());
}