Program: 193128
Project: 193128
Buggy source:
private boolean commonKey(int keyCode,int count,KeyEvent event){
  if (mAdapter == null || !isAttachedToWindow()) {
    return false;
  }
  if (mDataChanged) {
    layoutChildren();
  }
  boolean handled=false;
  int action=event.getAction();
  if (KeyEvent.isConfirmKey(keyCode) && event.hasNoModifiers() && action == KeyEvent.ACTION_UP) {
    handled=resurrectSelectionIfNeeded();
    if (!handled && event.getRepeatCount() == 0 && getChildCount() > 0) {
      keyPressed();
      handled=true;
    }
  }
  if (!handled && action != KeyEvent.ACTION_UP) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_UP:
      if (event.hasNoModifiers()) {
        handled=resurrectSelectionIfNeeded();
        if (!handled) {
          while (count-- > 0) {
            if (arrowScroll(FOCUS_UP)) {
              handled=true;
            }
 else {
              break;
            }
          }
        }
      }
 else       if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
        handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_UP);
      }
    break;
case KeyEvent.KEYCODE_DPAD_DOWN:
  if (event.hasNoModifiers()) {
    handled=resurrectSelectionIfNeeded();
    if (!handled) {
      while (count-- > 0) {
        if (arrowScroll(FOCUS_DOWN)) {
          handled=true;
        }
 else {
          break;
        }
      }
    }
  }
 else   if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
    handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_DOWN);
  }
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
if (event.hasNoModifiers()) {
handled=handleHorizontalFocusWithinListItem(View.FOCUS_LEFT);
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (event.hasNoModifiers()) {
handled=handleHorizontalFocusWithinListItem(View.FOCUS_RIGHT);
}
break;
case KeyEvent.KEYCODE_PAGE_UP:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || pageScroll(FOCUS_UP);
}
 else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_UP);
}
break;
case KeyEvent.KEYCODE_PAGE_DOWN:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || pageScroll(FOCUS_DOWN);
}
 else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_DOWN);
}
break;
case KeyEvent.KEYCODE_MOVE_HOME:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_UP);
}
break;
case KeyEvent.KEYCODE_MOVE_END:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_DOWN);
}
break;
case KeyEvent.KEYCODE_TAB:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || arrowScroll(FOCUS_DOWN);
}
 else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {
handled=resurrectSelectionIfNeeded() || arrowScroll(FOCUS_UP);
}
break;
}
}
if (handled) {
return true;
}
if (sendToTextFilter(keyCode,count,event)) {
return true;
}
switch (action) {
case KeyEvent.ACTION_DOWN:
return super.onKeyDown(keyCode,event);
case KeyEvent.ACTION_UP:
return super.onKeyUp(keyCode,event);
case KeyEvent.ACTION_MULTIPLE:
return super.onKeyMultiple(keyCode,count,event);
default :
return false;
}
}

Fixed version (ground truth):
private boolean commonKey(int keyCode,int count,KeyEvent event){
  if (mAdapter == null || !isAttachedToWindow()) {
    return false;
  }
  if (mDataChanged) {
    layoutChildren();
  }
  boolean handled=false;
  int action=event.getAction();
  if (KeyEvent.isConfirmKey(keyCode) && event.hasNoModifiers() && action != KeyEvent.ACTION_UP) {
    handled=resurrectSelectionIfNeeded();
    if (!handled && event.getRepeatCount() == 0 && getChildCount() > 0) {
      keyPressed();
      handled=true;
    }
  }
  if (!handled && action != KeyEvent.ACTION_UP) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_UP:
      if (event.hasNoModifiers()) {
        handled=resurrectSelectionIfNeeded();
        if (!handled) {
          while (count-- > 0) {
            if (arrowScroll(FOCUS_UP)) {
              handled=true;
            }
 else {
              break;
            }
          }
        }
      }
 else       if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
        handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_UP);
      }
    break;
case KeyEvent.KEYCODE_DPAD_DOWN:
  if (event.hasNoModifiers()) {
    handled=resurrectSelectionIfNeeded();
    if (!handled) {
      while (count-- > 0) {
        if (arrowScroll(FOCUS_DOWN)) {
          handled=true;
        }
 else {
          break;
        }
      }
    }
  }
 else   if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
    handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_DOWN);
  }
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
if (event.hasNoModifiers()) {
handled=handleHorizontalFocusWithinListItem(View.FOCUS_LEFT);
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (event.hasNoModifiers()) {
handled=handleHorizontalFocusWithinListItem(View.FOCUS_RIGHT);
}
break;
case KeyEvent.KEYCODE_PAGE_UP:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || pageScroll(FOCUS_UP);
}
 else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_UP);
}
break;
case KeyEvent.KEYCODE_PAGE_DOWN:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || pageScroll(FOCUS_DOWN);
}
 else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_DOWN);
}
break;
case KeyEvent.KEYCODE_MOVE_HOME:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_UP);
}
break;
case KeyEvent.KEYCODE_MOVE_END:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || fullScroll(FOCUS_DOWN);
}
break;
case KeyEvent.KEYCODE_TAB:
if (event.hasNoModifiers()) {
handled=resurrectSelectionIfNeeded() || arrowScroll(FOCUS_DOWN);
}
 else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {
handled=resurrectSelectionIfNeeded() || arrowScroll(FOCUS_UP);
}
break;
}
}
if (handled) {
return true;
}
if (sendToTextFilter(keyCode,count,event)) {
return true;
}
switch (action) {
case KeyEvent.ACTION_DOWN:
return super.onKeyDown(keyCode,event);
case KeyEvent.ACTION_UP:
return super.onKeyUp(keyCode,event);
case KeyEvent.ACTION_MULTIPLE:
return super.onKeyMultiple(keyCode,count,event);
default :
return false;
}
}