Program: 183687
Project: 183687
Buggy source:
/** 
 * We have one child
 */
public void setView(View view,WindowManager.LayoutParams attrs,View panelParentView){
synchronized (this) {
    if (mView == null) {
      mView=view;
      mAppScale=mView.getContext().getApplicationScale();
      mAppScaleInverted=1.0f / mAppScale;
      mWindowAttributes.copyFrom(attrs);
      mSoftInputMode=attrs.softInputMode;
      mWindowAttributesChanged=true;
      mAttachInfo.mRootView=view;
      if (panelParentView != null) {
        mAttachInfo.mPanelParentWindowToken=panelParentView.getApplicationWindowToken();
      }
      mAdded=true;
      int res;
      requestLayout();
      try {
        res=sWindowSession.add(mWindow,attrs,getHostVisibility(),mAttachInfo.mContentInsets);
      }
 catch (      RemoteException e) {
        mAdded=false;
        mView=null;
        mAttachInfo.mRootView=null;
        unscheduleTraversals();
        throw new RuntimeException("String_Node_Str",e);
      }
      mAttachInfo.mContentInsets.scale(mAppScaleInverted);
      mPendingContentInsets.set(mAttachInfo.mContentInsets);
      mPendingVisibleInsets.set(0,0,0,0);
      if (Config.LOGV)       Log.v("String_Node_Str","String_Node_Str" + mWindow);
      if (res < WindowManagerImpl.ADD_OKAY) {
        mView=null;
        mAttachInfo.mRootView=null;
        mAdded=false;
        unscheduleTraversals();
switch (res) {
case WindowManagerImpl.ADD_BAD_APP_TOKEN:
case WindowManagerImpl.ADD_BAD_SUBWINDOW_TOKEN:
          throw new WindowManagerImpl.BadTokenException("String_Node_Str" + attrs.token + "String_Node_Str");
case WindowManagerImpl.ADD_NOT_APP_TOKEN:
        throw new WindowManagerImpl.BadTokenException("String_Node_Str" + attrs.token + "String_Node_Str");
case WindowManagerImpl.ADD_APP_EXITING:
      throw new WindowManagerImpl.BadTokenException("String_Node_Str" + attrs.token + "String_Node_Str");
case WindowManagerImpl.ADD_DUPLICATE_ADD:
    throw new WindowManagerImpl.BadTokenException("String_Node_Str" + mWindow + "String_Node_Str");
case WindowManagerImpl.ADD_STARTING_NOT_NEEDED:
  return;
case WindowManagerImpl.ADD_MULTIPLE_SINGLETON:
throw new WindowManagerImpl.BadTokenException("String_Node_Str" + mWindow + "String_Node_Str");
case WindowManagerImpl.ADD_PERMISSION_DENIED:
throw new WindowManagerImpl.BadTokenException("String_Node_Str" + mWindow + "String_Node_Str");
}
throw new RuntimeException("String_Node_Str" + res);
}
view.assignParent(this);
mAddedTouchMode=(res & WindowManagerImpl.ADD_FLAG_IN_TOUCH_MODE) != 0;
mAppVisible=(res & WindowManagerImpl.ADD_FLAG_APP_VISIBLE) != 0;
}
}
}

Fixed version (ground truth):
/** 
 * We have one child
 */
public void setView(View view,WindowManager.LayoutParams attrs,View panelParentView){
synchronized (this) {
    if (mView == null) {
      mView=view;
      mAppScale=mView.getContext().getApplicationScale();
      if (mAppScale != 1.0f) {
        mWindowLayoutParamsBackup=new int[4];
      }
      mAppScaleInverted=1.0f / mAppScale;
      mWindowAttributes.copyFrom(attrs);
      mSoftInputMode=attrs.softInputMode;
      mWindowAttributesChanged=true;
      mAttachInfo.mRootView=view;
      if (panelParentView != null) {
        mAttachInfo.mPanelParentWindowToken=panelParentView.getApplicationWindowToken();
      }
      mAdded=true;
      int res;
      requestLayout();
      try {
        res=sWindowSession.add(mWindow,attrs,getHostVisibility(),mAttachInfo.mContentInsets);
      }
 catch (      RemoteException e) {
        mAdded=false;
        mView=null;
        mAttachInfo.mRootView=null;
        unscheduleTraversals();
        throw new RuntimeException("String_Node_Str",e);
      }
      mAttachInfo.mContentInsets.scale(mAppScaleInverted);
      mPendingContentInsets.set(mAttachInfo.mContentInsets);
      mPendingVisibleInsets.set(0,0,0,0);
      if (Config.LOGV)       Log.v("String_Node_Str","String_Node_Str" + mWindow);
      if (res < WindowManagerImpl.ADD_OKAY) {
        mView=null;
        mAttachInfo.mRootView=null;
        mAdded=false;
        unscheduleTraversals();
switch (res) {
case WindowManagerImpl.ADD_BAD_APP_TOKEN:
case WindowManagerImpl.ADD_BAD_SUBWINDOW_TOKEN:
          throw new WindowManagerImpl.BadTokenException("String_Node_Str" + attrs.token + "String_Node_Str");
case WindowManagerImpl.ADD_NOT_APP_TOKEN:
        throw new WindowManagerImpl.BadTokenException("String_Node_Str" + attrs.token + "String_Node_Str");
case WindowManagerImpl.ADD_APP_EXITING:
      throw new WindowManagerImpl.BadTokenException("String_Node_Str" + attrs.token + "String_Node_Str");
case WindowManagerImpl.ADD_DUPLICATE_ADD:
    throw new WindowManagerImpl.BadTokenException("String_Node_Str" + mWindow + "String_Node_Str");
case WindowManagerImpl.ADD_STARTING_NOT_NEEDED:
  return;
case WindowManagerImpl.ADD_MULTIPLE_SINGLETON:
throw new WindowManagerImpl.BadTokenException("String_Node_Str" + mWindow + "String_Node_Str");
case WindowManagerImpl.ADD_PERMISSION_DENIED:
throw new WindowManagerImpl.BadTokenException("String_Node_Str" + mWindow + "String_Node_Str");
}
throw new RuntimeException("String_Node_Str" + res);
}
view.assignParent(this);
mAddedTouchMode=(res & WindowManagerImpl.ADD_FLAG_IN_TOUCH_MODE) != 0;
mAppVisible=(res & WindowManagerImpl.ADD_FLAG_APP_VISIBLE) != 0;
}
}
}