Program: 192234
Project: 192234
Buggy source:
void calculateSurfaceWindowCrop(Rect clipRect,Rect finalClipRect){
  final WindowState w=mWin;
  final DisplayContent displayContent=w.getDisplayContent();
  if (displayContent == null) {
    clipRect.setEmpty();
    finalClipRect.setEmpty();
    return;
  }
  final DisplayInfo displayInfo=displayContent.getDisplayInfo();
  if (DEBUG_WINDOW_CROP)   Slog.d(TAG,"String_Node_Str" + w + "String_Node_Str"+ "String_Node_Str"+ mLastClipRect);
  if (!w.isDefaultDisplay()) {
    mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
    mSystemDecorRect.intersect(-w.mCompatFrame.left,-w.mCompatFrame.top,displayInfo.logicalWidth - w.mCompatFrame.left,displayInfo.logicalHeight - w.mCompatFrame.top);
  }
 else   if (w.mLayer >= mService.mSystemDecorLayer) {
    mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mDecorFrame.isEmpty()) {
    mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mAttrs.type == LayoutParams.TYPE_WALLPAPER && mAnimator.isAnimating()) {
    mTmpClipRect.set(mSystemDecorRect);
    calculateSystemDecorRect();
    mSystemDecorRect.union(mTmpClipRect);
  }
 else {
    calculateSystemDecorRect();
    if (DEBUG_WINDOW_CROP)     Slog.d(TAG,"String_Node_Str" + w + "String_Node_Str"+ w.mDecorFrame+ "String_Node_Str"+ mSystemDecorRect);
  }
  final boolean fullscreen=w.isFrameFullscreen(displayInfo);
  final boolean isFreeformResizing=w.isDragResizing() && w.getResizeMode() == DRAG_RESIZE_MODE_FREEFORM;
  clipRect.set((mHasClipRect && !fullscreen) ? mClipRect : mSystemDecorRect);
  if (DEBUG_WINDOW_CROP)   Slog.d(TAG,"String_Node_Str" + clipRect + "String_Node_Str"+ mHasClipRect+ "String_Node_Str"+ fullscreen);
  if (isFreeformResizing && !w.isChildWindow()) {
    clipRect.offset(w.mShownPosition.x,w.mShownPosition.y);
  }
  final WindowManager.LayoutParams attrs=w.mAttrs;
  clipRect.left-=attrs.surfaceInsets.left;
  clipRect.top-=attrs.surfaceInsets.top;
  clipRect.right+=attrs.surfaceInsets.right;
  clipRect.bottom+=attrs.surfaceInsets.bottom;
  if (mHasClipRect && fullscreen) {
    clipRect.intersect(mClipRect);
  }
  clipRect.offset(attrs.surfaceInsets.left,attrs.surfaceInsets.top);
  finalClipRect.setEmpty();
  adjustCropToStackBounds(w,clipRect,finalClipRect,isFreeformResizing);
  if (DEBUG_WINDOW_CROP)   Slog.d(TAG,"String_Node_Str" + clipRect);
  w.transformFromScreenToSurfaceSpace(clipRect);
  if (w.hasJustMovedInStack() && mLastClipRect.isEmpty() && !clipRect.isEmpty()) {
    clipRect.setEmpty();
  }
}

Fixed version (ground truth):
void calculateSurfaceWindowCrop(Rect clipRect,Rect finalClipRect){
  final WindowState w=mWin;
  final DisplayContent displayContent=w.getDisplayContent();
  if (displayContent == null) {
    clipRect.setEmpty();
    finalClipRect.setEmpty();
    return;
  }
  final DisplayInfo displayInfo=displayContent.getDisplayInfo();
  if (DEBUG_WINDOW_CROP)   Slog.d(TAG,"String_Node_Str" + w + "String_Node_Str"+ mLastClipRect);
  if (!w.isDefaultDisplay()) {
    mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
    mSystemDecorRect.intersect(-w.mCompatFrame.left,-w.mCompatFrame.top,displayInfo.logicalWidth - w.mCompatFrame.left,displayInfo.logicalHeight - w.mCompatFrame.top);
  }
 else   if (w.mLayer >= mService.mSystemDecorLayer) {
    mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mDecorFrame.isEmpty()) {
    mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mAttrs.type == LayoutParams.TYPE_WALLPAPER && mAnimator.isAnimating()) {
    mTmpClipRect.set(mSystemDecorRect);
    calculateSystemDecorRect();
    mSystemDecorRect.union(mTmpClipRect);
  }
 else {
    calculateSystemDecorRect();
    if (DEBUG_WINDOW_CROP)     Slog.d(TAG,"String_Node_Str" + w + "String_Node_Str"+ w.mDecorFrame+ "String_Node_Str"+ mSystemDecorRect);
  }
  final boolean fullscreen=w.isFrameFullscreen(displayInfo);
  final boolean isFreeformResizing=w.isDragResizing() && w.getResizeMode() == DRAG_RESIZE_MODE_FREEFORM;
  clipRect.set((mHasClipRect && !fullscreen) ? mClipRect : mSystemDecorRect);
  if (DEBUG_WINDOW_CROP)   Slog.d(TAG,"String_Node_Str" + w + "String_Node_Str"+ clipRect+ "String_Node_Str"+ mHasClipRect+ "String_Node_Str"+ fullscreen);
  if (isFreeformResizing && !w.isChildWindow()) {
    clipRect.offset(w.mShownPosition.x,w.mShownPosition.y);
  }
  final WindowManager.LayoutParams attrs=w.mAttrs;
  clipRect.left-=attrs.surfaceInsets.left;
  clipRect.top-=attrs.surfaceInsets.top;
  clipRect.right+=attrs.surfaceInsets.right;
  clipRect.bottom+=attrs.surfaceInsets.bottom;
  if (mHasClipRect && fullscreen) {
    clipRect.intersect(mClipRect);
  }
  clipRect.offset(attrs.surfaceInsets.left,attrs.surfaceInsets.top);
  finalClipRect.setEmpty();
  adjustCropToStackBounds(w,clipRect,finalClipRect,isFreeformResizing);
  if (DEBUG_WINDOW_CROP)   Slog.d(TAG,"String_Node_Str" + w + "String_Node_Str"+ clipRect);
  w.transformFromScreenToSurfaceSpace(clipRect);
  if (w.hasJustMovedInStack() && mLastClipRect.isEmpty() && !clipRect.isEmpty()) {
    clipRect.setEmpty();
  }
}