Program: 193959
Project: 193959
Buggy source:
void updateSurfaceWindowCrop(final boolean recoveringMemory){
  final WindowState w=mWin;
  final DisplayContent displayContent=w.getDisplayContent();
  if (displayContent == null) {
    return;
  }
  if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
    w.mSystemDecorRect.set(0,0,w.mRequestedWidth,w.mRequestedHeight);
  }
 else   if (!w.isDefaultDisplay()) {
    final DisplayInfo displayInfo=displayContent.getDisplayInfo();
    w.mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
    w.mSystemDecorRect.intersect(-w.mCompatFrame.left,-w.mCompatFrame.top,displayInfo.logicalWidth - w.mCompatFrame.left,displayInfo.logicalHeight - w.mCompatFrame.top);
  }
 else   if (w.mLayer >= mService.mSystemDecorLayer) {
    w.mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mDecorFrame.isEmpty()) {
    w.mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mAttrs.type == LayoutParams.TYPE_WALLPAPER && mAnimator.mAnimating) {
    mTmpClipRect.set(w.mSystemDecorRect);
    applyDecorRect(w.mDecorFrame);
    w.mSystemDecorRect.union(mTmpClipRect);
  }
 else {
    applyDecorRect(w.mDecorFrame);
  }
  final Rect clipRect=mTmpClipRect;
  clipRect.set((mHasClipRect) ? mClipRect : w.mSystemDecorRect);
  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;
  clipRect.offset(attrs.surfaceInsets.left,attrs.surfaceInsets.top);
  if (!clipRect.equals(mLastClipRect)) {
    mLastClipRect.set(clipRect);
    try {
      if (WindowManagerService.SHOW_TRANSACTIONS)       WindowManagerService.logSurface(w,"String_Node_Str" + clipRect.toShortString(),null);
      mSurfaceControl.setWindowCrop(clipRect);
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + w + "String_Node_Str"+ clipRect.toShortString(),e);
      if (!recoveringMemory) {
        mService.reclaimSomeSurfaceMemoryLocked(this,"String_Node_Str",true);
      }
    }
  }
}

Fixed version (ground truth):
void updateSurfaceWindowCrop(final boolean recoveringMemory){
  final WindowState w=mWin;
  final DisplayContent displayContent=w.getDisplayContent();
  if (displayContent == null) {
    return;
  }
  final DisplayInfo displayInfo=displayContent.getDisplayInfo();
  if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
    w.mSystemDecorRect.set(0,0,w.mRequestedWidth,w.mRequestedHeight);
  }
 else   if (!w.isDefaultDisplay()) {
    w.mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
    w.mSystemDecorRect.intersect(-w.mCompatFrame.left,-w.mCompatFrame.top,displayInfo.logicalWidth - w.mCompatFrame.left,displayInfo.logicalHeight - w.mCompatFrame.top);
  }
 else   if (w.mLayer >= mService.mSystemDecorLayer) {
    w.mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mDecorFrame.isEmpty()) {
    w.mSystemDecorRect.set(0,0,w.mCompatFrame.width(),w.mCompatFrame.height());
  }
 else   if (w.mAttrs.type == LayoutParams.TYPE_WALLPAPER && mAnimator.mAnimating) {
    mTmpClipRect.set(w.mSystemDecorRect);
    applyDecorRect(w.mDecorFrame);
    w.mSystemDecorRect.union(mTmpClipRect);
  }
 else {
    applyDecorRect(w.mDecorFrame);
  }
  final boolean fullscreen=w.isFullscreen(displayInfo.appWidth,displayInfo.appHeight);
  final Rect clipRect=mTmpClipRect;
  clipRect.set((mHasClipRect && !fullscreen) ? mClipRect : w.mSystemDecorRect);
  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);
  if (!clipRect.equals(mLastClipRect)) {
    mLastClipRect.set(clipRect);
    try {
      if (WindowManagerService.SHOW_TRANSACTIONS)       WindowManagerService.logSurface(w,"String_Node_Str" + clipRect.toShortString(),null);
      mSurfaceControl.setWindowCrop(clipRect);
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + w + "String_Node_Str"+ clipRect.toShortString(),e);
      if (!recoveringMemory) {
        mService.reclaimSomeSurfaceMemoryLocked(this,"String_Node_Str",true);
      }
    }
  }
}