Program: 198496
Project: 198496
Buggy source:
/** 
 * Updates expanded, dimmed and locked states of notification rows.
 */
protected void updateRowStates(){
  int maxKeyguardNotifications=getMaxKeyguardNotifications();
  mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
  ArrayList<Entry> activeNotifications=mNotificationData.getActiveNotifications();
  final int N=activeNotifications.size();
  int visibleNotifications=0;
  boolean onKeyguard=mState == StatusBarState.KEYGUARD;
  for (int i=0; i < N; i++) {
    NotificationData.Entry entry=activeNotifications.get(i);
    if (onKeyguard) {
      entry.row.setExpansionDisabled(true);
    }
 else {
      entry.row.setExpansionDisabled(false);
      if (!entry.row.isUserLocked()) {
        boolean top=(i == 0);
        entry.row.setSystemExpanded(top);
      }
    }
    boolean showOnKeyguard=shouldShowOnKeyguard(entry.notification);
    if (onKeyguard && (visibleNotifications >= maxKeyguardNotifications || !showOnKeyguard)) {
      entry.row.setVisibility(View.GONE);
      if (showOnKeyguard) {
        mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
      }
    }
 else {
      boolean wasGone=entry.row.getVisibility() == View.GONE;
      entry.row.setVisibility(View.VISIBLE);
      if (wasGone) {
        mStackScroller.generateAddAnimation(entry.row,true);
      }
      visibleNotifications++;
    }
  }
  if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
    mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE);
  }
 else {
    mKeyguardIconOverflowContainer.setVisibility(View.GONE);
  }
  mStackScroller.changeViewPosition(mKeyguardIconOverflowContainer,mStackScroller.getChildCount() - 3);
  mStackScroller.changeViewPosition(mDismissView,mStackScroller.getChildCount() - 2);
  mStackScroller.changeViewPosition(mEmptyShadeView,mStackScroller.getChildCount() - 1);
}

Fixed version (ground truth):
/** 
 * Updates expanded, dimmed and locked states of notification rows.
 */
protected void updateRowStates(){
  int maxKeyguardNotifications=getMaxKeyguardNotifications();
  mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
  ArrayList<Entry> activeNotifications=mNotificationData.getActiveNotifications();
  final int N=activeNotifications.size();
  int visibleNotifications=0;
  boolean onKeyguard=mState == StatusBarState.KEYGUARD;
  for (int i=0; i < N; i++) {
    NotificationData.Entry entry=activeNotifications.get(i);
    if (onKeyguard) {
      entry.row.setExpansionDisabled(true);
    }
 else {
      entry.row.setExpansionDisabled(false);
      if (!entry.row.isUserLocked()) {
        boolean top=(i == 0);
        entry.row.setSystemExpanded(top);
      }
    }
    boolean showOnKeyguard=shouldShowOnKeyguard(entry.notification);
    if (onKeyguard && (visibleNotifications >= maxKeyguardNotifications || !showOnKeyguard)) {
      entry.row.setVisibility(View.GONE);
      if (showOnKeyguard) {
        mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
      }
    }
 else {
      boolean wasGone=entry.row.getVisibility() == View.GONE;
      entry.row.setVisibility(View.VISIBLE);
      if (wasGone) {
        mStackScroller.generateAddAnimation(entry.row,true);
      }
      visibleNotifications++;
    }
  }
  if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
    mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE);
  }
 else {
    mKeyguardIconOverflowContainer.setVisibility(View.GONE);
  }
  mStackScroller.changeViewPosition(mKeyguardIconOverflowContainer,mStackScroller.getChildCount() - 3);
  mStackScroller.changeViewPosition(mEmptyShadeView,mStackScroller.getChildCount() - 2);
  mStackScroller.changeViewPosition(mDismissView,mStackScroller.getChildCount() - 1);
}