nus-yam/ex-repair huggingface dataset:
Program: 191132
Project: 191132
Buggy source:
/** 
 * @param opPackageName name of package for caller
 * @param foregroundOnly only allow this call while app is in the foreground
 * @return true if caller can use fingerprint API
 */
private boolean canUseFingerprint(String opPackageName,boolean foregroundOnly,int uid,int pid){
  checkPermission(USE_FINGERPRINT);
  if (isKeyguard(opPackageName)) {
    return true;
  }
  if (!isCurrentUserOrProfile(UserHandle.getCallingUserId())) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (mAppOps.noteOp(AppOpsManager.OP_USE_FINGERPRINT,uid,opPackageName) != AppOpsManager.MODE_ALLOWED) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (foregroundOnly && !isForegroundActivity(uid,pid)) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param opPackageName name of package for caller
 * @param requireForeground only allow this call while app is in the foreground
 * @return true if caller can use fingerprint API
 */
private boolean canUseFingerprint(String opPackageName,boolean requireForeground,int uid,int pid){
  checkPermission(USE_FINGERPRINT);
  if (isKeyguard(opPackageName)) {
    return true;
  }
  if (!isCurrentUserOrProfile(UserHandle.getCallingUserId())) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (mAppOps.noteOp(AppOpsManager.OP_USE_FINGERPRINT,uid,opPackageName) != AppOpsManager.MODE_ALLOWED) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (requireForeground && !(isForegroundActivity(uid,pid) || currentClient(opPackageName))) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  return true;
}
Program: 191133
Project: 191133
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  if (onFinishedRunnable != null) {
    onFinishedRunnable.run();
  }
  if (!mWasCancelled) {
    enableAppearDrawing(false);
  }
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  if (onFinishedRunnable != null) {
    onFinishedRunnable.run();
  }
  if (!mWasCancelled) {
    enableAppearDrawing(false);
    onAppearAnimationFinished(isAppearing);
  }
}
Program: 191135
Project: 191135
Buggy source:
@Override protected View getContentView(){
  if (mIsSummaryWithChildren) {
    return mChildrenContainer;
  }
  return getShowingLayout();
}

Fixed version (ground truth):
@Override protected View getContentView(){
  if (mIsSummaryWithChildren && !mShowingPublic) {
    return mChildrenContainer;
  }
  return getShowingLayout();
}
Program: 191136
Project: 191136
Buggy source:
private NotificationHeaderView getVisibleNotificationHeader(){
  if (mIsSummaryWithChildren) {
    return mChildrenContainer.getHeaderView();
  }
  return getShowingLayout().getVisibleNotificationHeader();
}

Fixed version (ground truth):
private NotificationHeaderView getVisibleNotificationHeader(){
  if (mIsSummaryWithChildren && !mShowingPublic) {
    return mChildrenContainer.getHeaderView();
  }
  return getShowingLayout().getVisibleNotificationHeader();
}
Program: 191137
Project: 191137
Buggy source:
/** 
 * @param opPackageName name of package for caller
 * @param foregroundOnly only allow this call while app is in the foreground
 * @return true if caller can use fingerprint API
 */
private boolean canUseFingerprint(String opPackageName,boolean foregroundOnly,int uid,int pid){
  checkPermission(USE_FINGERPRINT);
  if (isKeyguard(opPackageName)) {
    return true;
  }
  if (!isCurrentUserOrProfile(UserHandle.getCallingUserId())) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (mAppOps.noteOp(AppOpsManager.OP_USE_FINGERPRINT,uid,opPackageName) != AppOpsManager.MODE_ALLOWED) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (foregroundOnly && !isForegroundActivity(uid,pid)) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param opPackageName name of package for caller
 * @param requireForeground only allow this call while app is in the foreground
 * @return true if caller can use fingerprint API
 */
private boolean canUseFingerprint(String opPackageName,boolean requireForeground,int uid,int pid){
  checkPermission(USE_FINGERPRINT);
  if (isKeyguard(opPackageName)) {
    return true;
  }
  if (!isCurrentUserOrProfile(UserHandle.getCallingUserId())) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (mAppOps.noteOp(AppOpsManager.OP_USE_FINGERPRINT,uid,opPackageName) != AppOpsManager.MODE_ALLOWED) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  if (requireForeground && !(isForegroundActivity(uid,pid) || currentClient(opPackageName))) {
    Slog.w(TAG,"String_Node_Str" + opPackageName + "String_Node_Str");
    return false;
  }
  return true;
}
Program: 191138
Project: 191138
Buggy source:
private void cancelForegroudNotificationLocked(ServiceRecord r){
  if (r.foregroundId != 0) {
    ServiceMap sm=getServiceMap(r.userId);
    if (sm != null) {
      for (int i=sm.mServicesByName.size() - 1; i >= 0; i--) {
        ServiceRecord other=sm.mServicesByName.valueAt(i);
        if (other.foregroundId == r.foregroundId && other.packageName.equals(r.packageName)) {
          return;
        }
      }
    }
    r.cancelNotification();
  }
}

Fixed version (ground truth):
private void cancelForegroudNotificationLocked(ServiceRecord r){
  if (r.foregroundId != 0) {
    ServiceMap sm=getServiceMap(r.userId);
    if (sm != null) {
      for (int i=sm.mServicesByName.size() - 1; i >= 0; i--) {
        ServiceRecord other=sm.mServicesByName.valueAt(i);
        if (other != r && other.foregroundId == r.foregroundId && other.packageName.equals(r.packageName)) {
          return;
        }
      }
    }
    r.cancelNotification();
  }
}
Program: 191139
Project: 191139
Buggy source:
private void handleNotifyScreenTurnedOff(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mStatusBarKeyguardViewManager.onScreenTurnedOff();
    mWakeAndUnlocking=false;
  }
}

