Program: 24237
Project: 24237
Buggy source:
private void updateWindow(boolean force){
  if (!mHaveFrame) {
    return;
  }
  int myWidth=mRequestedWidth;
  if (myWidth <= 0)   myWidth=getWidth();
  int myHeight=mRequestedHeight;
  if (myHeight <= 0)   myHeight=getHeight();
  if (mRequestedWidth <= 0) {
    myWidth*=mAppScale;
    myHeight*=mAppScale;
  }
  getLocationInWindow(mLocation);
  final boolean creating=mWindow == null;
  final boolean formatChanged=mFormat != mRequestedFormat;
  final boolean sizeChanged=mWidth != myWidth || mHeight != myHeight;
  final boolean visibleChanged=mVisible != mRequestedVisible || mNewSurfaceNeeded;
  final boolean typeChanged=mType != mRequestedType;
  if (force || creating || formatChanged|| sizeChanged|| visibleChanged|| typeChanged|| mLeft != mLocation[0] || mTop != mLocation[1]) {
    if (localLOGV)     Log.i(TAG,"String_Node_Str" + creating + "String_Node_Str"+ formatChanged+ "String_Node_Str"+ sizeChanged+ "String_Node_Str"+ visibleChanged+ "String_Node_Str"+ (mLeft != mLocation[0])+ "String_Node_Str"+ (mTop != mLocation[1]));
    try {
      final boolean visible=mVisible=mRequestedVisible;
      mLeft=mLocation[0];
      mTop=mLocation[1];
      mWidth=myWidth;
      mHeight=myHeight;
      mFormat=mRequestedFormat;
      mType=mRequestedType;
      mLayout.x=mLeft;
      mLayout.y=mTop;
      mLayout.width=(int)(getWidth() * mAppScale);
      mLayout.height=(int)(getHeight() * mAppScale);
      mLayout.format=mRequestedFormat;
      mLayout.flags|=WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_SCALED | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
      mLayout.memoryType=mRequestedType;
      if (mWindow == null) {
        mWindow=new MyWindow(this);
        mLayout.type=WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
        mLayout.gravity=Gravity.LEFT | Gravity.TOP;
        mSession.add(mWindow,mLayout,mVisible ? VISIBLE : GONE,mContentInsets);
      }
      if (visibleChanged && (!visible || mNewSurfaceNeeded)) {
        reportSurfaceDestroyed();
      }
      mNewSurfaceNeeded=false;
      mSurfaceLock.lock();
      mDrawingStopped=!visible;
      final int relayoutResult=mSession.relayout(mWindow,mLayout,mWidth,mHeight,visible ? VISIBLE : GONE,false,mWinFrame,mContentInsets,mVisibleInsets,mSurface);
      mContentInsets.scale(mAppScaleInverted);
      mVisibleInsets.scale(mAppScaleInverted);
      mWinFrame.scale(mAppScaleInverted);
      if (localLOGV)       Log.i(TAG,"String_Node_Str" + mSurface + "String_Node_Str"+ visible+ "String_Node_Str"+ mWinFrame);
      mSurfaceFrame.left=0;
      mSurfaceFrame.top=0;
      mSurfaceFrame.right=mWinFrame.width();
      mSurfaceFrame.bottom=mWinFrame.height();
      mSurfaceLock.unlock();
      try {
        if (visible) {
          mDestroyReportNeeded=true;
          SurfaceHolder.Callback callbacks[];
synchronized (mCallbacks) {
            callbacks=new SurfaceHolder.Callback[mCallbacks.size()];
            mCallbacks.toArray(callbacks);
          }
          if (visibleChanged) {
            mIsCreating=true;
            for (            SurfaceHolder.Callback c : callbacks) {
              c.surfaceCreated(mSurfaceHolder);
            }
          }
          if (creating || formatChanged || sizeChanged|| visibleChanged) {
            for (            SurfaceHolder.Callback c : callbacks) {
              c.surfaceChanged(mSurfaceHolder,mFormat,mWidth,mHeight);
            }
          }
        }
      }
  finally {
        mIsCreating=false;
        if (creating || (relayoutResult & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
          mSession.finishDrawing(mWindow);
        }
      }
    }
 catch (    RemoteException ex) {
    }
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + mLayout.x + "String_Node_Str"+ mLayout.y+ "String_Node_Str"+ mLayout.width+ "String_Node_Str"+ mLayout.height+ "String_Node_Str"+ mSurfaceFrame);
  }
}

