Program: 191500
Project: 191500
Buggy source:
public boolean onDismiss(){
  if (mHeadsUpManager != null && mHeadsUpManager.isHeadsUp(notificationKey)) {
    HeadsUpManager.setIsClickedNotification(row,true);
    mHeadsUpManager.releaseImmediately(notificationKey);
  }
  new Thread(){
    @Override public void run(){
      try {
        if (keyguardShowing && !afterKeyguardGone) {
          ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
        }
        ActivityManagerNative.getDefault().resumeAppSwitches();
      }
 catch (      RemoteException e) {
      }
      if (intent != null) {
        if (intent.isActivity()) {
          final int userId=intent.getCreatorUserHandle().getIdentifier();
          if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId) && mKeyguardManager.isDeviceLocked(userId)) {
            if (startWorkChallengeIfNecessary(userId,intent.getIntentSender(),notificationKey)) {
              return;
            }
          }
        }
        try {
          intent.send(null,0,null,null,null,null,getActivityOptions());
        }
 catch (        PendingIntent.CanceledException e) {
          Log.w(TAG,"String_Node_Str" + e);
        }
        if (intent.isActivity()) {
          mAssistManager.hideAssist();
          overrideActivityPendingAppTransition(keyguardShowing && !afterKeyguardGone);
        }
      }
      try {
        mBarService.onNotificationClick(notificationKey);
      }
 catch (      RemoteException ex) {
      }
    }
  }
.start();
  animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,true,true);
  visibilityChanged(false);
  return true;
}

Fixed version (ground truth):
public boolean onDismiss(){
  if (mHeadsUpManager != null && mHeadsUpManager.isHeadsUp(notificationKey)) {
    HeadsUpManager.setIsClickedNotification(row,true);
    mHeadsUpManager.releaseImmediately(notificationKey);
  }
  StatusBarNotification parentToCancel=null;
  if (shouldAutoCancel(sbn) && mGroupManager.isOnlyChildInGroup(sbn)) {
    StatusBarNotification summarySbn=mGroupManager.getLogicalGroupSummary(sbn).getStatusBarNotification();
    if (shouldAutoCancel(summarySbn)) {
      parentToCancel=summarySbn;
    }
  }
  final StatusBarNotification parentToCancelFinal=parentToCancel;
  new Thread(){
    @Override public void run(){
      try {
        if (keyguardShowing && !afterKeyguardGone) {
          ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
        }
        ActivityManagerNative.getDefault().resumeAppSwitches();
      }
 catch (      RemoteException e) {
      }
      if (intent != null) {
        if (intent.isActivity()) {
          final int userId=intent.getCreatorUserHandle().getIdentifier();
          if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId) && mKeyguardManager.isDeviceLocked(userId)) {
            if (startWorkChallengeIfNecessary(userId,intent.getIntentSender(),notificationKey)) {
              return;
            }
          }
        }
        try {
          intent.send(null,0,null,null,null,null,getActivityOptions());
        }
 catch (        PendingIntent.CanceledException e) {
          Log.w(TAG,"String_Node_Str" + e);
        }
        if (intent.isActivity()) {
          mAssistManager.hideAssist();
          overrideActivityPendingAppTransition(keyguardShowing && !afterKeyguardGone);
        }
      }
      try {
        mBarService.onNotificationClick(notificationKey);
      }
 catch (      RemoteException ex) {
      }
      if (parentToCancelFinal != null) {
        mHandler.post(new Runnable(){
          @Override public void run(){
            Runnable removeRunnable=new Runnable(){
              @Override public void run(){
                performRemoveNotification(parentToCancelFinal,true);
              }
            }
;
            if (isCollapsing()) {
              addPostCollapseAction(removeRunnable);
            }
 else {
              removeRunnable.run();
            }
          }
        }
);
      }
    }
  }
.start();
  animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,true,true);
  visibilityChanged(false);
  return true;
}