Program: 192930
Project: 192930
Buggy source:
WindowSurfaceController createSurfaceLocked(){
  final WindowState w=mWin;
  if (mSurfaceController == null) {
    if (DEBUG_ANIM || DEBUG_ORIENTATION)     Slog.i(TAG,"String_Node_Str" + this + "String_Node_Str");
    mDrawState=DRAW_PENDING;
    if (w.mAppToken != null) {
      if (w.mAppToken.mAppAnimator.animation == null) {
        w.mAppToken.allDrawn=false;
        w.mAppToken.deferClearAllDrawn=false;
      }
 else {
        w.mAppToken.deferClearAllDrawn=true;
      }
    }
    mService.makeWindowFreezingScreenIfNeededLocked(w);
    int flags=SurfaceControl.HIDDEN;
    final WindowManager.LayoutParams attrs=w.mAttrs;
    if (mService.isSecureLocked(w)) {
      flags|=SurfaceControl.SECURE;
    }
    mTmpSize.set(w.mFrame.left + w.mXOffset,w.mFrame.top + w.mYOffset,0,0);
    calculateSurfaceBounds(w,attrs);
    final int width=mTmpSize.width();
    final int height=mTmpSize.height();
    if (DEBUG_VISIBILITY) {
      Slog.v(TAG,"String_Node_Str" + mSession.mSurfaceSession + "String_Node_Str"+ this+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str"+ mTmpSize.left+ "String_Node_Str"+ mTmpSize.top+ "String_Node_Str"+ attrs.format+ "String_Node_Str"+ flags);
    }
    mLastSystemDecorRect.set(0,0,0,0);
    mHasClipRect=false;
    mClipRect.set(0,0,0,0);
    mLastClipRect.set(0,0,0,0);
    try {
      final boolean isHwAccelerated=(attrs.flags & FLAG_HARDWARE_ACCELERATED) != 0;
      final int format=isHwAccelerated ? PixelFormat.TRANSLUCENT : attrs.format;
      if (!PixelFormat.formatHasAlpha(attrs.format) && attrs.surfaceInsets.left == 0 && attrs.surfaceInsets.top == 0 && attrs.surfaceInsets.right == 0 && attrs.surfaceInsets.bottom == 0 && !w.isDragResizing()) {
        flags|=SurfaceControl.OPAQUE;
      }
      mSurfaceController=new WindowSurfaceController(mSession.mSurfaceSession,attrs.getTitle().toString(),width,height,format,flags,this);
      w.setHasSurface(true);
      if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
        Slog.i(TAG,"String_Node_Str" + mSurfaceController + "String_Node_Str"+ mSession.mSurfaceSession+ "String_Node_Str"+ mSession.mPid+ "String_Node_Str"+ attrs.format+ "String_Node_Str"+ Integer.toHexString(flags)+ "String_Node_Str"+ this);
      }
    }
 catch (    OutOfResourcesException e) {
      w.setHasSurface(false);
      Slog.w(TAG,"String_Node_Str");
      mService.reclaimSomeSurfaceMemoryLocked(this,"String_Node_Str",true);
      mDrawState=NO_SURFACE;
      return null;
    }
catch (    Exception e) {
      w.setHasSurface(false);
      Slog.e(TAG,"String_Node_Str",e);
      mDrawState=NO_SURFACE;
      return null;
    }
    if (WindowManagerService.localLOGV) {
      Slog.v(TAG,"String_Node_Str" + mSurfaceController + "String_Node_Str"+ w.mFrame.left+ "String_Node_Str"+ w.mFrame.top+ "String_Node_Str"+ mAnimLayer);
    }
    if (SHOW_LIGHT_TRANSACTIONS) {
      Slog.i(TAG,"String_Node_Str");
      WindowManagerService.logSurface(w,"String_Node_Str" + w.mFrame.left + "String_Node_Str"+ w.mFrame.top+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str"+ mAnimLayer+ "String_Node_Str",null);
    }
    final int layerStack=w.getDisplayContent().getDisplay().getLayerStack();
    if (SHOW_TRANSACTIONS)     WindowManagerService.logSurface(w,"String_Node_Str" + mTmpSize.left + "String_Node_Str"+ mTmpSize.top,null);
    mSurfaceController.setPositionAndLayer(mTmpSize.left,mTmpSize.top,layerStack,mAnimLayer);
    mLastHidden=true;
    if (WindowManagerService.localLOGV)     Slog.v(TAG,"String_Node_Str" + this);
  }
  return mSurfaceController;
}

Fixed version (ground truth):
WindowSurfaceController createSurfaceLocked(){
  final WindowState w=mWin;
  if (mSurfaceController == null) {
    if (DEBUG_ANIM || DEBUG_ORIENTATION)     Slog.i(TAG,"String_Node_Str" + this + "String_Node_Str");
    mDrawState=DRAW_PENDING;
    if (w.mAppToken != null) {
      if (w.mAppToken.mAppAnimator.animation == null) {
        w.mAppToken.allDrawn=false;
        w.mAppToken.deferClearAllDrawn=false;
      }
 else {
        w.mAppToken.deferClearAllDrawn=true;
      }
    }
    mService.makeWindowFreezingScreenIfNeededLocked(w);
    int flags=SurfaceControl.HIDDEN;
    final WindowManager.LayoutParams attrs=w.mAttrs;
    if (mService.isSecureLocked(w)) {
      flags|=SurfaceControl.SECURE;
    }
    mTmpSize.set(w.mFrame.left + w.mXOffset,w.mFrame.top + w.mYOffset,0,0);
    calculateSurfaceBounds(w,attrs);
    final int width=mTmpSize.width();
    final int height=mTmpSize.height();
    if (DEBUG_VISIBILITY) {
      Slog.v(TAG,"String_Node_Str" + mSession.mSurfaceSession + "String_Node_Str"+ this+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str"+ mTmpSize.left+ "String_Node_Str"+ mTmpSize.top+ "String_Node_Str"+ attrs.format+ "String_Node_Str"+ flags);
    }
    mLastSystemDecorRect.set(0,0,0,0);
    mHasClipRect=false;
    mClipRect.set(0,0,0,0);
    mLastClipRect.set(0,0,0,0);
    try {
      final boolean isHwAccelerated=(attrs.flags & FLAG_HARDWARE_ACCELERATED) != 0;
      final int format=isHwAccelerated ? PixelFormat.TRANSLUCENT : attrs.format;
      if (!PixelFormat.formatHasAlpha(attrs.format) && attrs.surfaceInsets.left == 0 && attrs.surfaceInsets.top == 0 && attrs.surfaceInsets.right == 0 && attrs.surfaceInsets.bottom == 0 && !w.isDragResizing()) {
        flags|=SurfaceControl.OPAQUE;
      }
      mSurfaceController=new WindowSurfaceController(mSession.mSurfaceSession,attrs.getTitle().toString(),width,height,format,flags,this);
      w.setHasSurface(true);
      if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
        Slog.i(TAG,"String_Node_Str" + mSurfaceController + "String_Node_Str"+ mSession.mSurfaceSession+ "String_Node_Str"+ mSession.mPid+ "String_Node_Str"+ attrs.format+ "String_Node_Str"+ Integer.toHexString(flags)+ "String_Node_Str"+ this);
      }
    }
 catch (    OutOfResourcesException e) {
      w.setHasSurface(false);
      Slog.w(TAG,"String_Node_Str");
      mService.reclaimSomeSurfaceMemoryLocked(this,"String_Node_Str",true);
      mDrawState=NO_SURFACE;
      return null;
    }
catch (    Exception e) {
      w.setHasSurface(false);
      Slog.e(TAG,"String_Node_Str",e);
      mDrawState=NO_SURFACE;
      return null;
    }
    if (WindowManagerService.localLOGV) {
      Slog.v(TAG,"String_Node_Str" + mSurfaceController + "String_Node_Str"+ w.mFrame.left+ "String_Node_Str"+ w.mFrame.top+ "String_Node_Str"+ mAnimLayer);
    }
    if (SHOW_LIGHT_TRANSACTIONS) {
      Slog.i(TAG,"String_Node_Str");
      WindowManagerService.logSurface(w,"String_Node_Str" + w.mFrame.left + "String_Node_Str"+ w.mFrame.top+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str"+ mAnimLayer+ "String_Node_Str",false);
    }
    final int layerStack=w.getDisplayContent().getDisplay().getLayerStack();
    if (SHOW_TRANSACTIONS)     WindowManagerService.logSurface(w,"String_Node_Str" + mTmpSize.left + "String_Node_Str"+ mTmpSize.top,false);
    mSurfaceController.setPositionAndLayer(mTmpSize.left,mTmpSize.top,layerStack,mAnimLayer);
    mLastHidden=true;
    if (WindowManagerService.localLOGV)     Slog.v(TAG,"String_Node_Str" + this);
  }
  return mSurfaceController;
}