Program: 192933
Project: 192933
Buggy source:
void prepareSurfaceLocked(final boolean recoveringMemory){
  final WindowState w=mWin;
  if (mSurfaceController == null || !mSurfaceController.hasSurface()) {
    if (w.mOrientationChanging) {
      if (DEBUG_ORIENTATION) {
        Slog.v(TAG,"String_Node_Str" + w);
      }
      w.mOrientationChanging=false;
    }
    return;
  }
  boolean displayed=false;
  computeShownFrameLocked();
  setSurfaceBoundariesLocked(recoveringMemory);
  if (mIsWallpaper && !mWin.mWallpaperVisible) {
    hide("String_Node_Str");
  }
 else   if (w.mAttachedHidden || !w.isOnScreen()) {
    hide("String_Node_Str");
    mWallpaperControllerLocked.hideWallpapers(w);
    if (w.mOrientationChanging) {
      w.mOrientationChanging=false;
      if (DEBUG_ORIENTATION)       Slog.v(TAG,"String_Node_Str" + w);
    }
  }
 else   if (mLastLayer != mAnimLayer || mLastAlpha != mShownAlpha || mLastDsDx != mDsDx || mLastDtDx != mDtDx || mLastDsDy != mDsDy || mLastDtDy != mDtDy || w.mLastHScale != w.mHScale || w.mLastVScale != w.mVScale || mLastHidden) {
    displayed=true;
    mLastAlpha=mShownAlpha;
    mLastLayer=mAnimLayer;
    mLastDsDx=mDsDx;
    mLastDtDx=mDtDx;
    mLastDsDy=mDsDy;
    mLastDtDy=mDtDy;
    w.mLastHScale=w.mHScale;
    w.mLastVScale=w.mVScale;
    if (SHOW_TRANSACTIONS)     WindowManagerService.logSurface(w,"String_Node_Str" + mSurfaceController + "String_Node_Str"+ mShownAlpha+ "String_Node_Str"+ mAnimLayer+ "String_Node_Str"+ mDsDx+ "String_Node_Str"+ w.mHScale+ "String_Node_Str"+ mDtDx+ "String_Node_Str"+ w.mVScale+ "String_Node_Str"+ mDsDy+ "String_Node_Str"+ w.mHScale+ "String_Node_Str"+ mDtDy+ "String_Node_Str"+ w.mVScale+ "String_Node_Str",null);
    boolean prepared=mSurfaceController.prepareToShowInTransaction(mShownAlpha,mAnimLayer,mDsDx * w.mHScale,mDtDx * w.mVScale,mDsDy * w.mHScale,mDtDy * w.mVScale,recoveringMemory);
    if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
      if (showSurfaceRobustlyLocked()) {
        mAnimator.requestRemovalOfReplacedWindows(w);
        mLastHidden=false;
        if (mIsWallpaper) {
          mWallpaperControllerLocked.dispatchWallpaperVisibility(w,true);
        }
        mAnimator.setPendingLayoutChanges(w.getDisplayId(),WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM);
      }
 else {
        w.mOrientationChanging=false;
      }
    }
    if (mSurfaceController != null && mSurfaceController.hasSurface()) {
      w.mToken.hasVisible=true;
    }
  }
 else {
    if (DEBUG_ANIM && isAnimating()) {
      Slog.v(TAG,"String_Node_Str" + this);
    }
    displayed=true;
  }
  if (displayed) {
    if (w.mOrientationChanging) {
      if (!w.isDrawnLw()) {
        mAnimator.mBulkUpdateParams&=~SET_ORIENTATION_CHANGE_COMPLETE;
        mAnimator.mLastWindowFreezeSource=w;
        if (DEBUG_ORIENTATION)         Slog.v(TAG,"String_Node_Str" + w);
      }
 else {
        w.mOrientationChanging=false;
        if (DEBUG_ORIENTATION)         Slog.v(TAG,"String_Node_Str" + w);
      }
    }
    w.mToken.hasVisible=true;
    final Task task=w.getTask();
    if (task != null) {
      task.scheduleShowNonResizeableDockToastIfNeeded();
    }
  }
}