Fixed version (ground truth):
private void handleNotifyScreenTurnedOff(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mStatusBarKeyguardViewManager.onScreenTurnedOff();
    mDrawnCallback=null;
    mWakeAndUnlocking=false;
  }
}
Program: 191140
Project: 191140
Buggy source:
private void handleStartKeyguardExitAnimation(long startTime,long fadeoutDuration){
  Trace.beginSection("String_Node_Str");
synchronized (KeyguardViewMediator.this) {
    if (!mHiding) {
      return;
    }
    mHiding=false;
    if (mWakeAndUnlocking && mDrawnCallback != null) {
      mStatusBarKeyguardViewManager.getViewRootImpl().setReportNextDraw();
      notifyDrawn(mDrawnCallback);
    }
    if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) {
      playSounds(false);
    }
    setShowingLocked(false);
    mStatusBarKeyguardViewManager.hide(startTime,fadeoutDuration);
    resetKeyguardDonePendingLocked();
    mHideAnimationRun=false;
    updateActivityLockScreenState();
    adjustStatusBarLocked();
    sendUserPresentBroadcast();
  }
  Trace.endSection();
}

Fixed version (ground truth):
private void handleStartKeyguardExitAnimation(long startTime,long fadeoutDuration){
  Trace.beginSection("String_Node_Str");
synchronized (KeyguardViewMediator.this) {
    if (!mHiding) {
      return;
    }
    mHiding=false;
    if (mWakeAndUnlocking && mDrawnCallback != null) {
      mStatusBarKeyguardViewManager.getViewRootImpl().setReportNextDraw();
      notifyDrawn(mDrawnCallback);
      mDrawnCallback=null;
    }
    if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) {
      playSounds(false);
    }
    mWakeAndUnlocking=false;
    setShowingLocked(false);
    mStatusBarKeyguardViewManager.hide(startTime,fadeoutDuration);
    resetKeyguardDonePendingLocked();
    mHideAnimationRun=false;
    updateActivityLockScreenState();
    adjustStatusBarLocked();
    sendUserPresentBroadcast();
  }
  Trace.endSection();
}
Program: 191141
Project: 191141
Buggy source:
@Override public void waitForAllWindowsDrawn(Runnable callback,long timeout){
  boolean allWindowsDrawn=false;
synchronized (mWindowMap) {
    mWaitingForDrawnCallback=callback;
    final WindowList windows=getDefaultWindowListLocked();
    for (int winNdx=windows.size() - 1; winNdx >= 0; --winNdx) {
      final WindowState win=windows.get(winNdx);
      final boolean isForceHiding=mPolicy.isForceHiding(win.mAttrs);
      if (win.isVisibleLw() && (win.mAppToken != null || isForceHiding)) {
        win.mWinAnimator.mDrawState=DRAW_PENDING;
        win.mLastContentInsets.set(-1,-1,-1,-1);
        mWaitingForDrawn.add(win);
        if (isForceHiding) {
          break;
        }
      }
    }
    mWindowPlacerLocked.requestTraversal();
    mH.removeMessages(H.WAITING_FOR_DRAWN_TIMEOUT);
    if (mWaitingForDrawn.isEmpty()) {
      allWindowsDrawn=true;
    }
 else {
      mH.sendEmptyMessageDelayed(H.WAITING_FOR_DRAWN_TIMEOUT,timeout);
      checkDrawnWindowsLocked();
    }
  }
  if (allWindowsDrawn) {
    callback.run();
  }
}

Fixed version (ground truth):
@Override public void waitForAllWindowsDrawn(Runnable callback,long timeout){
  boolean allWindowsDrawn=false;
synchronized (mWindowMap) {
    mWaitingForDrawnCallback=callback;
    final WindowList windows=getDefaultWindowListLocked();
    for (int winNdx=windows.size() - 1; winNdx >= 0; --winNdx) {
      final WindowState win=windows.get(winNdx);
      final boolean isForceHiding=mPolicy.isForceHiding(win.mAttrs);
      final boolean keyguard=mPolicy.isKeyguardHostWindow(win.mAttrs);
      if (win.isVisibleLw() && (win.mAppToken != null || isForceHiding || keyguard)) {
        win.mWinAnimator.mDrawState=DRAW_PENDING;
        win.mLastContentInsets.set(-1,-1,-1,-1);
        mWaitingForDrawn.add(win);
        if (isForceHiding) {
          break;
        }
      }
    }
    mWindowPlacerLocked.requestTraversal();
    mH.removeMessages(H.WAITING_FOR_DRAWN_TIMEOUT);
    if (mWaitingForDrawn.isEmpty()) {
      allWindowsDrawn=true;
    }
 else {
      mH.sendEmptyMessageDelayed(H.WAITING_FOR_DRAWN_TIMEOUT,timeout);
      checkDrawnWindowsLocked();
    }
  }
  if (allWindowsDrawn) {
    callback.run();
  }
}
Program: 191142
Project: 191142
Buggy source:
private void cancelForegroudNotificationLocked(ServiceRecord r){
  if (r.foregroundId != 0) {
    ServiceMap sm=getServiceMap(r.userId);
    if (sm != null) {
      for (int i=sm.mServicesByName.size() - 1; i >= 0; i--) {
        ServiceRecord other=sm.mServicesByName.valueAt(i);
        if (other.foregroundId == r.foregroundId && other.packageName.equals(r.packageName)) {
          return;
        }
      }
    }
    r.cancelNotification();
  }
}

Fixed version (ground truth):
private void cancelForegroudNotificationLocked(ServiceRecord r){
  if (r.foregroundId != 0) {
    ServiceMap sm=getServiceMap(r.userId);
    if (sm != null) {
      for (int i=sm.mServicesByName.size() - 1; i >= 0; i--) {
        ServiceRecord other=sm.mServicesByName.valueAt(i);
        if (other != r && other.foregroundId == r.foregroundId && other.packageName.equals(r.packageName)) {
          return;
        }
      }
    }
    r.cancelNotification();
  }
}
Program: 191143
Project: 191143
Buggy source:
private void cancelForegroudNotificationLocked(ServiceRecord r){
  if (r.foregroundId != 0) {
    ServiceMap sm=getServiceMap(r.userId);
    if (sm != null) {
      for (int i=sm.mServicesByName.size() - 1; i >= 0; i--) {
        ServiceRecord other=sm.mServicesByName.valueAt(i);
        if (other.foregroundId == r.foregroundId && other.packageName.equals(r.packageName)) {
          return;
        }
      }
    }
    r.cancelNotification();
  }
}