Fixed version (ground truth):
private void updateWindow(boolean force){
  if (!mHaveFrame) {
    return;
  }
  int myWidth=mRequestedWidth;
  if (myWidth <= 0)   myWidth=getWidth();
  int myHeight=mRequestedHeight;
  if (myHeight <= 0)   myHeight=getHeight();
  if (mRequestedWidth <= 0) {
    myWidth*=mAppScale;
    myHeight*=mAppScale;
  }
  getLocationInWindow(mLocation);
  final boolean creating=mWindow == null;
  final boolean formatChanged=mFormat != mRequestedFormat;
  final boolean sizeChanged=mWidth != myWidth || mHeight != myHeight;
  final boolean visibleChanged=mVisible != mRequestedVisible || mNewSurfaceNeeded;
  final boolean typeChanged=mType != mRequestedType;
  if (force || creating || formatChanged|| sizeChanged|| visibleChanged|| typeChanged|| mLeft != mLocation[0] || mTop != mLocation[1]) {
    if (localLOGV)     Log.i(TAG,"String_Node_Str" + creating + "String_Node_Str"+ formatChanged+ "String_Node_Str"+ sizeChanged+ "String_Node_Str"+ visibleChanged+ "String_Node_Str"+ (mLeft != mLocation[0])+ "String_Node_Str"+ (mTop != mLocation[1]));
    try {
      final boolean visible=mVisible=mRequestedVisible;
      mLeft=mLocation[0];
      mTop=mLocation[1];
      mWidth=myWidth;
      mHeight=myHeight;
      mFormat=mRequestedFormat;
      mType=mRequestedType;
      mLayout.x=(int)(mLeft * mAppScale);
      mLayout.y=(int)(mTop * mAppScale);
      mLayout.width=(int)(getWidth() * mAppScale);
      mLayout.height=(int)(getHeight() * mAppScale);
      mLayout.format=mRequestedFormat;
      mLayout.flags|=WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_SCALED | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
      mLayout.memoryType=mRequestedType;
      if (mWindow == null) {
        mWindow=new MyWindow(this);
        mLayout.type=WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
        mLayout.gravity=Gravity.LEFT | Gravity.TOP;
        mSession.add(mWindow,mLayout,mVisible ? VISIBLE : GONE,mContentInsets);
      }
      if (visibleChanged && (!visible || mNewSurfaceNeeded)) {
        reportSurfaceDestroyed();
      }
      mNewSurfaceNeeded=false;
      mSurfaceLock.lock();
      mDrawingStopped=!visible;
      final int relayoutResult=mSession.relayout(mWindow,mLayout,mWidth,mHeight,visible ? VISIBLE : GONE,false,mWinFrame,mContentInsets,mVisibleInsets,mSurface);
      mContentInsets.scale(mAppScaleInverted);
      mVisibleInsets.scale(mAppScaleInverted);
      mWinFrame.scale(mAppScaleInverted);
      if (localLOGV)       Log.i(TAG,"String_Node_Str" + mSurface + "String_Node_Str"+ visible+ "String_Node_Str"+ mWinFrame);
      mSurfaceFrame.left=0;
      mSurfaceFrame.top=0;
      mSurfaceFrame.right=mWinFrame.width();
      mSurfaceFrame.bottom=mWinFrame.height();
      mSurfaceLock.unlock();
      try {
        if (visible) {
          mDestroyReportNeeded=true;
          SurfaceHolder.Callback callbacks[];
synchronized (mCallbacks) {
            callbacks=new SurfaceHolder.Callback[mCallbacks.size()];
            mCallbacks.toArray(callbacks);
          }
          if (visibleChanged) {
            mIsCreating=true;
            for (            SurfaceHolder.Callback c : callbacks) {
              c.surfaceCreated(mSurfaceHolder);
            }
          }
          if (creating || formatChanged || sizeChanged|| visibleChanged) {
            for (            SurfaceHolder.Callback c : callbacks) {
              c.surfaceChanged(mSurfaceHolder,mFormat,mWidth,mHeight);
            }
          }
        }
      }
  finally {
        mIsCreating=false;
        if (creating || (relayoutResult & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
          mSession.finishDrawing(mWindow);
        }
      }
    }
 catch (    RemoteException ex) {
    }
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + mLayout.x + "String_Node_Str"+ mLayout.y+ "String_Node_Str"+ mLayout.width+ "String_Node_Str"+ mLayout.height+ "String_Node_Str"+ mSurfaceFrame);
  }
}