Fixed version (ground truth):
void prepareSurfaceLocked(final boolean recoveringMemory){
  final WindowState w=mWin;
  if (mSurfaceController == null || !mSurfaceController.hasSurface()) {
    if (w.mOrientationChanging) {
      if (DEBUG_ORIENTATION) {
        Slog.v(TAG,"String_Node_Str" + w);
      }
      w.mOrientationChanging=false;
    }
    return;
  }
  boolean displayed=false;
  computeShownFrameLocked();
  setSurfaceBoundariesLocked(recoveringMemory);
  if (mIsWallpaper && !mWin.mWallpaperVisible) {
    hide("String_Node_Str");
  }
 else   if (w.mAttachedHidden || !w.isOnScreen()) {
    hide("String_Node_Str");
    mWallpaperControllerLocked.hideWallpapers(w);
    if (w.mOrientationChanging) {
      w.mOrientationChanging=false;
      if (DEBUG_ORIENTATION)       Slog.v(TAG,"String_Node_Str" + w);
    }
  }
 else   if (mLastLayer != mAnimLayer || mLastAlpha != mShownAlpha || mLastDsDx != mDsDx || mLastDtDx != mDtDx || mLastDsDy != mDsDy || mLastDtDy != mDtDy || w.mLastHScale != w.mHScale || w.mLastVScale != w.mVScale || mLastHidden) {
    displayed=true;
    mLastAlpha=mShownAlpha;
    mLastLayer=mAnimLayer;
    mLastDsDx=mDsDx;
    mLastDtDx=mDtDx;
    mLastDsDy=mDsDy;
    mLastDtDy=mDtDy;
    w.mLastHScale=w.mHScale;
    w.mLastVScale=w.mVScale;
    if (SHOW_TRANSACTIONS)     WindowManagerService.logSurface(w,"String_Node_Str" + mSurfaceController + "String_Node_Str"+ mShownAlpha+ "String_Node_Str"+ mAnimLayer+ "String_Node_Str"+ mDsDx+ "String_Node_Str"+ w.mHScale+ "String_Node_Str"+ mDtDx+ "String_Node_Str"+ w.mVScale+ "String_Node_Str"+ mDsDy+ "String_Node_Str"+ w.mHScale+ "String_Node_Str"+ mDtDy+ "String_Node_Str"+ w.mVScale+ "String_Node_Str",false);
    boolean prepared=mSurfaceController.prepareToShowInTransaction(mShownAlpha,mAnimLayer,mDsDx * w.mHScale,mDtDx * w.mVScale,mDsDy * w.mHScale,mDtDy * w.mVScale,recoveringMemory);
    if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
      if (showSurfaceRobustlyLocked()) {
        mAnimator.requestRemovalOfReplacedWindows(w);
        mLastHidden=false;
        if (mIsWallpaper) {
          mWallpaperControllerLocked.dispatchWallpaperVisibility(w,true);
        }
        mAnimator.setPendingLayoutChanges(w.getDisplayId(),WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM);
      }
 else {
        w.mOrientationChanging=false;
      }
    }
    if (mSurfaceController != null && mSurfaceController.hasSurface()) {
      w.mToken.hasVisible=true;
    }
  }
 else {
    if (DEBUG_ANIM && isAnimating()) {
      Slog.v(TAG,"String_Node_Str" + this);
    }
    displayed=true;
  }
  if (displayed) {
    if (w.mOrientationChanging) {
      if (!w.isDrawnLw()) {
        mAnimator.mBulkUpdateParams&=~SET_ORIENTATION_CHANGE_COMPLETE;
        mAnimator.mLastWindowFreezeSource=w;
        if (DEBUG_ORIENTATION)         Slog.v(TAG,"String_Node_Str" + w);
      }
 else {
        w.mOrientationChanging=false;
        if (DEBUG_ORIENTATION)         Slog.v(TAG,"String_Node_Str" + w);
      }
    }
    w.mToken.hasVisible=true;
    final Task task=w.getTask();
    if (task != null) {
      task.scheduleShowNonResizeableDockToastIfNeeded();
    }
  }
}