Fixed version (ground truth):
private void cancelForegroudNotificationLocked(ServiceRecord r){
  if (r.foregroundId != 0) {
    ServiceMap sm=getServiceMap(r.userId);
    if (sm != null) {
      for (int i=sm.mServicesByName.size() - 1; i >= 0; i--) {
        ServiceRecord other=sm.mServicesByName.valueAt(i);
        if (other != r && other.foregroundId == r.foregroundId && other.packageName.equals(r.packageName)) {
          return;
        }
      }
    }
    r.cancelNotification();
  }
}
Program: 191144
Project: 191144
Buggy source:
private void handleNotifyScreenTurnedOff(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mStatusBarKeyguardViewManager.onScreenTurnedOff();
    mWakeAndUnlocking=false;
  }
}

Fixed version (ground truth):
private void handleNotifyScreenTurnedOff(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mStatusBarKeyguardViewManager.onScreenTurnedOff();
    mDrawnCallback=null;
    mWakeAndUnlocking=false;
  }
}
Program: 191145
Project: 191145
Buggy source:
private void handleStartKeyguardExitAnimation(long startTime,long fadeoutDuration){
  Trace.beginSection("String_Node_Str");
synchronized (KeyguardViewMediator.this) {
    if (!mHiding) {
      return;
    }
    mHiding=false;
    if (mWakeAndUnlocking && mDrawnCallback != null) {
      mStatusBarKeyguardViewManager.getViewRootImpl().setReportNextDraw();
      notifyDrawn(mDrawnCallback);
    }
    if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) {
      playSounds(false);
    }
    setShowingLocked(false);
    mStatusBarKeyguardViewManager.hide(startTime,fadeoutDuration);
    resetKeyguardDonePendingLocked();
    mHideAnimationRun=false;
    updateActivityLockScreenState();
    adjustStatusBarLocked();
    sendUserPresentBroadcast();
  }
  Trace.endSection();
}

Fixed version (ground truth):
private void handleStartKeyguardExitAnimation(long startTime,long fadeoutDuration){
  Trace.beginSection("String_Node_Str");
synchronized (KeyguardViewMediator.this) {
    if (!mHiding) {
      return;
    }
    mHiding=false;
    if (mWakeAndUnlocking && mDrawnCallback != null) {
      mStatusBarKeyguardViewManager.getViewRootImpl().setReportNextDraw();
      notifyDrawn(mDrawnCallback);
      mDrawnCallback=null;
    }
    if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) {
      playSounds(false);
    }
    mWakeAndUnlocking=false;
    setShowingLocked(false);
    mStatusBarKeyguardViewManager.hide(startTime,fadeoutDuration);
    resetKeyguardDonePendingLocked();
    mHideAnimationRun=false;
    updateActivityLockScreenState();
    adjustStatusBarLocked();
    sendUserPresentBroadcast();
  }
  Trace.endSection();
}
Program: 191146
Project: 191146
Buggy source:
@Override public void waitForAllWindowsDrawn(Runnable callback,long timeout){
  boolean allWindowsDrawn=false;
synchronized (mWindowMap) {
    mWaitingForDrawnCallback=callback;
    final WindowList windows=getDefaultWindowListLocked();
    for (int winNdx=windows.size() - 1; winNdx >= 0; --winNdx) {
      final WindowState win=windows.get(winNdx);
      final boolean isForceHiding=mPolicy.isForceHiding(win.mAttrs);
      if (win.isVisibleLw() && (win.mAppToken != null || isForceHiding)) {
        win.mWinAnimator.mDrawState=DRAW_PENDING;
        win.mLastContentInsets.set(-1,-1,-1,-1);
        mWaitingForDrawn.add(win);
        if (isForceHiding) {
          break;
        }
      }
    }
    mWindowPlacerLocked.requestTraversal();
    mH.removeMessages(H.WAITING_FOR_DRAWN_TIMEOUT);
    if (mWaitingForDrawn.isEmpty()) {
      allWindowsDrawn=true;
    }
 else {
      mH.sendEmptyMessageDelayed(H.WAITING_FOR_DRAWN_TIMEOUT,timeout);
      checkDrawnWindowsLocked();
    }
  }
  if (allWindowsDrawn) {
    callback.run();
  }
}

Fixed version (ground truth):
@Override public void waitForAllWindowsDrawn(Runnable callback,long timeout){
  boolean allWindowsDrawn=false;
synchronized (mWindowMap) {
    mWaitingForDrawnCallback=callback;
    final WindowList windows=getDefaultWindowListLocked();
    for (int winNdx=windows.size() - 1; winNdx >= 0; --winNdx) {
      final WindowState win=windows.get(winNdx);
      final boolean isForceHiding=mPolicy.isForceHiding(win.mAttrs);
      final boolean keyguard=mPolicy.isKeyguardHostWindow(win.mAttrs);
      if (win.isVisibleLw() && (win.mAppToken != null || isForceHiding || keyguard)) {
        win.mWinAnimator.mDrawState=DRAW_PENDING;
        win.mLastContentInsets.set(-1,-1,-1,-1);
        mWaitingForDrawn.add(win);
        if (isForceHiding) {
          break;
        }
      }
    }
    mWindowPlacerLocked.requestTraversal();
    mH.removeMessages(H.WAITING_FOR_DRAWN_TIMEOUT);
    if (mWaitingForDrawn.isEmpty()) {
      allWindowsDrawn=true;
    }
 else {
      mH.sendEmptyMessageDelayed(H.WAITING_FOR_DRAWN_TIMEOUT,timeout);
      checkDrawnWindowsLocked();
    }
  }
  if (allWindowsDrawn) {
    callback.run();
  }
}
Program: 191147
Project: 191147
Buggy source:
private void updateSuppression(NotificationGroup group){
  if (group == null) {
    return;
  }
  boolean prevSuppressed=group.suppressed;
  group.suppressed=group.summary != null && !group.expanded && (group.children.size() == 1 || (group.children.size() == 0 && group.summary.notification.getNotification().isGroupSummary() && hasIsolatedChildren(group)));
  if (prevSuppressed != group.suppressed) {
    if (group.suppressed) {
      handleSuppressedSummaryHeadsUpped(group.summary);
    }
    mListener.onGroupsChanged();
  }
}

