Program: 183072
Project: 183072
Buggy source:
public void setAppStartingWindow(IBinder token,String pkg,int theme,CharSequence nonLocalizedLabel,int labelRes,int icon,IBinder transferFrom,boolean createIfNeeded){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (DEBUG_STARTING_WINDOW)     Log.v(TAG,"String_Node_Str" + token + "String_Node_Str"+ pkg+ "String_Node_Str"+ transferFrom);
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null) {
      Log.w(TAG,"String_Node_Str" + token);
      return;
    }
    if (mDisplayFrozen) {
      return;
    }
    if (wtoken.startingData != null) {
      return;
    }
    if (transferFrom != null) {
      AppWindowToken ttoken=findAppWindowToken(transferFrom);
      if (ttoken != null) {
        WindowState startingWindow=ttoken.startingWindow;
        if (startingWindow != null) {
          if (mStartingIconInTransition) {
            mSkipAppTransitionAnimation=true;
          }
          if (DEBUG_STARTING_WINDOW)           Log.v(TAG,"String_Node_Str" + ttoken + "String_Node_Str"+ wtoken);
          final long origId=Binder.clearCallingIdentity();
          wtoken.startingData=ttoken.startingData;
          wtoken.startingView=ttoken.startingView;
          wtoken.startingWindow=startingWindow;
          ttoken.startingData=null;
          ttoken.startingView=null;
          ttoken.startingWindow=null;
          ttoken.startingMoved=true;
          startingWindow.mToken=wtoken;
          startingWindow.mRootToken=wtoken;
          startingWindow.mAppToken=wtoken;
          if (DEBUG_WINDOW_MOVEMENT)           Log.v(TAG,"String_Node_Str" + startingWindow);
          mWindows.remove(startingWindow);
          ttoken.windows.remove(startingWindow);
          ttoken.allAppWindows.remove(startingWindow);
          addWindowToListInOrderLocked(startingWindow,true);
          wtoken.allAppWindows.add(startingWindow);
          if (ttoken.allDrawn) {
            wtoken.allDrawn=true;
          }
          if (ttoken.firstWindowDrawn) {
            wtoken.firstWindowDrawn=true;
          }
          if (!ttoken.hidden) {
            wtoken.hidden=false;
            wtoken.hiddenRequested=false;
            wtoken.willBeHidden=false;
          }
          if (wtoken.clientHidden != ttoken.clientHidden) {
            wtoken.clientHidden=ttoken.clientHidden;
            wtoken.sendAppVisibilityToClients();
          }
          if (ttoken.animation != null) {
            wtoken.animation=ttoken.animation;
            wtoken.animating=ttoken.animating;
            wtoken.animLayerAdjustment=ttoken.animLayerAdjustment;
            ttoken.animation=null;
            ttoken.animLayerAdjustment=0;
            wtoken.updateLayers();
            ttoken.updateLayers();
          }
          updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES);
          mLayoutNeeded=true;
          performLayoutAndPlaceSurfacesLocked();
          Binder.restoreCallingIdentity(origId);
          return;
        }
 else         if (ttoken.startingData != null) {
          if (DEBUG_STARTING_WINDOW)           Log.v(TAG,"String_Node_Str" + ttoken + "String_Node_Str"+ wtoken);
          wtoken.startingData=ttoken.startingData;
          ttoken.startingData=null;
          ttoken.startingMoved=true;
          Message m=mH.obtainMessage(H.ADD_STARTING,wtoken);
          mH.sendMessageAtFrontOfQueue(m);
          return;
        }
      }
    }
    if (!createIfNeeded) {
      return;
    }
    if (theme != 0) {
      AttributeCache.Entry ent=AttributeCache.instance().get(pkg,theme,com.android.internal.R.styleable.Window);
      if (ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,false)) {
        return;
      }
      if (ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,false)) {
        return;
      }
      if (ent.array.getBoolean(com.android.internal.R.styleable.Window_windowShowWallpaper,false)) {
        return;
      }
    }
    mStartingIconInTransition=true;
    wtoken.startingData=new StartingData(pkg,theme,nonLocalizedLabel,labelRes,icon);
    Message m=mH.obtainMessage(H.ADD_STARTING,wtoken);
    mH.sendMessageAtFrontOfQueue(m);
  }
}

