Program: 182823
Project: 182823
Buggy source:
public void setAppVisibility(IBinder token,boolean visible){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
  AppWindowToken wtoken;
synchronized (mWindowMap) {
    wtoken=findAppWindowToken(token);
    if (wtoken == null) {
      Log.w(TAG,"String_Node_Str" + token);
      return;
    }
    if (DEBUG_APP_TRANSITIONS || DEBUG_ORIENTATION) {
      RuntimeException e=new RuntimeException();
      if (!HIDE_STACK_CRAWLS)       e.fillInStackTrace();
      Log.v(TAG,"String_Node_Str" + token + "String_Node_Str"+ visible+ "String_Node_Str"+ mNextAppTransition+ "String_Node_Str"+ wtoken.hidden+ "String_Node_Str"+ wtoken.hiddenRequested,e);
    }
    if (!mDisplayFrozen && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
      if (wtoken.hiddenRequested != visible) {
        return;
      }
      wtoken.hiddenRequested=!visible;
      if (DEBUG_APP_TRANSITIONS)       Log.v(TAG,"String_Node_Str" + wtoken);
      wtoken.setDummyAnimation();
      mOpeningApps.remove(wtoken);
      mClosingApps.remove(wtoken);
      wtoken.waitingToShow=wtoken.waitingToHide=false;
      wtoken.inPendingTransaction=true;
      if (visible) {
        mOpeningApps.add(wtoken);
        wtoken.allDrawn=false;
        wtoken.startingDisplayed=false;
        wtoken.startingMoved=false;
        wtoken.waitingToShow=true;
        if (wtoken.clientHidden) {
          wtoken.clientHidden=false;
          wtoken.sendAppVisibilityToClients();
        }
      }
 else {
        mClosingApps.add(wtoken);
        wtoken.waitingToHide=true;
      }
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    setTokenVisibilityLocked(wtoken,null,visible,WindowManagerPolicy.TRANSIT_UNSET,true);
    wtoken.updateReportedVisibilityLocked();
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
public void setAppVisibility(IBinder token,boolean visible){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
  AppWindowToken wtoken;
synchronized (mWindowMap) {
    wtoken=findAppWindowToken(token);
    if (wtoken == null) {
      Log.w(TAG,"String_Node_Str" + token);
      return;
    }
    if (DEBUG_APP_TRANSITIONS || DEBUG_ORIENTATION) {
      RuntimeException e=new RuntimeException();
      if (!HIDE_STACK_CRAWLS)       e.fillInStackTrace();
      Log.v(TAG,"String_Node_Str" + token + "String_Node_Str"+ visible+ "String_Node_Str"+ mNextAppTransition+ "String_Node_Str"+ wtoken.hidden+ "String_Node_Str"+ wtoken.hiddenRequested,e);
    }
    if (!mDisplayFrozen && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
      if (wtoken.hiddenRequested != visible) {
        return;
      }
      wtoken.hiddenRequested=!visible;
      if (DEBUG_APP_TRANSITIONS)       Log.v(TAG,"String_Node_Str" + wtoken);
      wtoken.setDummyAnimation();
      mOpeningApps.remove(wtoken);
      mClosingApps.remove(wtoken);
      wtoken.waitingToShow=wtoken.waitingToHide=false;
      wtoken.inPendingTransaction=true;
      if (visible) {
        mOpeningApps.add(wtoken);
        wtoken.startingDisplayed=false;
        wtoken.startingMoved=false;
        if (wtoken.hidden) {
          wtoken.allDrawn=false;
          wtoken.waitingToShow=true;
          if (wtoken.clientHidden) {
            wtoken.clientHidden=false;
            wtoken.sendAppVisibilityToClients();
          }
        }
      }
 else {
        mClosingApps.add(wtoken);
        if (!wtoken.hidden) {
          wtoken.waitingToHide=true;
        }
      }
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    setTokenVisibilityLocked(wtoken,null,visible,WindowManagerPolicy.TRANSIT_UNSET,true);
    wtoken.updateReportedVisibilityLocked();
    Binder.restoreCallingIdentity(origId);
  }
}