Fixed version (ground truth):
private void updateSuppression(NotificationGroup group){
  if (group == null || mUpdatingSuppressionBlocked) {
    return;
  }
  boolean prevSuppressed=group.suppressed;
  group.suppressed=group.summary != null && !group.expanded && (group.children.size() == 1 || (group.children.size() == 0 && group.summary.notification.getNotification().isGroupSummary() && hasIsolatedChildren(group)));
  if (prevSuppressed != group.suppressed) {
    if (group.suppressed) {
      handleSuppressedSummaryHeadsUpped(group.summary);
    }
    mListener.onGroupsChanged();
  }
}
Program: 191148
Project: 191148
Buggy source:
public void onEntryUpdated(NotificationData.Entry entry,StatusBarNotification oldNotification){
  if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
    onEntryRemovedInternal(entry,oldNotification);
  }
  onEntryAdded(entry);
  if (isIsolated(entry.notification)) {
    mIsolatedEntries.put(entry.key,entry.notification);
    String oldKey=oldNotification.getGroupKey();
    String newKey=entry.notification.getGroupKey();
    if (!oldKey.equals(newKey)) {
      updateSuppression(mGroupMap.get(oldKey));
      updateSuppression(mGroupMap.get(newKey));
    }
  }
 else   if (!isGroupChild(oldNotification) && isGroupChild(entry.notification)) {
    onEntryBecomingChild(entry);
  }
}

Fixed version (ground truth):
public void onEntryUpdated(NotificationData.Entry entry,StatusBarNotification oldNotification){
  String oldKey=oldNotification.getGroupKey();
  String newKey=entry.notification.getGroupKey();
  boolean groupKeysChanged=!oldKey.equals(newKey);
  boolean wasGroupChild=isGroupChild(oldNotification);
  boolean isGroupChild=isGroupChild(entry.notification);
  mUpdatingSuppressionBlocked=!groupKeysChanged && wasGroupChild == isGroupChild;
  if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
    onEntryRemovedInternal(entry,oldNotification);
  }
  onEntryAdded(entry);
  mUpdatingSuppressionBlocked=false;
  if (isIsolated(entry.notification)) {
    mIsolatedEntries.put(entry.key,entry.notification);
    if (groupKeysChanged) {
      updateSuppression(mGroupMap.get(oldKey));
      updateSuppression(mGroupMap.get(newKey));
    }
  }
 else   if (!wasGroupChild && isGroupChild) {
    onEntryBecomingChild(entry);
  }
}
Program: 191149
Project: 191149
Buggy source:
private void updateSuppression(NotificationGroup group){
  if (group == null) {
    return;
  }
  boolean prevSuppressed=group.suppressed;
  group.suppressed=group.summary != null && !group.expanded && (group.children.size() == 1 || (group.children.size() == 0 && group.summary.notification.getNotification().isGroupSummary() && hasIsolatedChildren(group)));
  if (prevSuppressed != group.suppressed) {
    if (group.suppressed) {
      handleSuppressedSummaryHeadsUpped(group.summary);
    }
    mListener.onGroupsChanged();
  }
}

Fixed version (ground truth):
private void updateSuppression(NotificationGroup group){
  if (group == null || mUpdatingSuppressionBlocked) {
    return;
  }
  boolean prevSuppressed=group.suppressed;
  group.suppressed=group.summary != null && !group.expanded && (group.children.size() == 1 || (group.children.size() == 0 && group.summary.notification.getNotification().isGroupSummary() && hasIsolatedChildren(group)));
  if (prevSuppressed != group.suppressed) {
    if (group.suppressed) {
      handleSuppressedSummaryHeadsUpped(group.summary);
    }
    mListener.onGroupsChanged();
  }
}
Program: 191150
Project: 191150
Buggy source:
public void onEntryUpdated(NotificationData.Entry entry,StatusBarNotification oldNotification){
  if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
    onEntryRemovedInternal(entry,oldNotification);
  }
  onEntryAdded(entry);
  if (isIsolated(entry.notification)) {
    mIsolatedEntries.put(entry.key,entry.notification);
    String oldKey=oldNotification.getGroupKey();
    String newKey=entry.notification.getGroupKey();
    if (!oldKey.equals(newKey)) {
      updateSuppression(mGroupMap.get(oldKey));
      updateSuppression(mGroupMap.get(newKey));
    }
  }
 else   if (!isGroupChild(oldNotification) && isGroupChild(entry.notification)) {
    onEntryBecomingChild(entry);
  }
}

