Program: 193095
Project: 193095
Buggy source:
@Override public void setAppStartingWindow(IBinder token,String pkg,int theme,CompatibilityInfo compatInfo,CharSequence nonLocalizedLabel,int labelRes,int icon,int logo,int windowFlags,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)     Slog.v(TAG,"String_Node_Str" + token + "String_Node_Str"+ pkg+ "String_Node_Str"+ transferFrom);
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null) {
      Slog.w(TAG,"String_Node_Str" + token);
      return;
    }
    if (!okToDisplay()) {
      return;
    }
    if (wtoken.startingData != null) {
      return;
    }
    if (transferFrom != null) {
      AppWindowToken ttoken=findAppWindowToken(transferFrom);
      if (ttoken != null) {
        WindowState startingWindow=ttoken.startingWindow;
        if (startingWindow != null) {
          mSkipAppTransitionAnimation=true;
          if (DEBUG_STARTING_WINDOW)           Slog.v(TAG,"String_Node_Str" + startingWindow + "String_Node_Str"+ ttoken+ "String_Node_Str"+ wtoken);
          final long origId=Binder.clearCallingIdentity();
          wtoken.startingData=ttoken.startingData;
          wtoken.startingView=ttoken.startingView;
          wtoken.startingDisplayed=ttoken.startingDisplayed;
          ttoken.startingDisplayed=false;
          wtoken.startingWindow=startingWindow;
          wtoken.reportedVisible=ttoken.reportedVisible;
          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 || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) {
            Slog.v(TAG,"String_Node_Str" + startingWindow);
          }
          startingWindow.getWindowList().remove(startingWindow);
          mWindowsChanged=true;
          if (DEBUG_ADD_REMOVE)           Slog.v(TAG,"String_Node_Str" + startingWindow + "String_Node_Str"+ ttoken);
          ttoken.windows.remove(startingWindow);
          ttoken.allAppWindows.remove(startingWindow);
          addWindowToListInOrderLocked(startingWindow,true);
          if (ttoken.allDrawn) {
            wtoken.allDrawn=true;
            wtoken.deferClearAllDrawn=ttoken.deferClearAllDrawn;
          }
          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();
          }
          ttoken.mAppAnimator.transferCurrentAnimation(wtoken.mAppAnimator,startingWindow.mWinAnimator);
          updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,true);
          getDefaultDisplayContentLocked().layoutNeeded=true;
          performLayoutAndPlaceSurfacesLocked();
          Binder.restoreCallingIdentity(origId);
          return;
        }
 else         if (ttoken.startingData != null) {
          if (DEBUG_STARTING_WINDOW)           Slog.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;
        }
        final AppWindowAnimator tAppAnimator=ttoken.mAppAnimator;
        final AppWindowAnimator wAppAnimator=wtoken.mAppAnimator;
        if (tAppAnimator.thumbnail != null) {
          if (wAppAnimator.thumbnail != null) {
            wAppAnimator.thumbnail.destroy();
          }
          wAppAnimator.thumbnail=tAppAnimator.thumbnail;
          wAppAnimator.thumbnailX=tAppAnimator.thumbnailX;
          wAppAnimator.thumbnailY=tAppAnimator.thumbnailY;
          wAppAnimator.thumbnailLayer=tAppAnimator.thumbnailLayer;
          wAppAnimator.thumbnailAnimation=tAppAnimator.thumbnailAnimation;
          tAppAnimator.thumbnail=null;
        }
      }
    }
    if (!createIfNeeded) {
      return;
    }
    if (DEBUG_STARTING_WINDOW)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(theme));
    if (theme != 0) {
      AttributeCache.Entry ent=AttributeCache.instance().get(pkg,theme,com.android.internal.R.styleable.Window,mCurrentUserId);
      if (ent == null) {
        return;
      }
      if (DEBUG_STARTING_WINDOW)       Slog.v(TAG,"String_Node_Str" + ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,false) + "String_Node_Str"+ ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,false)+ "String_Node_Str"+ ent.array.getBoolean(com.android.internal.R.styleable.Window_windowShowWallpaper,false));
      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)) {
        if (mWallpaperTarget == null) {
          windowFlags|=FLAG_SHOW_WALLPAPER;
        }
 else {
          return;
        }
      }
    }
    if (DEBUG_STARTING_WINDOW)     Slog.v(TAG,"String_Node_Str");
    wtoken.startingData=new StartingData(pkg,theme,compatInfo,nonLocalizedLabel,labelRes,icon,logo,windowFlags);
    Message m=mH.obtainMessage(H.ADD_STARTING,wtoken);
    if (DEBUG_STARTING_WINDOW)     Slog.v(TAG,"String_Node_Str");
    mH.sendMessageAtFrontOfQueue(m);
  }
}

