Program: 193156
Project: 193156
Buggy source:
final void performLayoutLockedInner(final DisplayContent displayContent,boolean initial,boolean updateInputWindows){
  if (!displayContent.layoutNeeded) {
    return;
  }
  displayContent.layoutNeeded=false;
  WindowList windows=displayContent.getWindowList();
  boolean isDefaultDisplay=displayContent.isDefaultDisplay;
  DisplayInfo displayInfo=displayContent.getDisplayInfo();
  final int dw=displayInfo.logicalWidth;
  final int dh=displayInfo.logicalHeight;
  if (mService.mInputConsumer != null) {
    mService.mInputConsumer.layout(dw,dh);
  }
  final int N=windows.size();
  int i;
  if (DEBUG_LAYOUT) {
    Slog.v(TAG_WM,"String_Node_Str");
    Slog.v(TAG_WM,"String_Node_Str" + displayContent.layoutNeeded + "String_Node_Str"+ dw+ "String_Node_Str"+ dh);
  }
  mService.mPolicy.beginLayoutLw(isDefaultDisplay,dw,dh,mService.mRotation);
  if (isDefaultDisplay) {
    mService.mSystemDecorLayer=mService.mPolicy.getSystemDecorLayerLw();
    mService.mScreenRect.set(0,0,dw,dh);
  }
  mService.mPolicy.getContentRectLw(mService.mTmpContentRect);
  displayContent.resize(mService.mTmpContentRect);
  int seq=mService.mLayoutSeq + 1;
  if (seq < 0)   seq=0;
  mService.mLayoutSeq=seq;
  boolean behindDream=false;
  int topAttached=-1;
  for (i=N - 1; i >= 0; i--) {
    final WindowState win=windows.get(i);
    final boolean gone=(behindDream && mService.mPolicy.canBeForceHidden(win,win.mAttrs)) || win.isGoneForLayoutLw();
    if (DEBUG_LAYOUT && !win.mLayoutAttached) {
      Slog.v(TAG_WM,"String_Node_Str" + win + "String_Node_Str"+ gone+ "String_Node_Str"+ win.mHaveFrame+ "String_Node_Str"+ win.mLayoutAttached+ "String_Node_Str"+ win.isConfigChanged());
      final AppWindowToken atoken=win.mAppToken;
      if (gone)       Slog.v(TAG_WM,"String_Node_Str" + win.mViewVisibility + "String_Node_Str"+ win.mRelayoutCalled+ "String_Node_Str"+ win.mRootToken.hidden+ "String_Node_Str"+ (atoken != null && atoken.hiddenRequested)+ "String_Node_Str"+ win.mAttachedHidden);
 else       Slog.v(TAG_WM,"String_Node_Str" + win.mViewVisibility + "String_Node_Str"+ win.mRelayoutCalled+ "String_Node_Str"+ win.mRootToken.hidden+ "String_Node_Str"+ (atoken != null && atoken.hiddenRequested)+ "String_Node_Str"+ win.mAttachedHidden);
    }
    if (!gone || !win.mHaveFrame || win.mLayoutNeeded|| ((win.isConfigChanged() || win.setInsetsChanged()) && ((win.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 || (win.mHasSurface && win.mAppToken != null && win.mAppToken.layoutConfigChanges)))) {
      if (!win.mLayoutAttached) {
        if (initial) {
          win.mContentChanged=false;
        }
        if (win.mAttrs.type == TYPE_DREAM) {
          behindDream=true;
        }
        win.mLayoutNeeded=false;
        win.prelayout();
        mService.mPolicy.layoutWindowLw(win,null);
        win.mLayoutSeq=seq;
        final Task task=win.getTask();
        if (task != null) {
          displayContent.mDimLayerController.updateDimLayer(task);
        }
        if (DEBUG_LAYOUT)         Slog.v(TAG_WM,"String_Node_Str" + win.mFrame + "String_Node_Str"+ win.mContainingFrame+ "String_Node_Str"+ win.mDisplayFrame);
      }
 else {
        if (topAttached < 0)         topAttached=i;
      }
    }
  }
  boolean attachedBehindDream=false;
  for (i=topAttached; i >= 0; i--) {
    final WindowState win=windows.get(i);
    if (win.mLayoutAttached) {
      if (DEBUG_LAYOUT)       Slog.v(TAG_WM,"String_Node_Str" + win + "String_Node_Str"+ win.mHaveFrame+ "String_Node_Str"+ win.mViewVisibility+ "String_Node_Str"+ win.mRelayoutCalled);
      if (attachedBehindDream && mService.mPolicy.canBeForceHidden(win,win.mAttrs)) {
        continue;
      }
      if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) || !win.mHaveFrame || win.mLayoutNeeded) {
        if (initial) {
          win.mContentChanged=false;
        }
        win.mLayoutNeeded=false;
        win.prelayout();
        mService.mPolicy.layoutWindowLw(win,win.mAttachedWindow);
        win.mLayoutSeq=seq;
        if (DEBUG_LAYOUT)         Slog.v(TAG_WM,"String_Node_Str" + win.mFrame + "String_Node_Str"+ win.mContainingFrame+ "String_Node_Str"+ win.mDisplayFrame);
      }
    }
 else     if (win.mAttrs.type == TYPE_DREAM) {
      attachedBehindDream=behindDream;
    }
  }
  mService.mInputMonitor.setUpdateInputWindowsNeededLw();
  if (updateInputWindows) {
    mService.mInputMonitor.updateInputWindowsLw(false);
  }
  mService.mPolicy.finishLayoutLw();
  mService.mH.sendEmptyMessage(UPDATE_DOCKED_STACK_DIVIDER);
}