Fixed version (ground truth):
public void onEntryUpdated(NotificationData.Entry entry,StatusBarNotification oldNotification){
  String oldKey=oldNotification.getGroupKey();
  String newKey=entry.notification.getGroupKey();
  boolean groupKeysChanged=!oldKey.equals(newKey);
  boolean wasGroupChild=isGroupChild(oldNotification);
  boolean isGroupChild=isGroupChild(entry.notification);
  mUpdatingSuppressionBlocked=!groupKeysChanged && wasGroupChild == isGroupChild;
  if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
    onEntryRemovedInternal(entry,oldNotification);
  }
  onEntryAdded(entry);
  mUpdatingSuppressionBlocked=false;
  if (isIsolated(entry.notification)) {
    mIsolatedEntries.put(entry.key,entry.notification);
    if (groupKeysChanged) {
      updateSuppression(mGroupMap.get(oldKey));
      updateSuppression(mGroupMap.get(newKey));
    }
  }
 else   if (!wasGroupChild && isGroupChild) {
    onEntryBecomingChild(entry);
  }
}
Program: 191156
Project: 191156
Buggy source:
public void cancelNotification(){
  if (foregroundId != 0) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    ams.mHandler.post(new Runnable(){
      public void run(){
        INotificationManager inm=NotificationManager.getService();
        if (inm == null) {
          return;
        }
        try {
          inm.cancelNotificationWithTag(localPackageName,null,localForegroundId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
catch (        RemoteException e) {
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void cancelNotification(){
  final String localPackageName=packageName;
  final int localForegroundId=foregroundId;
  ams.mHandler.post(new Runnable(){
    public void run(){
      INotificationManager inm=NotificationManager.getService();
      if (inm == null) {
        return;
      }
      try {
        inm.cancelNotificationWithTag(localPackageName,null,localForegroundId,userId);
      }
 catch (      RuntimeException e) {
        Slog.w(TAG,"String_Node_Str",e);
      }
catch (      RemoteException e) {
      }
    }
  }
);
}
Program: 191160
Project: 191160
Buggy source:
public void cancelNotification(){
  if (foregroundId != 0) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    ams.mHandler.post(new Runnable(){
      public void run(){
        INotificationManager inm=NotificationManager.getService();
        if (inm == null) {
          return;
        }
        try {
          inm.cancelNotificationWithTag(localPackageName,null,localForegroundId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
catch (        RemoteException e) {
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void cancelNotification(){
  final String localPackageName=packageName;
  final int localForegroundId=foregroundId;
  ams.mHandler.post(new Runnable(){
    public void run(){
      INotificationManager inm=NotificationManager.getService();
      if (inm == null) {
        return;
      }
      try {
        inm.cancelNotificationWithTag(localPackageName,null,localForegroundId,userId);
      }
 catch (      RuntimeException e) {
        Slog.w(TAG,"String_Node_Str",e);
      }
catch (      RemoteException e) {
      }
    }
  }
);
}
Program: 191161
Project: 191161
Buggy source:
public void setTouchDisabled(boolean disabled){
  mTouchDisabled=disabled;
}

Fixed version (ground truth):
public void setTouchDisabled(boolean disabled){
  mTouchDisabled=disabled;
  if (mTouchDisabled && mTracking) {
    onTrackingStopped(true);
  }
}
Program: 191162
Project: 191162
Buggy source:
protected void updateBackgroundAlpha(float transformationAmount){
  mBgAlpha=isChildInGroup() && mDimmed ? transformationAmount : 1f;
  mBackgroundDimmed.setAlpha(mBgAlpha);
}

Fixed version (ground truth):
protected void updateBackgroundAlpha(float transformationAmount){
  mBgAlpha=isChildInGroup() && mDimmed ? transformationAmount : 1f;
  if (mDimmedBackgroundFadeInAmount != -1) {
    mBgAlpha*=mDimmedBackgroundFadeInAmount;
  }
  mBackgroundDimmed.setAlpha(mBgAlpha);
}
Program: 191163
Project: 191163
Buggy source:
public void setUserLocked(boolean userLocked){
  mUserLocked=userLocked;
  mPrivateLayout.setUserExpanding(userLocked);
  if (mIsSummaryWithChildren) {
    mChildrenContainer.setUserLocked(userLocked);
    if (userLocked || (!userLocked && !isGroupExpanded())) {
      updateBackgroundForGroupState();
    }
  }
}

Fixed version (ground truth):
public void setUserLocked(boolean userLocked){
  mUserLocked=userLocked;
  mPrivateLayout.setUserExpanding(userLocked);
  if (mIsSummaryWithChildren) {
    mChildrenContainer.setUserLocked(userLocked);
    if (userLocked || !isGroupExpanded()) {
      updateBackgroundForGroupState();
    }
  }
}
Program: 191166
Project: 191166
Buggy source:
public void onNotificationUpdated(NotificationData.Entry entry){
  mEntry=entry;
  mStatusBarNotification=entry.notification;
  mPrivateLayout.onNotificationUpdated(entry);
  mPublicLayout.onNotificationUpdated(entry);
  mShowingPublicInitialized=false;
  updateNotificationColor();
  updateClearability();
  if (mIsSummaryWithChildren) {
    mChildrenContainer.recreateNotificationHeader(mExpandClickListener,mEntry.notification);
    mChildrenContainer.onNotificationUpdated();
  }
  if (mIconAnimationRunning) {
    setIconAnimationRunning(true);
  }
  if (mNotificationParent != null) {
    mNotificationParent.updateChildrenHeaderAppearance();
  }
  onChildrenCountChanged();
  mPublicLayout.updateExpandButtons(true);
  updateLimits();
}

Fixed version (ground truth):
public void onNotificationUpdated(NotificationData.Entry entry){
  mEntry=entry;
  mStatusBarNotification=entry.notification;
  mPrivateLayout.onNotificationUpdated(entry);
  mPublicLayout.onNotificationUpdated(entry);
  mShowingPublicInitialized=false;
  updateNotificationColor();
  if (mIsSummaryWithChildren) {
    mChildrenContainer.recreateNotificationHeader(mExpandClickListener,mEntry.notification);
    mChildrenContainer.onNotificationUpdated();
  }
  if (mIconAnimationRunning) {
    setIconAnimationRunning(true);
  }
  if (mNotificationParent != null) {
    mNotificationParent.updateChildrenHeaderAppearance();
  }
  onChildrenCountChanged();
  mPublicLayout.updateExpandButtons(true);
  updateLimits();
}
Program: 191167
Project: 191167
Buggy source:
private boolean canViewBeDismissed(){
  return isClearable() && (!mShowingPublic || !mSensitiveHiddenInGeneral);
}

Fixed version (ground truth):
/** 
 * @return Whether this view is allowed to be dismissed. Only valid for visible notifications asotherwise some state might not be updated. To request about the general clearability see  {@link #isClearable()}.
 */
public boolean canViewBeDismissed(){
  return isClearable() && (!mShowingPublic || !mSensitiveHiddenInGeneral);
}
Program: 191168
Project: 191168
Buggy source:
/** 
 * @return Can the underlying notification be cleared?
 */
public boolean isClearable(){
  return mStatusBarNotification != null && mStatusBarNotification.isClearable();
}

Fixed version (ground truth):
/** 
 * @return Can the underlying notification be cleared? This can be different from whether thenotification can be dismissed in case notifications are sensitive on the lockscreen.
 * @see #canViewBeDismissed()
 */
public boolean isClearable(){
  return mStatusBarNotification != null && mStatusBarNotification.isClearable();
}
Program: 191170
Project: 191170
Buggy source:
public void setHideSensitive(boolean hideSensitive,boolean animated,long delay,long duration){
  boolean oldShowingPublic=mShowingPublic;
  mShowingPublic=mSensitive && hideSensitive;
  if (mShowingPublicInitialized && mShowingPublic == oldShowingPublic) {
    return;
  }
  if (mPublicLayout.getChildCount() == 0)   return;
  if (!animated) {
    mPublicLayout.animate().cancel();
    mPrivateLayout.animate().cancel();
    if (mChildrenContainer != null) {
      mChildrenContainer.animate().cancel();
      mChildrenContainer.setAlpha(1f);
    }
    mPublicLayout.setAlpha(1f);
    mPrivateLayout.setAlpha(1f);
    mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE);
    updateChildrenVisibility();
  }
 else {
    animateShowingPublic(delay,duration);
  }
  NotificationContentView showingLayout=getShowingLayout();
  showingLayout.updateBackgroundColor(animated);
  mPrivateLayout.updateExpandButtons(isExpandable());
  updateClearability();
  mShowingPublicInitialized=true;
}

Fixed version (ground truth):
public void setHideSensitive(boolean hideSensitive,boolean animated,long delay,long duration){
  boolean oldShowingPublic=mShowingPublic;
  mShowingPublic=mSensitive && hideSensitive;
  if (mShowingPublicInitialized && mShowingPublic == oldShowingPublic) {
    return;
  }
  if (mPublicLayout.getChildCount() == 0)   return;
  if (!animated) {
    mPublicLayout.animate().cancel();
    mPrivateLayout.animate().cancel();
    if (mChildrenContainer != null) {
      mChildrenContainer.animate().cancel();
      mChildrenContainer.setAlpha(1f);
    }
    mPublicLayout.setAlpha(1f);
    mPrivateLayout.setAlpha(1f);
    mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE);
    updateChildrenVisibility();
  }
 else {
    animateShowingPublic(delay,duration);
  }
  NotificationContentView showingLayout=getShowingLayout();
  showingLayout.updateBackgroundColor(animated);
  mPrivateLayout.updateExpandButtons(isExpandable());
  mShowingPublicInitialized=true;
}
Program: 191171
Project: 191171
Buggy source:
public static void performDismiss(View v,NotificationGroupManager groupManager,boolean fromAccessibility){
  if (v instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)v;
    if (groupManager.isOnlyChildInGroup(row.getStatusBarNotification())) {
      ExpandableNotificationRow groupSummary=groupManager.getLogicalGroupSummary(row.getStatusBarNotification());
      if (groupSummary.isClearable()) {
        performDismiss(groupSummary,groupManager,fromAccessibility);
      }
    }
    row.setDismissed(true,fromAccessibility);
  }
  final View veto=v.findViewById(R.id.veto);
  if (veto != null && veto.getVisibility() != View.GONE) {
    veto.performClick();
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + v);
}

Fixed version (ground truth):
public static void performDismiss(View v,NotificationGroupManager groupManager,boolean fromAccessibility){
  if (!(v instanceof ExpandableNotificationRow)) {
    return;
  }
  ExpandableNotificationRow row=(ExpandableNotificationRow)v;
  if (groupManager.isOnlyChildInGroup(row.getStatusBarNotification())) {
    ExpandableNotificationRow groupSummary=groupManager.getLogicalGroupSummary(row.getStatusBarNotification());
    if (groupSummary.isClearable()) {
      performDismiss(groupSummary,groupManager,fromAccessibility);
    }
  }
  row.setDismissed(true,fromAccessibility);
  if (row.isClearable()) {
    row.performDismiss();
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + v);
}
Program: 191172
Project: 191172
Buggy source:
public static boolean canChildBeDismissed(View v){
  if (v instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)v;
    if (row.areGutsExposed()) {
      return false;
    }
  }
  final View veto=v.findViewById(R.id.veto);
  return (veto != null && veto.getVisibility() != View.GONE);
}

Fixed version (ground truth):
public static boolean canChildBeDismissed(View v){
  if (!(v instanceof ExpandableNotificationRow)) {
    return false;
  }
  ExpandableNotificationRow row=(ExpandableNotificationRow)v;
  if (row.areGutsExposed()) {
    return false;
  }
  return row.canViewBeDismissed();
}
Program: 191173
Project: 191173
Buggy source:
/** 
 * @return Can the underlying notification be cleared? This can be different from whether thenotification can be dismissed in case notifications are sensitive on the lockscreen.
 * @see #canViewBeDismissed()
 */
public boolean isClearable(){
  return mStatusBarNotification != null && mStatusBarNotification.isClearable();
}

Fixed version (ground truth):
/** 
 * @return Can the underlying notification be cleared? This can be different from whether thenotification can be dismissed in case notifications are sensitive on the lockscreen.
 * @see #canViewBeDismissed()
 */
public boolean isClearable(){
  if (mStatusBarNotification == null || !mStatusBarNotification.isClearable()) {
    return false;
  }
  if (mIsSummaryWithChildren) {
    List<ExpandableNotificationRow> notificationChildren=mChildrenContainer.getNotificationChildren();
    for (int i=0; i < notificationChildren.size(); i++) {
      ExpandableNotificationRow child=notificationChildren.get(i);
      if (!child.isClearable()) {
        return false;
      }
    }
  }
  return true;
}
Program: 191174
Project: 191174
Buggy source:
@NonNull public static AndroidKeyStorePublicKey loadAndroidKeyStorePublicKeyFromKeystore(@NonNull KeyStore keyStore,@NonNull String privateKeyAlias,int uid) throws UnrecoverableKeyException {
  KeyCharacteristics keyCharacteristics=new KeyCharacteristics();
  int errorCode=keyStore.getKeyCharacteristics(privateKeyAlias,null,null,uid,keyCharacteristics);
  if (errorCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(errorCode));
  }
  ExportResult exportResult=keyStore.exportKey(privateKeyAlias,KeymasterDefs.KM_KEY_FORMAT_X509,null,null,uid);
  if (exportResult.resultCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(errorCode));
  }
  final byte[] x509EncodedPublicKey=exportResult.exportData;
  Integer keymasterAlgorithm=keyCharacteristics.getEnum(KeymasterDefs.KM_TAG_ALGORITHM);
  if (keymasterAlgorithm == null) {
    throw new UnrecoverableKeyException("String_Node_Str");
  }
  String jcaKeyAlgorithm;
  try {
    jcaKeyAlgorithm=KeyProperties.KeyAlgorithm.fromKeymasterAsymmetricKeyAlgorithm(keymasterAlgorithm);
  }
 catch (  IllegalArgumentException e) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(e);
  }
  return AndroidKeyStoreProvider.getAndroidKeyStorePublicKey(privateKeyAlias,uid,jcaKeyAlgorithm,x509EncodedPublicKey);
}

Fixed version (ground truth):
@NonNull public static AndroidKeyStorePublicKey loadAndroidKeyStorePublicKeyFromKeystore(@NonNull KeyStore keyStore,@NonNull String privateKeyAlias,int uid) throws UnrecoverableKeyException {
  KeyCharacteristics keyCharacteristics=new KeyCharacteristics();
  int errorCode=keyStore.getKeyCharacteristics(privateKeyAlias,null,null,uid,keyCharacteristics);
  if (errorCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(errorCode));
  }
  ExportResult exportResult=keyStore.exportKey(privateKeyAlias,KeymasterDefs.KM_KEY_FORMAT_X509,null,null,uid);
  if (exportResult.resultCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(exportResult.resultCode));
  }
  final byte[] x509EncodedPublicKey=exportResult.exportData;
  Integer keymasterAlgorithm=keyCharacteristics.getEnum(KeymasterDefs.KM_TAG_ALGORITHM);
  if (keymasterAlgorithm == null) {
    throw new UnrecoverableKeyException("String_Node_Str");
  }
  String jcaKeyAlgorithm;
  try {
    jcaKeyAlgorithm=KeyProperties.KeyAlgorithm.fromKeymasterAsymmetricKeyAlgorithm(keymasterAlgorithm);
  }
 catch (  IllegalArgumentException e) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(e);
  }
  return AndroidKeyStoreProvider.getAndroidKeyStorePublicKey(privateKeyAlias,uid,jcaKeyAlgorithm,x509EncodedPublicKey);
}
Program: 191175
Project: 191175
Buggy source:
/** 
 * Utility function for addErrorToDropBox and handleStrictModeViolation's logging to append various headers to the dropbox log text.
 */
private void appendDropBoxProcessHeaders(ProcessRecord process,String processName,StringBuilder sb){
  if (process == null) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    return;
  }
synchronized (this) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    int flags=process.info.flags;
    IPackageManager pm=AppGlobals.getPackageManager();
    sb.append("String_Node_Str").append(Integer.toString(flags,16)).append("String_Node_Str");
    for (int ip=0; ip < process.pkgList.size(); ip++) {
      String pkg=process.pkgList.keyAt(ip);
      sb.append("String_Node_Str").append(pkg);
      try {
        PackageInfo pi=pm.getPackageInfo(pkg,0,UserHandle.getCallingUserId());
        if (pi != null) {
          sb.append("String_Node_Str").append(pi.versionCode);
          if (pi.versionName != null) {
            sb.append("String_Node_Str").append(pi.versionName).append("String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Slog.e(TAG,"String_Node_Str" + pkg,e);
      }
      sb.append("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Utility function for addErrorToDropBox and handleStrictModeViolation's logging to append various headers to the dropbox log text.
 */
private void appendDropBoxProcessHeaders(ProcessRecord process,String processName,StringBuilder sb){
  if (process == null) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    return;
  }
synchronized (this) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    int flags=process.info.flags;
    IPackageManager pm=AppGlobals.getPackageManager();
    sb.append("String_Node_Str").append(Integer.toHexString(flags)).append("String_Node_Str");
    for (int ip=0; ip < process.pkgList.size(); ip++) {
      String pkg=process.pkgList.keyAt(ip);
      sb.append("String_Node_Str").append(pkg);
      try {
        PackageInfo pi=pm.getPackageInfo(pkg,0,UserHandle.getCallingUserId());
        if (pi != null) {
          sb.append("String_Node_Str").append(pi.versionCode);
          if (pi.versionName != null) {
            sb.append("String_Node_Str").append(pi.versionName).append("String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Slog.e(TAG,"String_Node_Str" + pkg,e);
      }
      sb.append("String_Node_Str");
    }
  }
}
Program: 191176
Project: 191176
Buggy source:
/** 
 * Utility function for addErrorToDropBox and handleStrictModeViolation's logging to append various headers to the dropbox log text.
 */
private void appendDropBoxProcessHeaders(ProcessRecord process,String processName,StringBuilder sb){
  if (process == null) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    return;
  }
synchronized (this) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    int flags=process.info.flags;
    IPackageManager pm=AppGlobals.getPackageManager();
    sb.append("String_Node_Str").append(Integer.toString(flags,16)).append("String_Node_Str");
    for (int ip=0; ip < process.pkgList.size(); ip++) {
      String pkg=process.pkgList.keyAt(ip);
      sb.append("String_Node_Str").append(pkg);
      try {
        PackageInfo pi=pm.getPackageInfo(pkg,0,UserHandle.getCallingUserId());
        if (pi != null) {
          sb.append("String_Node_Str").append(pi.versionCode);
          if (pi.versionName != null) {
            sb.append("String_Node_Str").append(pi.versionName).append("String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Slog.e(TAG,"String_Node_Str" + pkg,e);
      }
      sb.append("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Utility function for addErrorToDropBox and handleStrictModeViolation's logging to append various headers to the dropbox log text.
 */
private void appendDropBoxProcessHeaders(ProcessRecord process,String processName,StringBuilder sb){
  if (process == null) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    return;
  }
synchronized (this) {
    sb.append("String_Node_Str").append(processName).append("String_Node_Str");
    int flags=process.info.flags;
    IPackageManager pm=AppGlobals.getPackageManager();
    sb.append("String_Node_Str").append(Integer.toHexString(flags)).append("String_Node_Str");
    for (int ip=0; ip < process.pkgList.size(); ip++) {
      String pkg=process.pkgList.keyAt(ip);
      sb.append("String_Node_Str").append(pkg);
      try {
        PackageInfo pi=pm.getPackageInfo(pkg,0,UserHandle.getCallingUserId());
        if (pi != null) {
          sb.append("String_Node_Str").append(pi.versionCode);
          if (pi.versionName != null) {
            sb.append("String_Node_Str").append(pi.versionName).append("String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Slog.e(TAG,"String_Node_Str" + pkg,e);
      }
      sb.append("String_Node_Str");
    }
  }
}
Program: 191177
Project: 191177
Buggy source:
@NonNull public static AndroidKeyStorePublicKey loadAndroidKeyStorePublicKeyFromKeystore(@NonNull KeyStore keyStore,@NonNull String privateKeyAlias,int uid) throws UnrecoverableKeyException {
  KeyCharacteristics keyCharacteristics=new KeyCharacteristics();
  int errorCode=keyStore.getKeyCharacteristics(privateKeyAlias,null,null,uid,keyCharacteristics);
  if (errorCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(errorCode));
  }
  ExportResult exportResult=keyStore.exportKey(privateKeyAlias,KeymasterDefs.KM_KEY_FORMAT_X509,null,null,uid);
  if (exportResult.resultCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(errorCode));
  }
  final byte[] x509EncodedPublicKey=exportResult.exportData;
  Integer keymasterAlgorithm=keyCharacteristics.getEnum(KeymasterDefs.KM_TAG_ALGORITHM);
  if (keymasterAlgorithm == null) {
    throw new UnrecoverableKeyException("String_Node_Str");
  }
  String jcaKeyAlgorithm;
  try {
    jcaKeyAlgorithm=KeyProperties.KeyAlgorithm.fromKeymasterAsymmetricKeyAlgorithm(keymasterAlgorithm);
  }
 catch (  IllegalArgumentException e) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(e);
  }
  return AndroidKeyStoreProvider.getAndroidKeyStorePublicKey(privateKeyAlias,uid,jcaKeyAlgorithm,x509EncodedPublicKey);
}

Fixed version (ground truth):
@NonNull public static AndroidKeyStorePublicKey loadAndroidKeyStorePublicKeyFromKeystore(@NonNull KeyStore keyStore,@NonNull String privateKeyAlias,int uid) throws UnrecoverableKeyException {
  KeyCharacteristics keyCharacteristics=new KeyCharacteristics();
  int errorCode=keyStore.getKeyCharacteristics(privateKeyAlias,null,null,uid,keyCharacteristics);
  if (errorCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(errorCode));
  }
  ExportResult exportResult=keyStore.exportKey(privateKeyAlias,KeymasterDefs.KM_KEY_FORMAT_X509,null,null,uid);
  if (exportResult.resultCode != KeyStore.NO_ERROR) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(KeyStore.getKeyStoreException(exportResult.resultCode));
  }
  final byte[] x509EncodedPublicKey=exportResult.exportData;
  Integer keymasterAlgorithm=keyCharacteristics.getEnum(KeymasterDefs.KM_TAG_ALGORITHM);
  if (keymasterAlgorithm == null) {
    throw new UnrecoverableKeyException("String_Node_Str");
  }
  String jcaKeyAlgorithm;
  try {
    jcaKeyAlgorithm=KeyProperties.KeyAlgorithm.fromKeymasterAsymmetricKeyAlgorithm(keymasterAlgorithm);
  }
 catch (  IllegalArgumentException e) {
    throw (UnrecoverableKeyException)new UnrecoverableKeyException("String_Node_Str").initCause(e);
  }
  return AndroidKeyStoreProvider.getAndroidKeyStorePublicKey(privateKeyAlias,uid,jcaKeyAlgorithm,x509EncodedPublicKey);
}
Program: 191178
Project: 191178
Buggy source:
/** 
 * Called for system navigation gestures. First action opens the panel, second opens settings. Down action closes the entire panel.
 */
@Override public void handleSystemNavigationKey(int key){
  if (SPEW)   Log.d(TAG,"String_Node_Str" + key);
  if (!panelsEnabled()) {
    return;
  }
  if (!mUserSetup)   return;
  if (KeyEvent.KEYCODE_SYSTEM_NAVIGATION_UP == key) {
    mNotificationPanel.collapse(false,1.0f);
  }
 else   if (KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN == key) {
    if (mNotificationPanel.isFullyCollapsed()) {
      mNotificationPanel.expand(true);
    }
 else     if (!mNotificationPanel.isInSettings() && !mNotificationPanel.isExpanding()) {
      mNotificationPanel.flingSettings(0,true);
    }
  }
}

Fixed version (ground truth):
/** 
 * Called for system navigation gestures. First action opens the panel, second opens settings. Down action closes the entire panel.
 */
@Override public void handleSystemNavigationKey(int key){
  if (SPEW)   Log.d(TAG,"String_Node_Str" + key);
  if (!panelsEnabled() || !mKeyguardMonitor.isDeviceInteractive()) {
    return;
  }
  if (!mUserSetup)   return;
  if (KeyEvent.KEYCODE_SYSTEM_NAVIGATION_UP == key) {
    mNotificationPanel.collapse(false,1.0f);
  }
 else   if (KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN == key) {
    if (mNotificationPanel.isFullyCollapsed()) {
      mNotificationPanel.expand(true);
    }
 else     if (!mNotificationPanel.isInSettings() && !mNotificationPanel.isExpanding()) {
      mNotificationPanel.flingSettings(0,true);
    }
  }
}