Program: 181884
Project: 181884
Buggy source:
private void performTraversals(){
  final View host=mView;
  if (DBG) {
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    host.debug();
  }
  if (host == null || !mAdded)   return;
  mTraversalScheduled=false;
  mWillDrawSoon=true;
  boolean windowResizesToFitContent=false;
  boolean fullRedrawNeeded=mFullRedrawNeeded;
  boolean newSurface=false;
  WindowManager.LayoutParams lp=mWindowAttributes;
  int desiredWindowWidth;
  int desiredWindowHeight;
  int childWidthMeasureSpec;
  int childHeightMeasureSpec;
  final View.AttachInfo attachInfo=mAttachInfo;
  final int viewVisibility=getHostVisibility();
  boolean viewVisibilityChanged=mViewVisibility != viewVisibility || mNewSurfaceNeeded;
  float appScale=mAttachInfo.mApplicationScale;
  WindowManager.LayoutParams params=null;
  if (mWindowAttributesChanged) {
    mWindowAttributesChanged=false;
    params=lp;
  }
  Rect frame=mWinFrame;
  if (mFirst) {
    fullRedrawNeeded=true;
    mLayoutRequested=true;
    DisplayMetrics packageMetrics=mView.getContext().getResources().getDisplayMetrics();
    desiredWindowWidth=packageMetrics.widthPixels;
    desiredWindowHeight=packageMetrics.heightPixels;
    attachInfo.mSurface=mSurface;
    attachInfo.mTranslucentWindow=lp.format != PixelFormat.OPAQUE;
    attachInfo.mHasWindowFocus=false;
    attachInfo.mWindowVisibility=viewVisibility;
    attachInfo.mRecomputeGlobalAttributes=false;
    attachInfo.mKeepScreenOn=false;
    viewVisibilityChanged=false;
    mLastConfiguration.setTo(host.getResources().getConfiguration());
    host.dispatchAttachedToWindow(attachInfo,0);
  }
 else {
    desiredWindowWidth=frame.width();
    desiredWindowHeight=frame.height();
    if (desiredWindowWidth != mWidth || desiredWindowHeight != mHeight) {
      if (DEBUG_ORIENTATION)       Log.v("String_Node_Str","String_Node_Str" + host + "String_Node_Str"+ frame);
      fullRedrawNeeded=true;
      mLayoutRequested=true;
      windowResizesToFitContent=true;
    }
  }
  if (viewVisibilityChanged) {
    attachInfo.mWindowVisibility=viewVisibility;
    host.dispatchWindowVisibilityChanged(viewVisibility);
    if (viewVisibility != View.VISIBLE || mNewSurfaceNeeded) {
      if (mUseGL) {
        destroyGL();
      }
    }
    if (viewVisibility == View.GONE) {
      mHasHadWindowFocus=false;
    }
  }
  boolean insetsChanged=false;
  if (mLayoutRequested) {
    getRunQueue().executeActions(attachInfo.mHandler);
    if (mFirst) {
      host.fitSystemWindows(mAttachInfo.mContentInsets);
      mAttachInfo.mInTouchMode=!mAddedTouchMode;
      ensureTouchModeLocally(mAddedTouchMode,false);
    }
 else {
      if (!mAttachInfo.mContentInsets.equals(mPendingContentInsets)) {
        mAttachInfo.mContentInsets.set(mPendingContentInsets);
        host.fitSystemWindows(mAttachInfo.mContentInsets);
        insetsChanged=true;
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mContentInsets);
      }
      if (!mAttachInfo.mVisibleInsets.equals(mPendingVisibleInsets)) {
        mAttachInfo.mVisibleInsets.set(mPendingVisibleInsets);
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mVisibleInsets);
      }
      if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT || lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
        windowResizesToFitContent=true;
        DisplayMetrics packageMetrics=mView.getContext().getResources().getDisplayMetrics();
        desiredWindowWidth=packageMetrics.widthPixels;
        desiredWindowHeight=packageMetrics.heightPixels;
      }
    }
    childWidthMeasureSpec=getRootMeasureSpec(desiredWindowWidth,lp.width);
    childHeightMeasureSpec=getRootMeasureSpec(desiredWindowHeight,lp.height);
    if (DEBUG_ORIENTATION || DEBUG_LAYOUT)     Log.v("String_Node_Str","String_Node_Str" + host + "String_Node_Str"+ desiredWindowWidth+ "String_Node_Str"+ desiredWindowHeight+ "String_Node_Str");
    host.measure(childWidthMeasureSpec,childHeightMeasureSpec);
    if (DBG) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      host.debug();
    }
  }
  if (attachInfo.mRecomputeGlobalAttributes) {
    attachInfo.mRecomputeGlobalAttributes=false;
    boolean oldVal=attachInfo.mKeepScreenOn;
    attachInfo.mKeepScreenOn=false;
    host.dispatchCollectViewAttributes(0);
    if (attachInfo.mKeepScreenOn != oldVal) {
      params=lp;
    }
  }
  if (mFirst || attachInfo.mViewVisibilityChanged) {
    attachInfo.mViewVisibilityChanged=false;
    int resizeMode=mSoftInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
    if (resizeMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED) {
      final int N=attachInfo.mScrollContainers.size();
      for (int i=0; i < N; i++) {
        if (attachInfo.mScrollContainers.get(i).isShown()) {
          resizeMode=WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
        }
      }
      if (resizeMode == 0) {
        resizeMode=WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
      }
      if ((lp.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) != resizeMode) {
        lp.softInputMode=(lp.softInputMode & ~WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) | resizeMode;
        params=lp;
      }
    }
  }
  if (params != null && (host.mPrivateFlags & View.REQUEST_TRANSPARENT_REGIONS) != 0) {
    if (!PixelFormat.formatHasAlpha(params.format)) {
      params.format=PixelFormat.TRANSLUCENT;
    }
  }
  boolean windowShouldResize=mLayoutRequested && windowResizesToFitContent && ((mWidth != host.mMeasuredWidth || mHeight != host.mMeasuredHeight) || (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT && frame.width() < desiredWindowWidth && frame.width() != mWidth) || (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT && frame.height() < desiredWindowHeight && frame.height() != mHeight));
  final boolean computesInternalInsets=attachInfo.mTreeObserver.hasComputeInternalInsetsListeners();
  boolean insetsPending=false;
  int relayoutResult=0;
  if (mFirst || windowShouldResize || insetsChanged|| viewVisibilityChanged|| params != null) {
    if (viewVisibility == View.VISIBLE) {
      insetsPending=computesInternalInsets && (mFirst || viewVisibilityChanged);
      if (mWindowAttributes.memoryType == WindowManager.LayoutParams.MEMORY_TYPE_GPU) {
        if (params == null) {
          params=mWindowAttributes;
        }
        mGlWanted=true;
      }
    }
    boolean initialized=false;
    boolean contentInsetsChanged=false;
    boolean visibleInsetsChanged;
    try {
      boolean hadSurface=mSurface.isValid();
      int fl=0;
      if (params != null) {
        fl=params.flags;
        if (attachInfo.mKeepScreenOn) {
          params.flags|=WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
        }
      }
      if (DEBUG_LAYOUT) {
        Log.i(TAG,"String_Node_Str" + host.mMeasuredWidth + "String_Node_Str"+ host.mMeasuredHeight+ "String_Node_Str"+ params);
      }
      relayoutResult=relayoutWindow(params,viewVisibility,insetsPending);
      if (params != null) {
        params.flags=fl;
      }
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + frame.toShortString() + "String_Node_Str"+ mPendingContentInsets.toShortString()+ "String_Node_Str"+ mPendingVisibleInsets.toShortString()+ "String_Node_Str"+ mSurface);
      if (mPendingConfiguration.seq != 0) {
        if (DEBUG_CONFIGURATION)         Log.v(TAG,"String_Node_Str" + mPendingConfiguration);
        updateConfiguration(mPendingConfiguration,!mFirst);
        mPendingConfiguration.seq=0;
      }
      contentInsetsChanged=!mPendingContentInsets.equals(mAttachInfo.mContentInsets);
      visibleInsetsChanged=!mPendingVisibleInsets.equals(mAttachInfo.mVisibleInsets);
      if (contentInsetsChanged) {
        mAttachInfo.mContentInsets.set(mPendingContentInsets);
        host.fitSystemWindows(mAttachInfo.mContentInsets);
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mContentInsets);
      }
      if (visibleInsetsChanged) {
        mAttachInfo.mVisibleInsets.set(mPendingVisibleInsets);
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mVisibleInsets);
      }
      if (!hadSurface) {
        if (mSurface.isValid()) {
          newSurface=true;
          fullRedrawNeeded=true;
          mPreviousTransparentRegion.setEmpty();
          if (mGlWanted && !mUseGL) {
            initializeGL();
            initialized=mGlCanvas != null;
          }
        }
      }
 else       if (!mSurface.isValid()) {
        mLastScrolledFocus=null;
        mScrollY=mCurScrollY=0;
        if (mScroller != null) {
          mScroller.abortAnimation();
        }
      }
    }
 catch (    RemoteException e) {
    }
    if (DEBUG_ORIENTATION)     Log.v("String_Node_Str","String_Node_Str" + frame + "String_Node_Str"+ mSurface);
    attachInfo.mWindowLeft=frame.left;
    attachInfo.mWindowTop=frame.top;
    mWidth=frame.width();
    mHeight=frame.height();
    if (initialized) {
      mGlCanvas.setViewport((int)(mWidth * appScale + 0.5f),(int)(mHeight * appScale + 0.5f));
    }
    boolean focusChangedDueToTouchMode=ensureTouchModeLocally((relayoutResult & WindowManagerImpl.RELAYOUT_IN_TOUCH_MODE) != 0,true);
    if (focusChangedDueToTouchMode || mWidth != host.mMeasuredWidth || mHeight != host.mMeasuredHeight || contentInsetsChanged) {
      childWidthMeasureSpec=getRootMeasureSpec(mWidth,lp.width);
      childHeightMeasureSpec=getRootMeasureSpec(mHeight,lp.height);
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mWidth + "String_Node_Str"+ host.mMeasuredWidth+ "String_Node_Str"+ mHeight+ "String_Node_Str"+ host.mMeasuredHeight+ "String_Node_Str"+ contentInsetsChanged);
      host.measure(childWidthMeasureSpec,childHeightMeasureSpec);
      int width=host.mMeasuredWidth;
      int height=host.mMeasuredHeight;
      boolean measureAgain=false;
      if (lp.horizontalWeight > 0.0f) {
        width+=(int)((mWidth - width) * lp.horizontalWeight);
        childWidthMeasureSpec=MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY);
        measureAgain=true;
      }
      if (lp.verticalWeight > 0.0f) {
        height+=(int)((mHeight - height) * lp.verticalWeight);
        childHeightMeasureSpec=MeasureSpec.makeMeasureSpec(height,MeasureSpec.EXACTLY);
        measureAgain=true;
      }
      if (measureAgain) {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + width + "String_Node_Str"+ height);
        host.measure(childWidthMeasureSpec,childHeightMeasureSpec);
      }
      mLayoutRequested=true;
    }
  }
  final boolean didLayout=mLayoutRequested;
  boolean triggerGlobalLayoutListener=didLayout || attachInfo.mRecomputeGlobalAttributes;
  if (didLayout) {
    mLayoutRequested=false;
    mScrollMayChange=true;
    if (DEBUG_ORIENTATION || DEBUG_LAYOUT)     Log.v("String_Node_Str","String_Node_Str" + host + "String_Node_Str"+ host.mMeasuredWidth+ "String_Node_Str"+ host.mMeasuredHeight+ "String_Node_Str");
    long startTime=0L;
    if (Config.DEBUG && ViewDebug.profileLayout) {
      startTime=SystemClock.elapsedRealtime();
    }
    host.layout(0,0,host.mMeasuredWidth,host.mMeasuredHeight);
    if (mFirst) {
      if (mAddedTouchMode) {
        enterTouchMode();
      }
 else {
        leaveTouchMode();
      }
    }
    if (Config.DEBUG && ViewDebug.consistencyCheckEnabled) {
      if (!host.dispatchConsistencyCheck(ViewDebug.CONSISTENCY_LAYOUT)) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + ViewDebug.CONSISTENCY_LOG_TAG + "String_Node_Str");
      }
    }
    if (Config.DEBUG && ViewDebug.profileLayout) {
      EventLog.writeEvent(60001,SystemClock.elapsedRealtime() - startTime);
    }
    if ((host.mPrivateFlags & View.REQUEST_TRANSPARENT_REGIONS) != 0) {
      host.getLocationInWindow(mTmpLocation);
      mTransparentRegion.set(mTmpLocation[0],mTmpLocation[1],mTmpLocation[0] + host.mRight - host.mLeft,mTmpLocation[1] + host.mBottom - host.mTop);
      host.gatherTransparentRegion(mTransparentRegion);
      if (mTranslator != null) {
        mTranslator.translateRegionInWindowToScreen(mTransparentRegion);
      }
      if (!mTransparentRegion.equals(mPreviousTransparentRegion)) {
        mPreviousTransparentRegion.set(mTransparentRegion);
        try {
          sWindowSession.setTransparentRegion(mWindow,mTransparentRegion);
        }
 catch (        RemoteException e) {
        }
      }
    }
    if (DBG) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      host.debug();
    }
  }
  if (triggerGlobalLayoutListener) {
    attachInfo.mRecomputeGlobalAttributes=false;
    attachInfo.mTreeObserver.dispatchOnGlobalLayout();
  }
  if (computesInternalInsets) {
    ViewTreeObserver.InternalInsetsInfo insets=attachInfo.mGivenInternalInsets;
    final Rect givenContent=attachInfo.mGivenInternalInsets.contentInsets;
    final Rect givenVisible=attachInfo.mGivenInternalInsets.visibleInsets;
    givenContent.left=givenContent.top=givenContent.right=givenContent.bottom=givenVisible.left=givenVisible.top=givenVisible.right=givenVisible.bottom=0;
    attachInfo.mTreeObserver.dispatchOnComputeInternalInsets(insets);
    Rect contentInsets=insets.contentInsets;
    Rect visibleInsets=insets.visibleInsets;
    if (mTranslator != null) {
      contentInsets=mTranslator.getTranslatedContentInsets(contentInsets);
      visibleInsets=mTranslator.getTranslatedVisbileInsets(visibleInsets);
    }
    if (insetsPending || !mLastGivenInsets.equals(insets)) {
      mLastGivenInsets.set(insets);
      try {
        sWindowSession.setInsets(mWindow,insets.mTouchableInsets,contentInsets,visibleInsets);
      }
 catch (      RemoteException e) {
      }
    }
  }
  if (mFirst) {
    if (DEBUG_INPUT_RESIZE)     Log.v(TAG,"String_Node_Str" + mView.hasFocus());
    if (mView != null) {
      if (!mView.hasFocus()) {
        mView.requestFocus(View.FOCUS_FORWARD);
        mFocusedView=mRealFocusedView=mView.findFocus();
        if (DEBUG_INPUT_RESIZE)         Log.v(TAG,"String_Node_Str" + mFocusedView);
      }
 else {
        mRealFocusedView=mView.findFocus();
        if (DEBUG_INPUT_RESIZE)         Log.v(TAG,"String_Node_Str" + mRealFocusedView);
      }
    }
  }
  mFirst=false;
  mWillDrawSoon=false;
  mNewSurfaceNeeded=false;
  mViewVisibility=viewVisibility;
  if (mAttachInfo.mHasWindowFocus) {
    final boolean imTarget=WindowManager.LayoutParams.mayUseInputMethod(mWindowAttributes.flags);
    if (imTarget != mLastWasImTarget) {
      mLastWasImTarget=imTarget;
      InputMethodManager imm=InputMethodManager.peekInstance();
      if (imm != null && imTarget) {
        imm.startGettingWindowFocus(mView);
        imm.onWindowFocus(mView,mView.findFocus(),mWindowAttributes.softInputMode,!mHasHadWindowFocus,mWindowAttributes.flags);
      }
    }
  }
  boolean cancelDraw=attachInfo.mTreeObserver.dispatchOnPreDraw();
  if (!cancelDraw && !newSurface) {
    mFullRedrawNeeded=false;
    draw(fullRedrawNeeded);
    if ((relayoutResult & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0 || mReportNextDraw) {
      if (LOCAL_LOGV) {
        Log.v("String_Node_Str","String_Node_Str" + mWindowAttributes.getTitle());
      }
      mReportNextDraw=false;
      try {
        sWindowSession.finishDrawing(mWindow);
      }
 catch (      RemoteException e) {
      }
    }
  }
 else {
    if ((relayoutResult & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
      mReportNextDraw=true;
    }
    if (fullRedrawNeeded) {
      mFullRedrawNeeded=true;
    }
    scheduleTraversals();
  }
}

Fixed version (ground truth):
private void performTraversals(){
  final View host=mView;
  if (DBG) {
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    host.debug();
  }
  if (host == null || !mAdded)   return;
  mTraversalScheduled=false;
  mWillDrawSoon=true;
  boolean windowResizesToFitContent=false;
  boolean fullRedrawNeeded=mFullRedrawNeeded;
  boolean newSurface=false;
  WindowManager.LayoutParams lp=mWindowAttributes;
  int desiredWindowWidth;
  int desiredWindowHeight;
  int childWidthMeasureSpec;
  int childHeightMeasureSpec;
  final View.AttachInfo attachInfo=mAttachInfo;
  final int viewVisibility=getHostVisibility();
  boolean viewVisibilityChanged=mViewVisibility != viewVisibility || mNewSurfaceNeeded;
  float appScale=mAttachInfo.mApplicationScale;
  WindowManager.LayoutParams params=null;
  if (mWindowAttributesChanged) {
    mWindowAttributesChanged=false;
    params=lp;
  }
  Rect frame=mWinFrame;
  if (mFirst) {
    fullRedrawNeeded=true;
    mLayoutRequested=true;
    DisplayMetrics packageMetrics=mView.getContext().getResources().getDisplayMetrics();
    desiredWindowWidth=packageMetrics.widthPixels;
    desiredWindowHeight=packageMetrics.heightPixels;
    attachInfo.mSurface=mSurface;
    attachInfo.mTranslucentWindow=lp.format != PixelFormat.OPAQUE;
    attachInfo.mHasWindowFocus=false;
    attachInfo.mWindowVisibility=viewVisibility;
    attachInfo.mRecomputeGlobalAttributes=false;
    attachInfo.mKeepScreenOn=false;
    viewVisibilityChanged=false;
    mLastConfiguration.setTo(host.getResources().getConfiguration());
    host.dispatchAttachedToWindow(attachInfo,0);
  }
 else {
    desiredWindowWidth=frame.width();
    desiredWindowHeight=frame.height();
    if (desiredWindowWidth != mWidth || desiredWindowHeight != mHeight) {
      if (DEBUG_ORIENTATION)       Log.v("String_Node_Str","String_Node_Str" + host + "String_Node_Str"+ frame);
      fullRedrawNeeded=true;
      mLayoutRequested=true;
      windowResizesToFitContent=true;
    }
  }
  if (viewVisibilityChanged) {
    attachInfo.mWindowVisibility=viewVisibility;
    host.dispatchWindowVisibilityChanged(viewVisibility);
    if (viewVisibility != View.VISIBLE || mNewSurfaceNeeded) {
      if (mUseGL) {
        destroyGL();
      }
    }
    if (viewVisibility == View.GONE) {
      mHasHadWindowFocus=false;
    }
  }
  boolean insetsChanged=false;
  if (mLayoutRequested) {
    getRunQueue().executeActions(attachInfo.mHandler);
    if (mFirst) {
      host.fitSystemWindows(mAttachInfo.mContentInsets);
      mAttachInfo.mInTouchMode=!mAddedTouchMode;
      ensureTouchModeLocally(mAddedTouchMode);
    }
 else {
      if (!mAttachInfo.mContentInsets.equals(mPendingContentInsets)) {
        mAttachInfo.mContentInsets.set(mPendingContentInsets);
        host.fitSystemWindows(mAttachInfo.mContentInsets);
        insetsChanged=true;
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mContentInsets);
      }
      if (!mAttachInfo.mVisibleInsets.equals(mPendingVisibleInsets)) {
        mAttachInfo.mVisibleInsets.set(mPendingVisibleInsets);
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mVisibleInsets);
      }
      if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT || lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
        windowResizesToFitContent=true;
        DisplayMetrics packageMetrics=mView.getContext().getResources().getDisplayMetrics();
        desiredWindowWidth=packageMetrics.widthPixels;
        desiredWindowHeight=packageMetrics.heightPixels;
      }
    }
    childWidthMeasureSpec=getRootMeasureSpec(desiredWindowWidth,lp.width);
    childHeightMeasureSpec=getRootMeasureSpec(desiredWindowHeight,lp.height);
    if (DEBUG_ORIENTATION || DEBUG_LAYOUT)     Log.v("String_Node_Str","String_Node_Str" + host + "String_Node_Str"+ desiredWindowWidth+ "String_Node_Str"+ desiredWindowHeight+ "String_Node_Str");
    host.measure(childWidthMeasureSpec,childHeightMeasureSpec);
    if (DBG) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      host.debug();
    }
  }
  if (attachInfo.mRecomputeGlobalAttributes) {
    attachInfo.mRecomputeGlobalAttributes=false;
    boolean oldVal=attachInfo.mKeepScreenOn;
    attachInfo.mKeepScreenOn=false;
    host.dispatchCollectViewAttributes(0);
    if (attachInfo.mKeepScreenOn != oldVal) {
      params=lp;
    }
  }
  if (mFirst || attachInfo.mViewVisibilityChanged) {
    attachInfo.mViewVisibilityChanged=false;
    int resizeMode=mSoftInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
    if (resizeMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED) {
      final int N=attachInfo.mScrollContainers.size();
      for (int i=0; i < N; i++) {
        if (attachInfo.mScrollContainers.get(i).isShown()) {
          resizeMode=WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
        }
      }
      if (resizeMode == 0) {
        resizeMode=WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
      }
      if ((lp.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) != resizeMode) {
        lp.softInputMode=(lp.softInputMode & ~WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) | resizeMode;
        params=lp;
      }
    }
  }
  if (params != null && (host.mPrivateFlags & View.REQUEST_TRANSPARENT_REGIONS) != 0) {
    if (!PixelFormat.formatHasAlpha(params.format)) {
      params.format=PixelFormat.TRANSLUCENT;
    }
  }
  boolean windowShouldResize=mLayoutRequested && windowResizesToFitContent && ((mWidth != host.mMeasuredWidth || mHeight != host.mMeasuredHeight) || (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT && frame.width() < desiredWindowWidth && frame.width() != mWidth) || (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT && frame.height() < desiredWindowHeight && frame.height() != mHeight));
  final boolean computesInternalInsets=attachInfo.mTreeObserver.hasComputeInternalInsetsListeners();
  boolean insetsPending=false;
  int relayoutResult=0;
  if (mFirst || windowShouldResize || insetsChanged|| viewVisibilityChanged|| params != null) {
    if (viewVisibility == View.VISIBLE) {
      insetsPending=computesInternalInsets && (mFirst || viewVisibilityChanged);
      if (mWindowAttributes.memoryType == WindowManager.LayoutParams.MEMORY_TYPE_GPU) {
        if (params == null) {
          params=mWindowAttributes;
        }
        mGlWanted=true;
      }
    }
    boolean initialized=false;
    boolean contentInsetsChanged=false;
    boolean visibleInsetsChanged;
    try {
      boolean hadSurface=mSurface.isValid();
      int fl=0;
      if (params != null) {
        fl=params.flags;
        if (attachInfo.mKeepScreenOn) {
          params.flags|=WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
        }
      }
      if (DEBUG_LAYOUT) {
        Log.i(TAG,"String_Node_Str" + host.mMeasuredWidth + "String_Node_Str"+ host.mMeasuredHeight+ "String_Node_Str"+ params);
      }
      relayoutResult=relayoutWindow(params,viewVisibility,insetsPending);
      if (params != null) {
        params.flags=fl;
      }
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + frame.toShortString() + "String_Node_Str"+ mPendingContentInsets.toShortString()+ "String_Node_Str"+ mPendingVisibleInsets.toShortString()+ "String_Node_Str"+ mSurface);
      if (mPendingConfiguration.seq != 0) {
        if (DEBUG_CONFIGURATION)         Log.v(TAG,"String_Node_Str" + mPendingConfiguration);
        updateConfiguration(mPendingConfiguration,!mFirst);
        mPendingConfiguration.seq=0;
      }
      contentInsetsChanged=!mPendingContentInsets.equals(mAttachInfo.mContentInsets);
      visibleInsetsChanged=!mPendingVisibleInsets.equals(mAttachInfo.mVisibleInsets);
      if (contentInsetsChanged) {
        mAttachInfo.mContentInsets.set(mPendingContentInsets);
        host.fitSystemWindows(mAttachInfo.mContentInsets);
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mContentInsets);
      }
      if (visibleInsetsChanged) {
        mAttachInfo.mVisibleInsets.set(mPendingVisibleInsets);
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + mAttachInfo.mVisibleInsets);
      }
      if (!hadSurface) {
        if (mSurface.isValid()) {
          newSurface=true;
          fullRedrawNeeded=true;
          mPreviousTransparentRegion.setEmpty();
          if (mGlWanted && !mUseGL) {
            initializeGL();
            initialized=mGlCanvas != null;
          }
        }
      }
 else       if (!mSurface.isValid()) {
        mLastScrolledFocus=null;
        mScrollY=mCurScrollY=0;
        if (mScroller != null) {
          mScroller.abortAnimation();
        }
      }
    }
 catch (    RemoteException e) {
    }
    if (DEBUG_ORIENTATION)     Log.v("String_Node_Str","String_Node_Str" + frame + "String_Node_Str"+ mSurface);
    attachInfo.mWindowLeft=frame.left;
    attachInfo.mWindowTop=frame.top;
    mWidth=frame.width();
    mHeight=frame.height();
    if (initialized) {
      mGlCanvas.setViewport((int)(mWidth * appScale + 0.5f),(int)(mHeight * appScale + 0.5f));
    }
    boolean focusChangedDueToTouchMode=ensureTouchModeLocally((relayoutResult & WindowManagerImpl.RELAYOUT_IN_TOUCH_MODE) != 0);
    if (focusChangedDueToTouchMode || mWidth != host.mMeasuredWidth || mHeight != host.mMeasuredHeight || contentInsetsChanged) {
      childWidthMeasureSpec=getRootMeasureSpec(mWidth,lp.width);
      childHeightMeasureSpec=getRootMeasureSpec(mHeight,lp.height);
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mWidth + "String_Node_Str"+ host.mMeasuredWidth+ "String_Node_Str"+ mHeight+ "String_Node_Str"+ host.mMeasuredHeight+ "String_Node_Str"+ contentInsetsChanged);
      host.measure(childWidthMeasureSpec,childHeightMeasureSpec);
      int width=host.mMeasuredWidth;
      int height=host.mMeasuredHeight;
      boolean measureAgain=false;
      if (lp.horizontalWeight > 0.0f) {
        width+=(int)((mWidth - width) * lp.horizontalWeight);
        childWidthMeasureSpec=MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY);
        measureAgain=true;
      }
      if (lp.verticalWeight > 0.0f) {
        height+=(int)((mHeight - height) * lp.verticalWeight);
        childHeightMeasureSpec=MeasureSpec.makeMeasureSpec(height,MeasureSpec.EXACTLY);
        measureAgain=true;
      }
      if (measureAgain) {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str" + width + "String_Node_Str"+ height);
        host.measure(childWidthMeasureSpec,childHeightMeasureSpec);
      }
      mLayoutRequested=true;
    }
  }
  final boolean didLayout=mLayoutRequested;
  boolean triggerGlobalLayoutListener=didLayout || attachInfo.mRecomputeGlobalAttributes;
  if (didLayout) {
    mLayoutRequested=false;
    mScrollMayChange=true;
    if (DEBUG_ORIENTATION || DEBUG_LAYOUT)     Log.v("String_Node_Str","String_Node_Str" + host + "String_Node_Str"+ host.mMeasuredWidth+ "String_Node_Str"+ host.mMeasuredHeight+ "String_Node_Str");
    long startTime=0L;
    if (Config.DEBUG && ViewDebug.profileLayout) {
      startTime=SystemClock.elapsedRealtime();
    }
    host.layout(0,0,host.mMeasuredWidth,host.mMeasuredHeight);
    if (Config.DEBUG && ViewDebug.consistencyCheckEnabled) {
      if (!host.dispatchConsistencyCheck(ViewDebug.CONSISTENCY_LAYOUT)) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + ViewDebug.CONSISTENCY_LOG_TAG + "String_Node_Str");
      }
    }
    if (Config.DEBUG && ViewDebug.profileLayout) {
      EventLog.writeEvent(60001,SystemClock.elapsedRealtime() - startTime);
    }
    if ((host.mPrivateFlags & View.REQUEST_TRANSPARENT_REGIONS) != 0) {
      host.getLocationInWindow(mTmpLocation);
      mTransparentRegion.set(mTmpLocation[0],mTmpLocation[1],mTmpLocation[0] + host.mRight - host.mLeft,mTmpLocation[1] + host.mBottom - host.mTop);
      host.gatherTransparentRegion(mTransparentRegion);
      if (mTranslator != null) {
        mTranslator.translateRegionInWindowToScreen(mTransparentRegion);
      }
      if (!mTransparentRegion.equals(mPreviousTransparentRegion)) {
        mPreviousTransparentRegion.set(mTransparentRegion);
        try {
          sWindowSession.setTransparentRegion(mWindow,mTransparentRegion);
        }
 catch (        RemoteException e) {
        }
      }
    }
    if (DBG) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      host.debug();
    }
  }
  if (triggerGlobalLayoutListener) {
    attachInfo.mRecomputeGlobalAttributes=false;
    attachInfo.mTreeObserver.dispatchOnGlobalLayout();
  }
  if (computesInternalInsets) {
    ViewTreeObserver.InternalInsetsInfo insets=attachInfo.mGivenInternalInsets;
    final Rect givenContent=attachInfo.mGivenInternalInsets.contentInsets;
    final Rect givenVisible=attachInfo.mGivenInternalInsets.visibleInsets;
    givenContent.left=givenContent.top=givenContent.right=givenContent.bottom=givenVisible.left=givenVisible.top=givenVisible.right=givenVisible.bottom=0;
    attachInfo.mTreeObserver.dispatchOnComputeInternalInsets(insets);
    Rect contentInsets=insets.contentInsets;
    Rect visibleInsets=insets.visibleInsets;
    if (mTranslator != null) {
      contentInsets=mTranslator.getTranslatedContentInsets(contentInsets);
      visibleInsets=mTranslator.getTranslatedVisbileInsets(visibleInsets);
    }
    if (insetsPending || !mLastGivenInsets.equals(insets)) {
      mLastGivenInsets.set(insets);
      try {
        sWindowSession.setInsets(mWindow,insets.mTouchableInsets,contentInsets,visibleInsets);
      }
 catch (      RemoteException e) {
      }
    }
  }
  if (mFirst) {
    if (DEBUG_INPUT_RESIZE)     Log.v(TAG,"String_Node_Str" + mView.hasFocus());
    if (mView != null) {
      if (!mView.hasFocus()) {
        mView.requestFocus(View.FOCUS_FORWARD);
        mFocusedView=mRealFocusedView=mView.findFocus();
        if (DEBUG_INPUT_RESIZE)         Log.v(TAG,"String_Node_Str" + mFocusedView);
      }
 else {
        mRealFocusedView=mView.findFocus();
        if (DEBUG_INPUT_RESIZE)         Log.v(TAG,"String_Node_Str" + mRealFocusedView);
      }
    }
  }
  mFirst=false;
  mWillDrawSoon=false;
  mNewSurfaceNeeded=false;
  mViewVisibility=viewVisibility;
  if (mAttachInfo.mHasWindowFocus) {
    final boolean imTarget=WindowManager.LayoutParams.mayUseInputMethod(mWindowAttributes.flags);
    if (imTarget != mLastWasImTarget) {
      mLastWasImTarget=imTarget;
      InputMethodManager imm=InputMethodManager.peekInstance();
      if (imm != null && imTarget) {
        imm.startGettingWindowFocus(mView);
        imm.onWindowFocus(mView,mView.findFocus(),mWindowAttributes.softInputMode,!mHasHadWindowFocus,mWindowAttributes.flags);
      }
    }
  }
  boolean cancelDraw=attachInfo.mTreeObserver.dispatchOnPreDraw();
  if (!cancelDraw && !newSurface) {
    mFullRedrawNeeded=false;
    draw(fullRedrawNeeded);
    if ((relayoutResult & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0 || mReportNextDraw) {
      if (LOCAL_LOGV) {
        Log.v("String_Node_Str","String_Node_Str" + mWindowAttributes.getTitle());
      }
      mReportNextDraw=false;
      try {
        sWindowSession.finishDrawing(mWindow);
      }
 catch (      RemoteException e) {
      }
    }
  }
 else {
    if ((relayoutResult & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
      mReportNextDraw=true;
    }
    if (fullRedrawNeeded) {
      mFullRedrawNeeded=true;
    }
    scheduleTraversals();
  }
}