Fixed version (ground truth):
final void performLayoutLockedInner(final DisplayContent displayContent,boolean initial,boolean updateInputWindows){
  if (!displayContent.layoutNeeded) {
    return;
  }
  displayContent.layoutNeeded=false;
  WindowList windows=displayContent.getWindowList();
  boolean isDefaultDisplay=displayContent.isDefaultDisplay;
  DisplayInfo displayInfo=displayContent.getDisplayInfo();
  final int dw=displayInfo.logicalWidth;
  final int dh=displayInfo.logicalHeight;
  if (mService.mInputConsumer != null) {
    mService.mInputConsumer.layout(dw,dh);
  }
  final int N=windows.size();
  int i;
  if (DEBUG_LAYOUT) {
    Slog.v(TAG_WM,"String_Node_Str");
    Slog.v(TAG_WM,"String_Node_Str" + displayContent.layoutNeeded + "String_Node_Str"+ dw+ "String_Node_Str"+ dh);
  }
  mService.mPolicy.beginLayoutLw(isDefaultDisplay,dw,dh,mService.mRotation);
  if (isDefaultDisplay) {
    mService.mSystemDecorLayer=mService.mPolicy.getSystemDecorLayerLw();
    mService.mScreenRect.set(0,0,dw,dh);
  }
  mService.mPolicy.getContentRectLw(mTmpContentRect);
  displayContent.resize(mTmpContentRect);
  int seq=mService.mLayoutSeq + 1;
  if (seq < 0)   seq=0;
  mService.mLayoutSeq=seq;
  boolean behindDream=false;
  int topAttached=-1;
  for (i=N - 1; i >= 0; i--) {
    final WindowState win=windows.get(i);
    final boolean gone=(behindDream && mService.mPolicy.canBeForceHidden(win,win.mAttrs)) || win.isGoneForLayoutLw();
    if (DEBUG_LAYOUT && !win.mLayoutAttached) {
      Slog.v(TAG_WM,"String_Node_Str" + win + "String_Node_Str"+ gone+ "String_Node_Str"+ win.mHaveFrame+ "String_Node_Str"+ win.mLayoutAttached+ "String_Node_Str"+ win.isConfigChanged());
      final AppWindowToken atoken=win.mAppToken;
      if (gone)       Slog.v(TAG_WM,"String_Node_Str" + win.mViewVisibility + "String_Node_Str"+ win.mRelayoutCalled+ "String_Node_Str"+ win.mRootToken.hidden+ "String_Node_Str"+ (atoken != null && atoken.hiddenRequested)+ "String_Node_Str"+ win.mAttachedHidden);
 else       Slog.v(TAG_WM,"String_Node_Str" + win.mViewVisibility + "String_Node_Str"+ win.mRelayoutCalled+ "String_Node_Str"+ win.mRootToken.hidden+ "String_Node_Str"+ (atoken != null && atoken.hiddenRequested)+ "String_Node_Str"+ win.mAttachedHidden);
    }
    if (!gone || !win.mHaveFrame || win.mLayoutNeeded|| ((win.isConfigChanged() || win.setInsetsChanged()) && ((win.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 || (win.mHasSurface && win.mAppToken != null && win.mAppToken.layoutConfigChanges)))) {
      if (!win.mLayoutAttached) {
        if (initial) {
          win.mContentChanged=false;
        }
        if (win.mAttrs.type == TYPE_DREAM) {
          behindDream=true;
        }
        win.mLayoutNeeded=false;
        win.prelayout();
        mService.mPolicy.layoutWindowLw(win,null);
        win.mLayoutSeq=seq;
        final Task task=win.getTask();
        if (task != null) {
          displayContent.mDimLayerController.updateDimLayer(task);
        }
        if (DEBUG_LAYOUT)         Slog.v(TAG_WM,"String_Node_Str" + win.mFrame + "String_Node_Str"+ win.mContainingFrame+ "String_Node_Str"+ win.mDisplayFrame);
      }
 else {
        if (topAttached < 0)         topAttached=i;
      }
    }
  }
  boolean attachedBehindDream=false;
  for (i=topAttached; i >= 0; i--) {
    final WindowState win=windows.get(i);
    if (win.mLayoutAttached) {
      if (DEBUG_LAYOUT)       Slog.v(TAG_WM,"String_Node_Str" + win + "String_Node_Str"+ win.mHaveFrame+ "String_Node_Str"+ win.mViewVisibility+ "String_Node_Str"+ win.mRelayoutCalled);
      if (attachedBehindDream && mService.mPolicy.canBeForceHidden(win,win.mAttrs)) {
        continue;
      }
      if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) || !win.mHaveFrame || win.mLayoutNeeded) {
        if (initial) {
          win.mContentChanged=false;
        }
        win.mLayoutNeeded=false;
        win.prelayout();
        mService.mPolicy.layoutWindowLw(win,win.mAttachedWindow);
        win.mLayoutSeq=seq;
        if (DEBUG_LAYOUT)         Slog.v(TAG_WM,"String_Node_Str" + win.mFrame + "String_Node_Str"+ win.mContainingFrame+ "String_Node_Str"+ win.mDisplayFrame);
      }
    }
 else     if (win.mAttrs.type == TYPE_DREAM) {
      attachedBehindDream=behindDream;
    }
  }
  mService.mInputMonitor.setUpdateInputWindowsNeededLw();
  if (updateInputWindows) {
    mService.mInputMonitor.updateInputWindowsLw(false);
  }
  mService.mPolicy.finishLayoutLw();
  mService.mH.sendEmptyMessage(UPDATE_DOCKED_STACK_DIVIDER);
}