Fixed version (ground truth):
@Override public void setAppStartingWindow(IBinder token,String pkg,int theme,CompatibilityInfo compatInfo,CharSequence nonLocalizedLabel,int labelRes,int icon,int logo,int windowFlags,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)     Slog.v(TAG,"String_Node_Str" + token + "String_Node_Str"+ pkg+ "String_Node_Str"+ transferFrom);
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null) {
      Slog.w(TAG,"String_Node_Str" + token);
      return;
    }
    if (!okToDisplay()) {
      return;
    }
    if (wtoken.startingData != null) {
      return;
    }
    if (transferFrom != null) {
      AppWindowToken ttoken=findAppWindowToken(transferFrom);
      if (ttoken != null) {
        WindowState startingWindow=ttoken.startingWindow;
        if (startingWindow != null && ttoken.startingView != null) {
          mSkipAppTransitionAnimation=true;
          if (DEBUG_STARTING_WINDOW)           Slog.v(TAG,"String_Node_Str" + startingWindow + "String_Node_Str"+ ttoken+ "String_Node_Str"+ wtoken);
          final long origId=Binder.clearCallingIdentity();
          wtoken.startingData=ttoken.startingData;
          wtoken.startingView=ttoken.startingView;
          wtoken.startingDisplayed=ttoken.startingDisplayed;
          ttoken.startingDisplayed=false;
          wtoken.startingWindow=startingWindow;
          wtoken.reportedVisible=ttoken.reportedVisible;
          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 || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) {
            Slog.v(TAG,"String_Node_Str" + startingWindow);
          }
          startingWindow.getWindowList().remove(startingWindow);
          mWindowsChanged=true;
          if (DEBUG_ADD_REMOVE)           Slog.v(TAG,"String_Node_Str" + startingWindow + "String_Node_Str"+ ttoken);
          ttoken.windows.remove(startingWindow);
          ttoken.allAppWindows.remove(startingWindow);
          addWindowToListInOrderLocked(startingWindow,true);
          if (ttoken.allDrawn) {
            wtoken.allDrawn=true;
            wtoken.deferClearAllDrawn=ttoken.deferClearAllDrawn;
          }
          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();
          }
          ttoken.mAppAnimator.transferCurrentAnimation(wtoken.mAppAnimator,startingWindow.mWinAnimator);
          updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,true);
          getDefaultDisplayContentLocked().layoutNeeded=true;
          performLayoutAndPlaceSurfacesLocked();
          Binder.restoreCallingIdentity(origId);
          return;
        }
 else         if (ttoken.startingData != null) {
          if (DEBUG_STARTING_WINDOW)           Slog.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;
        }
        final AppWindowAnimator tAppAnimator=ttoken.mAppAnimator;
        final AppWindowAnimator wAppAnimator=wtoken.mAppAnimator;
        if (tAppAnimator.thumbnail != null) {
          if (wAppAnimator.thumbnail != null) {
            wAppAnimator.thumbnail.destroy();
          }
          wAppAnimator.thumbnail=tAppAnimator.thumbnail;
          wAppAnimator.thumbnailX=tAppAnimator.thumbnailX;
          wAppAnimator.thumbnailY=tAppAnimator.thumbnailY;
          wAppAnimator.thumbnailLayer=tAppAnimator.thumbnailLayer;
          wAppAnimator.thumbnailAnimation=tAppAnimator.thumbnailAnimation;
          tAppAnimator.thumbnail=null;
        }
      }
    }
    if (!createIfNeeded) {
      return;
    }
    if (DEBUG_STARTING_WINDOW)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(theme));
    if (theme != 0) {
      AttributeCache.Entry ent=AttributeCache.instance().get(pkg,theme,com.android.internal.R.styleable.Window,mCurrentUserId);
      if (ent == null) {
        return;
      }
      if (DEBUG_STARTING_WINDOW)       Slog.v(TAG,"String_Node_Str" + ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,false) + "String_Node_Str"+ ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,false)+ "String_Node_Str"+ ent.array.getBoolean(com.android.internal.R.styleable.Window_windowShowWallpaper,false));
      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)) {
        if (mWallpaperTarget == null) {
          windowFlags|=FLAG_SHOW_WALLPAPER;
        }
 else {
          return;
        }
      }
    }
    if (DEBUG_STARTING_WINDOW)     Slog.v(TAG,"String_Node_Str");
    wtoken.startingData=new StartingData(pkg,theme,compatInfo,nonLocalizedLabel,labelRes,icon,logo,windowFlags);
    Message m=mH.obtainMessage(H.ADD_STARTING,wtoken);
    if (DEBUG_STARTING_WINDOW)     Slog.v(TAG,"String_Node_Str");
    mH.sendMessageAtFrontOfQueue(m);
  }
}