Fixed version (ground truth):
public void setAppStartingWindow(IBinder token,String pkg,int theme,CharSequence nonLocalizedLabel,int labelRes,int icon,IBinder transferFrom,boolean createIfNeeded){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (DEBUG_STARTING_WINDOW)     Log.v(TAG,"String_Node_Str" + token + "String_Node_Str"+ pkg+ "String_Node_Str"+ transferFrom);
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null) {
      Log.w(TAG,"String_Node_Str" + token);
      return;
    }
    if (mDisplayFrozen) {
      return;
    }
    if (wtoken.startingData != null) {
      return;
    }
    if (transferFrom != null) {
      AppWindowToken ttoken=findAppWindowToken(transferFrom);
      if (ttoken != null) {
        WindowState startingWindow=ttoken.startingWindow;
        if (startingWindow != null) {
          if (mStartingIconInTransition) {
            mSkipAppTransitionAnimation=true;
          }
          if (DEBUG_STARTING_WINDOW)           Log.v(TAG,"String_Node_Str" + ttoken + "String_Node_Str"+ wtoken);
          final long origId=Binder.clearCallingIdentity();
          wtoken.startingData=ttoken.startingData;
          wtoken.startingView=ttoken.startingView;
          wtoken.startingWindow=startingWindow;
          ttoken.startingData=null;
          ttoken.startingView=null;
          ttoken.startingWindow=null;
          ttoken.startingMoved=true;
          startingWindow.mToken=wtoken;
          startingWindow.mRootToken=wtoken;
          startingWindow.mAppToken=wtoken;
          if (DEBUG_WINDOW_MOVEMENT)           Log.v(TAG,"String_Node_Str" + startingWindow);
          mWindows.remove(startingWindow);
          ttoken.windows.remove(startingWindow);
          ttoken.allAppWindows.remove(startingWindow);
          addWindowToListInOrderLocked(startingWindow,true);
          if (ttoken.allDrawn) {
            wtoken.allDrawn=true;
          }
          if (ttoken.firstWindowDrawn) {
            wtoken.firstWindowDrawn=true;
          }
          if (!ttoken.hidden) {
            wtoken.hidden=false;
            wtoken.hiddenRequested=false;
            wtoken.willBeHidden=false;
          }
          if (wtoken.clientHidden != ttoken.clientHidden) {
            wtoken.clientHidden=ttoken.clientHidden;
            wtoken.sendAppVisibilityToClients();
          }
          if (ttoken.animation != null) {
            wtoken.animation=ttoken.animation;
            wtoken.animating=ttoken.animating;
            wtoken.animLayerAdjustment=ttoken.animLayerAdjustment;
            ttoken.animation=null;
            ttoken.animLayerAdjustment=0;
            wtoken.updateLayers();
            ttoken.updateLayers();
          }
          updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES);
          mLayoutNeeded=true;
          performLayoutAndPlaceSurfacesLocked();
          Binder.restoreCallingIdentity(origId);
          return;
        }
 else         if (ttoken.startingData != null) {
          if (DEBUG_STARTING_WINDOW)           Log.v(TAG,"String_Node_Str" + ttoken + "String_Node_Str"+ wtoken);
          wtoken.startingData=ttoken.startingData;
          ttoken.startingData=null;
          ttoken.startingMoved=true;
          Message m=mH.obtainMessage(H.ADD_STARTING,wtoken);
          mH.sendMessageAtFrontOfQueue(m);
          return;
        }
      }
    }
    if (!createIfNeeded) {
      return;
    }
    if (theme != 0) {
      AttributeCache.Entry ent=AttributeCache.instance().get(pkg,theme,com.android.internal.R.styleable.Window);
      if (ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,false)) {
        return;
      }
      if (ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,false)) {
        return;
      }
      if (ent.array.getBoolean(com.android.internal.R.styleable.Window_windowShowWallpaper,false)) {
        return;
      }
    }
    mStartingIconInTransition=true;
    wtoken.startingData=new StartingData(pkg,theme,nonLocalizedLabel,labelRes,icon);
    Message m=mH.obtainMessage(H.ADD_STARTING,wtoken);
    mH.sendMessageAtFrontOfQueue(m);
  }
}