nus-yam/ex-repair huggingface dataset:
Program: 22896
Project: 22896
Buggy source:
/** 
 * Searches for an entry in the CalendarAlerts table that matches the given event id, begin time and alarm time.  If one is found then this alarm already exists and this method returns true.
 * @param cr the ContentResolver
 * @param eventId the event id to match
 * @param begin the start time of the event in UTC millis
 * @param alarmTime the alarm time of the event in UTC millis
 * @return true if there is already an alarm for the given eventwith the same start time and alarm time.
 */
public static final boolean alarmExists(ContentResolver cr,long eventId,long begin,long alarmTime){
  String selection=CalendarAlerts.EVENT_ID + "String_Node_Str" + eventId+ "String_Node_Str"+ CalendarAlerts.BEGIN+ "String_Node_Str"+ begin+ "String_Node_Str"+ CalendarAlerts.ALARM_TIME+ "String_Node_Str"+ alarmTime;
  String[] projection=new String[]{CalendarAlerts.ALARM_TIME};
  Cursor cursor=query(cr,projection,selection,null,null);
  boolean found=false;
  try {
    if (cursor != null && cursor.getCount() > 0) {
      found=true;
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return found;
}

Fixed version (ground truth):
/** 
 * Searches for an entry in the CalendarAlerts table that matches the given event id, begin time and alarm time.  If one is found then this alarm already exists and this method returns true.
 * @param cr the ContentResolver
 * @param eventId the event id to match
 * @param begin the start time of the event in UTC millis
 * @param alarmTime the alarm time of the event in UTC millis
 * @return true if there is already an alarm for the given eventwith the same start time and alarm time.
 */
public static final boolean alarmExists(ContentResolver cr,long eventId,long begin,long alarmTime){
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,WHERE_ALARM_EXISTS,new String[]{Long.toString(eventId),Long.toString(begin),Long.toString(alarmTime)},null);
  boolean found=false;
  try {
    if (cursor != null && cursor.getCount() > 0) {
      found=true;
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return found;
}
Program: 22898
Project: 22898
Buggy source:
/** 
 * Finds the next alarm after (or equal to) the given time and returns the time of that alarm or -1 if no such alarm exists.
 * @param cr the ContentResolver
 * @param millis the time in UTC milliseconds
 * @return the next alarm time greater than or equal to "millis", or -1if no such alarm exists.
 */
public static final long findNextAlarmTime(ContentResolver cr,long millis){
  String selection=ALARM_TIME + "String_Node_Str" + millis;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,selection,null,ALARM_TIME + "String_Node_Str");
  long alarmTime=-1;
  try {
    if (cursor != null && cursor.moveToFirst()) {
      alarmTime=cursor.getLong(0);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return alarmTime;
}

Fixed version (ground truth):
/** 
 * Finds the next alarm after (or equal to) the given time and returns the time of that alarm or -1 if no such alarm exists.
 * @param cr the ContentResolver
 * @param millis the time in UTC milliseconds
 * @return the next alarm time greater than or equal to "millis", or -1if no such alarm exists.
 */
public static final long findNextAlarmTime(ContentResolver cr,long millis){
  String selection=ALARM_TIME + "String_Node_Str" + millis;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,WHERE_FINDNEXTALARMTIME,new String[]{Long.toString(millis)},SORT_ORDER_ALARMTIME_ASC);
  long alarmTime=-1;
  try {
    if (cursor != null && cursor.moveToFirst()) {
      alarmTime=cursor.getLong(0);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return alarmTime;
}
Program: 22899
Project: 22899
Buggy source:
public static void scheduleAlarm(Context context,AlarmManager manager,long alarmTime){
  if (DEBUG) {
    Time time=new Time();
    time.set(alarmTime);
    String schedTime=time.format("String_Node_Str");
    Log.d(TAG,"String_Node_Str" + alarmTime + "String_Node_Str"+ schedTime);
  }
  if (manager == null) {
    manager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  }
  Intent intent=new Intent(android.provider.Calendar.EVENT_REMINDER_ACTION);
  intent.putExtra(android.provider.Calendar.CalendarAlerts.ALARM_TIME,alarmTime);
  PendingIntent pi=PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  manager.set(AlarmManager.RTC_WAKEUP,alarmTime,pi);
}

Fixed version (ground truth):
public static void scheduleAlarm(Context context,AlarmManager manager,long alarmTime){
  if (DEBUG) {
    Time time=new Time();
    time.set(alarmTime);
    String schedTime=time.format("String_Node_Str");
    Log.d(TAG,"String_Node_Str" + alarmTime + "String_Node_Str"+ schedTime);
  }
  if (manager == null) {
    manager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  }
  Intent intent=new Intent(EVENT_REMINDER_ACTION);
  intent.putExtra(ALARM_TIME,alarmTime);
  PendingIntent pi=PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  manager.set(AlarmManager.RTC_WAKEUP,alarmTime,pi);
}
Program: 22900
Project: 22900
Buggy source:
/** 
 * Convenience method to delete all calendars that match the account.
 * @param cr the ContentResolver
 * @param account the account whose rows should be deleted
 * @return the count of rows that were deleted
 */
public static int deleteCalendarsForAccount(ContentResolver cr,Account account){
  return Calendar.Calendars.delete(cr,Calendar.Calendars._SYNC_ACCOUNT + "String_Node_Str" + Calendar.Calendars._SYNC_ACCOUNT_TYPE+ "String_Node_Str",new String[]{account.name,account.type});
}

Fixed version (ground truth):
/** 
 * Convenience method to delete all calendars that match the account.
 * @param cr the ContentResolver
 * @param account the account whose rows should be deleted
 * @return the count of rows that were deleted
 */
public static int deleteCalendarsForAccount(ContentResolver cr,Account account){
  return Calendar.Calendars.delete(cr,WHERE_DELETE_FOR_ACCOUNT,new String[]{account.name,account.type});
}
Program: 22901
Project: 22901
Buggy source:
/** 
 * Searches the CalendarAlerts table for alarms that should have fired but have not and then reschedules them.  This method can be called at boot time to restore alarms that may have been lost due to a phone reboot.
 * @param cr the ContentResolver
 * @param context the Context
 * @param manager the AlarmManager
 */
public static final void rescheduleMissedAlarms(ContentResolver cr,Context context,AlarmManager manager){
  long now=System.currentTimeMillis();
  long ancient=now - DateUtils.DAY_IN_MILLIS;
  String selection=CalendarAlerts.STATE + "String_Node_Str" + CalendarAlerts.SCHEDULED+ "String_Node_Str"+ CalendarAlerts.ALARM_TIME+ "String_Node_Str"+ now+ "String_Node_Str"+ CalendarAlerts.ALARM_TIME+ "String_Node_Str"+ ancient+ "String_Node_Str"+ CalendarAlerts.END+ "String_Node_Str"+ now;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=CalendarAlerts.query(cr,projection,selection,null,"String_Node_Str");
  if (cursor == null) {
    return;
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + cursor.getCount());
  }
  try {
    long alarmTime=-1;
    while (cursor.moveToNext()) {
      long newAlarmTime=cursor.getLong(0);
      if (alarmTime != newAlarmTime) {
        if (DEBUG) {
          Log.w(TAG,"String_Node_Str" + newAlarmTime);
        }
        scheduleAlarm(context,manager,newAlarmTime);
        alarmTime=newAlarmTime;
      }
    }
  }
  finally {
    cursor.close();
  }
}

Fixed version (ground truth):
/** 
 * Searches the CalendarAlerts table for alarms that should have fired but have not and then reschedules them.  This method can be called at boot time to restore alarms that may have been lost due to a phone reboot.
 * @param cr the ContentResolver
 * @param context the Context
 * @param manager the AlarmManager
 */
public static final void rescheduleMissedAlarms(ContentResolver cr,Context context,AlarmManager manager){
  long now=System.currentTimeMillis();
  long ancient=now - DateUtils.DAY_IN_MILLIS;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=CalendarAlerts.query(cr,projection,WHERE_RESCHEDULE_MISSED_ALARMS,new String[]{Long.toString(now),Long.toString(ancient),Long.toString(now)},SORT_ORDER_ALARMTIME_ASC);
  if (cursor == null) {
    return;
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + cursor.getCount());
  }
  try {
    long alarmTime=-1;
    while (cursor.moveToNext()) {
      long newAlarmTime=cursor.getLong(0);
      if (alarmTime != newAlarmTime) {
        if (DEBUG) {
          Log.w(TAG,"String_Node_Str" + newAlarmTime);
        }
        scheduleAlarm(context,manager,newAlarmTime);
        alarmTime=newAlarmTime;
      }
    }
  }
  finally {
    cursor.close();
  }
}
Program: 22902
Project: 22902
Buggy source:
/** 
 * Searches for an entry in the CalendarAlerts table that matches the given event id, begin time and alarm time.  If one is found then this alarm already exists and this method returns true.
 * @param cr the ContentResolver
 * @param eventId the event id to match
 * @param begin the start time of the event in UTC millis
 * @param alarmTime the alarm time of the event in UTC millis
 * @return true if there is already an alarm for the given eventwith the same start time and alarm time.
 */
public static final boolean alarmExists(ContentResolver cr,long eventId,long begin,long alarmTime){
  String selection=CalendarAlerts.EVENT_ID + "String_Node_Str" + eventId+ "String_Node_Str"+ CalendarAlerts.BEGIN+ "String_Node_Str"+ begin+ "String_Node_Str"+ CalendarAlerts.ALARM_TIME+ "String_Node_Str"+ alarmTime;
  String[] projection=new String[]{CalendarAlerts.ALARM_TIME};
  Cursor cursor=query(cr,projection,selection,null,null);
  boolean found=false;
  try {
    if (cursor != null && cursor.getCount() > 0) {
      found=true;
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return found;
}

Fixed version (ground truth):
/** 
 * Searches for an entry in the CalendarAlerts table that matches the given event id, begin time and alarm time.  If one is found then this alarm already exists and this method returns true.
 * @param cr the ContentResolver
 * @param eventId the event id to match
 * @param begin the start time of the event in UTC millis
 * @param alarmTime the alarm time of the event in UTC millis
 * @return true if there is already an alarm for the given eventwith the same start time and alarm time.
 */
public static final boolean alarmExists(ContentResolver cr,long eventId,long begin,long alarmTime){
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,WHERE_ALARM_EXISTS,new String[]{Long.toString(eventId),Long.toString(begin),Long.toString(alarmTime)},null);
  boolean found=false;
  try {
    if (cursor != null && cursor.getCount() > 0) {
      found=true;
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return found;
}
Program: 22904
Project: 22904
Buggy source:
/** 
 * Finds the next alarm after (or equal to) the given time and returns the time of that alarm or -1 if no such alarm exists.
 * @param cr the ContentResolver
 * @param millis the time in UTC milliseconds
 * @return the next alarm time greater than or equal to "millis", or -1if no such alarm exists.
 */
public static final long findNextAlarmTime(ContentResolver cr,long millis){
  String selection=ALARM_TIME + "String_Node_Str" + millis;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,selection,null,ALARM_TIME + "String_Node_Str");
  long alarmTime=-1;
  try {
    if (cursor != null && cursor.moveToFirst()) {
      alarmTime=cursor.getLong(0);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return alarmTime;
}

Fixed version (ground truth):
/** 
 * Finds the next alarm after (or equal to) the given time and returns the time of that alarm or -1 if no such alarm exists.
 * @param cr the ContentResolver
 * @param millis the time in UTC milliseconds
 * @return the next alarm time greater than or equal to "millis", or -1if no such alarm exists.
 */
public static final long findNextAlarmTime(ContentResolver cr,long millis){
  String selection=ALARM_TIME + "String_Node_Str" + millis;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,WHERE_FINDNEXTALARMTIME,new String[]{Long.toString(millis)},SORT_ORDER_ALARMTIME_ASC);
  long alarmTime=-1;
  try {
    if (cursor != null && cursor.moveToFirst()) {
      alarmTime=cursor.getLong(0);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return alarmTime;
}
Program: 22905
Project: 22905
Buggy source:
public static void scheduleAlarm(Context context,AlarmManager manager,long alarmTime){
  if (DEBUG) {
    Time time=new Time();
    time.set(alarmTime);
    String schedTime=time.format("String_Node_Str");
    Log.d(TAG,"String_Node_Str" + alarmTime + "String_Node_Str"+ schedTime);
  }
  if (manager == null) {
    manager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  }
  Intent intent=new Intent(android.provider.Calendar.EVENT_REMINDER_ACTION);
  intent.putExtra(android.provider.Calendar.CalendarAlerts.ALARM_TIME,alarmTime);
  PendingIntent pi=PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  manager.set(AlarmManager.RTC_WAKEUP,alarmTime,pi);
}

Fixed version (ground truth):
public static void scheduleAlarm(Context context,AlarmManager manager,long alarmTime){
  if (DEBUG) {
    Time time=new Time();
    time.set(alarmTime);
    String schedTime=time.format("String_Node_Str");
    Log.d(TAG,"String_Node_Str" + alarmTime + "String_Node_Str"+ schedTime);
  }
  if (manager == null) {
    manager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  }
  Intent intent=new Intent(EVENT_REMINDER_ACTION);
  intent.putExtra(ALARM_TIME,alarmTime);
  PendingIntent pi=PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  manager.set(AlarmManager.RTC_WAKEUP,alarmTime,pi);
}
Program: 22906
Project: 22906
Buggy source:
/** 
 * Convenience method to delete all calendars that match the account.
 * @param cr the ContentResolver
 * @param account the account whose rows should be deleted
 * @return the count of rows that were deleted
 */
public static int deleteCalendarsForAccount(ContentResolver cr,Account account){
  return Calendar.Calendars.delete(cr,Calendar.Calendars._SYNC_ACCOUNT + "String_Node_Str" + Calendar.Calendars._SYNC_ACCOUNT_TYPE+ "String_Node_Str",new String[]{account.name,account.type});
}

Fixed version (ground truth):
/** 
 * Convenience method to delete all calendars that match the account.
 * @param cr the ContentResolver
 * @param account the account whose rows should be deleted
 * @return the count of rows that were deleted
 */
public static int deleteCalendarsForAccount(ContentResolver cr,Account account){
  return Calendar.Calendars.delete(cr,WHERE_DELETE_FOR_ACCOUNT,new String[]{account.name,account.type});
}
Program: 22907
Project: 22907
Buggy source:
/** 
 * Searches the CalendarAlerts table for alarms that should have fired but have not and then reschedules them.  This method can be called at boot time to restore alarms that may have been lost due to a phone reboot.
 * @param cr the ContentResolver
 * @param context the Context
 * @param manager the AlarmManager
 */
public static final void rescheduleMissedAlarms(ContentResolver cr,Context context,AlarmManager manager){
  long now=System.currentTimeMillis();
  long ancient=now - DateUtils.DAY_IN_MILLIS;
  String selection=CalendarAlerts.STATE + "String_Node_Str" + CalendarAlerts.SCHEDULED+ "String_Node_Str"+ CalendarAlerts.ALARM_TIME+ "String_Node_Str"+ now+ "String_Node_Str"+ CalendarAlerts.ALARM_TIME+ "String_Node_Str"+ ancient+ "String_Node_Str"+ CalendarAlerts.END+ "String_Node_Str"+ now;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=CalendarAlerts.query(cr,projection,selection,null,"String_Node_Str");
  if (cursor == null) {
    return;
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + cursor.getCount());
  }
  try {
    long alarmTime=-1;
    while (cursor.moveToNext()) {
      long newAlarmTime=cursor.getLong(0);
      if (alarmTime != newAlarmTime) {
        if (DEBUG) {
          Log.w(TAG,"String_Node_Str" + newAlarmTime);
        }
        scheduleAlarm(context,manager,newAlarmTime);
        alarmTime=newAlarmTime;
      }
    }
  }
  finally {
    cursor.close();
  }
}

Fixed version (ground truth):
/** 
 * Searches the CalendarAlerts table for alarms that should have fired but have not and then reschedules them.  This method can be called at boot time to restore alarms that may have been lost due to a phone reboot.
 * @param cr the ContentResolver
 * @param context the Context
 * @param manager the AlarmManager
 */
public static final void rescheduleMissedAlarms(ContentResolver cr,Context context,AlarmManager manager){
  long now=System.currentTimeMillis();
  long ancient=now - DateUtils.DAY_IN_MILLIS;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=CalendarAlerts.query(cr,projection,WHERE_RESCHEDULE_MISSED_ALARMS,new String[]{Long.toString(now),Long.toString(ancient),Long.toString(now)},SORT_ORDER_ALARMTIME_ASC);
  if (cursor == null) {
    return;
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + cursor.getCount());
  }
  try {
    long alarmTime=-1;
    while (cursor.moveToNext()) {
      long newAlarmTime=cursor.getLong(0);
      if (alarmTime != newAlarmTime) {
        if (DEBUG) {
          Log.w(TAG,"String_Node_Str" + newAlarmTime);
        }
        scheduleAlarm(context,manager,newAlarmTime);
        alarmTime=newAlarmTime;
      }
    }
  }
  finally {
    cursor.close();
  }
}
Program: 22908
Project: 22908
Buggy source:
@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  final boolean isPassword=isPasswordInputType(mInputType);
  if (!isPassword) {
    CharSequence text=getText();
    if (TextUtils.isEmpty(text)) {
      text=getHint();
    }
    if (!TextUtils.isEmpty(text)) {
      if (text.length() > AccessibilityEvent.MAX_TEXT_LENGTH) {
        text=text.subSequence(0,AccessibilityEvent.MAX_TEXT_LENGTH + 1);
      }
      event.getText().add(text);
    }
  }
 else {
    event.setPassword(isPassword);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  if (!isShown()) {
    return false;
  }
  final boolean isPassword=isPasswordInputType(mInputType);
  if (!isPassword) {
    CharSequence text=getText();
    if (TextUtils.isEmpty(text)) {
      text=getHint();
    }
    if (!TextUtils.isEmpty(text)) {
      if (text.length() > AccessibilityEvent.MAX_TEXT_LENGTH) {
        text=text.subSequence(0,AccessibilityEvent.MAX_TEXT_LENGTH + 1);
      }
      event.getText().add(text);
    }
  }
 else {
    event.setPassword(isPassword);
  }
  return false;
}
Program: 22909
Project: 22909
Buggy source:
@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  final boolean isPassword=isPasswordInputType(mInputType);
  if (!isPassword) {
    CharSequence text=getText();
    if (TextUtils.isEmpty(text)) {
      text=getHint();
    }
    if (!TextUtils.isEmpty(text)) {
      if (text.length() > AccessibilityEvent.MAX_TEXT_LENGTH) {
        text=text.subSequence(0,AccessibilityEvent.MAX_TEXT_LENGTH + 1);
      }
      event.getText().add(text);
    }
  }
 else {
    event.setPassword(isPassword);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  if (!isShown()) {
    return false;
  }
  final boolean isPassword=isPasswordInputType(mInputType);
  if (!isPassword) {
    CharSequence text=getText();
    if (TextUtils.isEmpty(text)) {
      text=getHint();
    }
    if (!TextUtils.isEmpty(text)) {
      if (text.length() > AccessibilityEvent.MAX_TEXT_LENGTH) {
        text=text.subSequence(0,AccessibilityEvent.MAX_TEXT_LENGTH + 1);
      }
      event.getText().add(text);
    }
  }
 else {
    event.setPassword(isPassword);
  }
  return false;
}
Program: 22911
Project: 22911
Buggy source:
void start(int position,int boundPosition){
  if (boundPosition == INVALID_POSITION) {
    start(position);
    return;
  }
  final int firstPos=mFirstPosition;
  final int lastPos=firstPos + getChildCount() - 1;
  int viewTravelCount=0;
  if (position < firstPos) {
    final int boundPosFromLast=lastPos - boundPosition;
    if (boundPosFromLast < 1) {
      return;
    }
    final int posTravel=firstPos - position + 1;
    final int boundTravel=boundPosFromLast - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_UP_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_UP_POS;
    }
  }
 else   if (position > lastPos) {
    final int boundPosFromFirst=boundPosition - firstPos;
    if (boundPosFromFirst < 1) {
      return;
    }
    final int posTravel=position - lastPos + 1;
    final int boundTravel=boundPosFromFirst - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_DOWN_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_DOWN_POS;
    }
  }
 else {
    return;
  }
  if (viewTravelCount > 0) {
    mScrollDuration=SCROLL_DURATION / viewTravelCount;
  }
 else {
    mScrollDuration=SCROLL_DURATION;
  }
  mTargetPos=position;
  mBoundPos=boundPosition;
  mLastSeenPos=INVALID_POSITION;
  post(this);
}

Fixed version (ground truth):
void start(int position,int boundPosition){
  if (boundPosition == INVALID_POSITION) {
    start(position);
    return;
  }
  final int firstPos=mFirstPosition;
  final int lastPos=firstPos + getChildCount() - 1;
  int viewTravelCount=0;
  if (position <= firstPos) {
    final int boundPosFromLast=lastPos - boundPosition;
    if (boundPosFromLast < 1) {
      return;
    }
    final int posTravel=firstPos - position + 1;
    final int boundTravel=boundPosFromLast - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_UP_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_UP_POS;
    }
  }
 else   if (position >= lastPos) {
    final int boundPosFromFirst=boundPosition - firstPos;
    if (boundPosFromFirst < 1) {
      return;
    }
    final int posTravel=position - lastPos + 1;
    final int boundTravel=boundPosFromFirst - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_DOWN_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_DOWN_POS;
    }
  }
 else {
    return;
  }
  if (viewTravelCount > 0) {
    mScrollDuration=SCROLL_DURATION / viewTravelCount;
  }
 else {
    mScrollDuration=SCROLL_DURATION;
  }
  mTargetPos=position;
  mBoundPos=boundPosition;
  mLastSeenPos=INVALID_POSITION;
  post(this);
}
Program: 22912
Project: 22912
Buggy source:
void start(int position,int boundPosition){
  if (boundPosition == INVALID_POSITION) {
    start(position);
    return;
  }
  final int firstPos=mFirstPosition;
  final int lastPos=firstPos + getChildCount() - 1;
  int viewTravelCount=0;
  if (position < firstPos) {
    final int boundPosFromLast=lastPos - boundPosition;
    if (boundPosFromLast < 1) {
      return;
    }
    final int posTravel=firstPos - position + 1;
    final int boundTravel=boundPosFromLast - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_UP_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_UP_POS;
    }
  }
 else   if (position > lastPos) {
    final int boundPosFromFirst=boundPosition - firstPos;
    if (boundPosFromFirst < 1) {
      return;
    }
    final int posTravel=position - lastPos + 1;
    final int boundTravel=boundPosFromFirst - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_DOWN_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_DOWN_POS;
    }
  }
 else {
    return;
  }
  if (viewTravelCount > 0) {
    mScrollDuration=SCROLL_DURATION / viewTravelCount;
  }
 else {
    mScrollDuration=SCROLL_DURATION;
  }
  mTargetPos=position;
  mBoundPos=boundPosition;
  mLastSeenPos=INVALID_POSITION;
  post(this);
}

Fixed version (ground truth):
void start(int position,int boundPosition){
  if (boundPosition == INVALID_POSITION) {
    start(position);
    return;
  }
  final int firstPos=mFirstPosition;
  final int lastPos=firstPos + getChildCount() - 1;
  int viewTravelCount=0;
  if (position <= firstPos) {
    final int boundPosFromLast=lastPos - boundPosition;
    if (boundPosFromLast < 1) {
      return;
    }
    final int posTravel=firstPos - position + 1;
    final int boundTravel=boundPosFromLast - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_UP_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_UP_POS;
    }
  }
 else   if (position >= lastPos) {
    final int boundPosFromFirst=boundPosition - firstPos;
    if (boundPosFromFirst < 1) {
      return;
    }
    final int posTravel=position - lastPos + 1;
    final int boundTravel=boundPosFromFirst - 1;
    if (boundTravel < posTravel) {
      viewTravelCount=boundTravel;
      mMode=MOVE_DOWN_BOUND;
    }
 else {
      viewTravelCount=posTravel;
      mMode=MOVE_DOWN_POS;
    }
  }
 else {
    return;
  }
  if (viewTravelCount > 0) {
    mScrollDuration=SCROLL_DURATION / viewTravelCount;
  }
 else {
    mScrollDuration=SCROLL_DURATION;
  }
  mTargetPos=position;
  mBoundPos=boundPosition;
  mLastSeenPos=INVALID_POSITION;
  post(this);
}
Program: 22913
Project: 22913
Buggy source:
@Override protected boolean setFrame(int l,int t,int r,int b){
  boolean result=super.setFrame(l,t,r,b);
  if (mPopup.isShowing()) {
    mPopup.update(this,r - l,-1);
  }
  return result;
}

Fixed version (ground truth):
@Override protected boolean setFrame(final int l,int t,final int r,int b){
  boolean result=super.setFrame(l,t,r,b);
  if (mPopup.isShowing()) {
    showDropDown();
  }
  return result;
}
Program: 22914
Project: 22914
Buggy source:
/** 
 * <p>Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view.</p> <p>If the view later scrolls to move <code>anchor</code> to a different location, the popup will be moved correspondingly.</p>
 * @param anchor the view on which to pin the popup window
 * @see #dismiss()
 */
public void showAsDropDown(View anchor,int xoff,int yoff){
  if (isShowing() || mContentView == null) {
    return;
  }
  registerForScrollChanged(anchor,xoff,yoff);
  mIsShowing=true;
  mIsDropdown=true;
  WindowManager.LayoutParams p=createPopupLayout(anchor.getWindowToken());
  preparePopup(p);
  mAboveAnchor=findDropDownPosition(anchor,p,xoff,yoff);
  if (mBackground != null) {
    if (mAboveAnchorBackgroundDrawable != null) {
      if (mAboveAnchor) {
        mPopupView.setBackgroundDrawable(mAboveAnchorBackgroundDrawable);
      }
 else {
        mPopupView.setBackgroundDrawable(mBelowAnchorBackgroundDrawable);
      }
    }
 else {
      mPopupView.refreshDrawableState();
    }
  }
  if (mHeightMode < 0)   p.height=mLastHeight=mHeightMode;
  if (mWidthMode < 0)   p.width=mLastWidth=mWidthMode;
  p.windowAnimations=computeAnimationResource();
  invokePopup(p);
}

Fixed version (ground truth):
/** 
 * <p>Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view.</p> <p>If the view later scrolls to move <code>anchor</code> to a different location, the popup will be moved correspondingly.</p>
 * @param anchor the view on which to pin the popup window
 * @see #dismiss()
 */
public void showAsDropDown(View anchor,int xoff,int yoff){
  if (isShowing() || mContentView == null) {
    return;
  }
  registerForScrollChanged(anchor,xoff,yoff);
  mIsShowing=true;
  mIsDropdown=true;
  WindowManager.LayoutParams p=createPopupLayout(anchor.getWindowToken());
  preparePopup(p);
  updateAboveAnchor(findDropDownPosition(anchor,p,xoff,yoff));
  if (mHeightMode < 0)   p.height=mLastHeight=mHeightMode;
  if (mWidthMode < 0)   p.width=mLastWidth=mWidthMode;
  p.windowAnimations=computeAnimationResource();
  invokePopup(p);
}
Program: 22915
Project: 22915
Buggy source:
private void update(View anchor,boolean updateLocation,int xoff,int yoff,boolean updateDimension,int width,int height){
  if (!isShowing() || mContentView == null) {
    return;
  }
  WeakReference<View> oldAnchor=mAnchor;
  if (oldAnchor == null || oldAnchor.get() != anchor || (updateLocation && (mAnchorXoff != xoff || mAnchorYoff != yoff))) {
    registerForScrollChanged(anchor,xoff,yoff);
  }
  WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
  if (updateDimension) {
    if (width == -1) {
      width=mPopupWidth;
    }
 else {
      mPopupWidth=width;
    }
    if (height == -1) {
      height=mPopupHeight;
    }
 else {
      mPopupHeight=height;
    }
  }
  if (updateLocation) {
    mAboveAnchor=findDropDownPosition(anchor,p,xoff,yoff);
  }
 else {
    mAboveAnchor=findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff);
  }
  update(p.x,p.y,width,height);
}

Fixed version (ground truth):
private void update(View anchor,boolean updateLocation,int xoff,int yoff,boolean updateDimension,int width,int height){
  if (!isShowing() || mContentView == null) {
    return;
  }
  WeakReference<View> oldAnchor=mAnchor;
  if (oldAnchor == null || oldAnchor.get() != anchor || (updateLocation && (mAnchorXoff != xoff || mAnchorYoff != yoff))) {
    registerForScrollChanged(anchor,xoff,yoff);
  }
  WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
  if (updateDimension) {
    if (width == -1) {
      width=mPopupWidth;
    }
 else {
      mPopupWidth=width;
    }
    if (height == -1) {
      height=mPopupHeight;
    }
 else {
      mPopupHeight=height;
    }
  }
  int x=p.x;
  int y=p.y;
  if (updateLocation) {
    updateAboveAnchor(findDropDownPosition(anchor,p,xoff,yoff));
  }
 else {
    updateAboveAnchor(findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff));
  }
  update(p.x,p.y,width,height,x != p.x || y != p.y);
}
Program: 22916
Project: 22916
Buggy source:
public void onScrollChanged(){
  View anchor=mAnchor.get();
  if (anchor != null && mPopupView != null) {
    WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
    mAboveAnchor=findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff);
    update(p.x,p.y,-1,-1,true);
  }
}

Fixed version (ground truth):
public void onScrollChanged(){
  View anchor=mAnchor.get();
  if (anchor != null && mPopupView != null) {
    WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
    updateAboveAnchor(findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff));
    update(p.x,p.y,-1,-1,true);
  }
}
Program: 22919
Project: 22919
Buggy source:
@Override protected boolean setFrame(int l,int t,int r,int b){
  boolean result=super.setFrame(l,t,r,b);
  if (mPopup.isShowing()) {
    mPopup.update(this,r - l,-1);
  }
  return result;
}

Fixed version (ground truth):
@Override protected boolean setFrame(final int l,int t,final int r,int b){
  boolean result=super.setFrame(l,t,r,b);
  if (mPopup.isShowing()) {
    showDropDown();
  }
  return result;
}
Program: 22920
Project: 22920
Buggy source:
/** 
 * <p>Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view.</p> <p>If the view later scrolls to move <code>anchor</code> to a different location, the popup will be moved correspondingly.</p>
 * @param anchor the view on which to pin the popup window
 * @see #dismiss()
 */
public void showAsDropDown(View anchor,int xoff,int yoff){
  if (isShowing() || mContentView == null) {
    return;
  }
  registerForScrollChanged(anchor,xoff,yoff);
  mIsShowing=true;
  mIsDropdown=true;
  WindowManager.LayoutParams p=createPopupLayout(anchor.getWindowToken());
  preparePopup(p);
  mAboveAnchor=findDropDownPosition(anchor,p,xoff,yoff);
  if (mBackground != null) {
    if (mAboveAnchorBackgroundDrawable != null) {
      if (mAboveAnchor) {
        mPopupView.setBackgroundDrawable(mAboveAnchorBackgroundDrawable);
      }
 else {
        mPopupView.setBackgroundDrawable(mBelowAnchorBackgroundDrawable);
      }
    }
 else {
      mPopupView.refreshDrawableState();
    }
  }
  if (mHeightMode < 0)   p.height=mLastHeight=mHeightMode;
  if (mWidthMode < 0)   p.width=mLastWidth=mWidthMode;
  p.windowAnimations=computeAnimationResource();
  invokePopup(p);
}

Fixed version (ground truth):
/** 
 * <p>Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view.</p> <p>If the view later scrolls to move <code>anchor</code> to a different location, the popup will be moved correspondingly.</p>
 * @param anchor the view on which to pin the popup window
 * @see #dismiss()
 */
public void showAsDropDown(View anchor,int xoff,int yoff){
  if (isShowing() || mContentView == null) {
    return;
  }
  registerForScrollChanged(anchor,xoff,yoff);
  mIsShowing=true;
  mIsDropdown=true;
  WindowManager.LayoutParams p=createPopupLayout(anchor.getWindowToken());
  preparePopup(p);
  updateAboveAnchor(findDropDownPosition(anchor,p,xoff,yoff));
  if (mHeightMode < 0)   p.height=mLastHeight=mHeightMode;
  if (mWidthMode < 0)   p.width=mLastWidth=mWidthMode;
  p.windowAnimations=computeAnimationResource();
  invokePopup(p);
}
Program: 22921
Project: 22921
Buggy source:
private void update(View anchor,boolean updateLocation,int xoff,int yoff,boolean updateDimension,int width,int height){
  if (!isShowing() || mContentView == null) {
    return;
  }
  WeakReference<View> oldAnchor=mAnchor;
  if (oldAnchor == null || oldAnchor.get() != anchor || (updateLocation && (mAnchorXoff != xoff || mAnchorYoff != yoff))) {
    registerForScrollChanged(anchor,xoff,yoff);
  }
  WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
  if (updateDimension) {
    if (width == -1) {
      width=mPopupWidth;
    }
 else {
      mPopupWidth=width;
    }
    if (height == -1) {
      height=mPopupHeight;
    }
 else {
      mPopupHeight=height;
    }
  }
  if (updateLocation) {
    mAboveAnchor=findDropDownPosition(anchor,p,xoff,yoff);
  }
 else {
    mAboveAnchor=findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff);
  }
  update(p.x,p.y,width,height);
}

Fixed version (ground truth):
private void update(View anchor,boolean updateLocation,int xoff,int yoff,boolean updateDimension,int width,int height){
  if (!isShowing() || mContentView == null) {
    return;
  }
  WeakReference<View> oldAnchor=mAnchor;
  if (oldAnchor == null || oldAnchor.get() != anchor || (updateLocation && (mAnchorXoff != xoff || mAnchorYoff != yoff))) {
    registerForScrollChanged(anchor,xoff,yoff);
  }
  WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
  if (updateDimension) {
    if (width == -1) {
      width=mPopupWidth;
    }
 else {
      mPopupWidth=width;
    }
    if (height == -1) {
      height=mPopupHeight;
    }
 else {
      mPopupHeight=height;
    }
  }
  int x=p.x;
  int y=p.y;
  if (updateLocation) {
    updateAboveAnchor(findDropDownPosition(anchor,p,xoff,yoff));
  }
 else {
    updateAboveAnchor(findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff));
  }
  update(p.x,p.y,width,height,x != p.x || y != p.y);
}
Program: 22922
Project: 22922
Buggy source:
public void onScrollChanged(){
  View anchor=mAnchor.get();
  if (anchor != null && mPopupView != null) {
    WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
    mAboveAnchor=findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff);
    update(p.x,p.y,-1,-1,true);
  }
}

Fixed version (ground truth):
public void onScrollChanged(){
  View anchor=mAnchor.get();
  if (anchor != null && mPopupView != null) {
    WindowManager.LayoutParams p=(WindowManager.LayoutParams)mPopupView.getLayoutParams();
    updateAboveAnchor(findDropDownPosition(anchor,p,mAnchorXoff,mAnchorYoff));
    update(p.x,p.y,-1,-1,true);
  }
}
Program: 22926
Project: 22926
Buggy source:
public AuthenticatorDescription parseServiceAttributes(String packageName,AttributeSet attrs){
  TypedArray sa=mContext.getResources().obtainAttributes(attrs,com.android.internal.R.styleable.AccountAuthenticator);
  try {
    final String accountType=sa.getString(com.android.internal.R.styleable.AccountAuthenticator_accountType);
    final int labelId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_label,0);
    final int iconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_icon,0);
    final int smallIconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_smallIcon,0);
    final int prefId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_accountPreferences,0);
    if (TextUtils.isEmpty(accountType)) {
      return null;
    }
    return new AuthenticatorDescription(accountType,packageName,labelId,iconId,smallIconId,prefId);
  }
  finally {
    sa.recycle();
  }
}

Fixed version (ground truth):
public AuthenticatorDescription parseServiceAttributes(Resources res,String packageName,AttributeSet attrs){
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AccountAuthenticator);
  try {
    final String accountType=sa.getString(com.android.internal.R.styleable.AccountAuthenticator_accountType);
    final int labelId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_label,0);
    final int iconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_icon,0);
    final int smallIconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_smallIcon,0);
    final int prefId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_accountPreferences,0);
    if (TextUtils.isEmpty(accountType)) {
      return null;
    }
    return new AuthenticatorDescription(accountType,packageName,labelId,iconId,smallIconId,prefId);
  }
  finally {
    sa.recycle();
  }
}
Program: 22927
Project: 22927
Buggy source:
public SyncAdapterType parseServiceAttributes(String packageName,AttributeSet attrs){
  TypedArray sa=mContext.getResources().obtainAttributes(attrs,com.android.internal.R.styleable.SyncAdapter);
  try {
    final String authority=sa.getString(com.android.internal.R.styleable.SyncAdapter_contentAuthority);
    final String accountType=sa.getString(com.android.internal.R.styleable.SyncAdapter_accountType);
    if (authority == null || accountType == null) {
      return null;
    }
    final boolean userVisible=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_userVisible,true);
    final boolean supportsUploading=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_supportsUploading,true);
    return new SyncAdapterType(authority,accountType,userVisible,supportsUploading);
  }
  finally {
    sa.recycle();
  }
}

Fixed version (ground truth):
public SyncAdapterType parseServiceAttributes(Resources res,String packageName,AttributeSet attrs){
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.SyncAdapter);
  try {
    final String authority=sa.getString(com.android.internal.R.styleable.SyncAdapter_contentAuthority);
    final String accountType=sa.getString(com.android.internal.R.styleable.SyncAdapter_accountType);
    if (authority == null || accountType == null) {
      return null;
    }
    final boolean userVisible=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_userVisible,true);
    final boolean supportsUploading=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_supportsUploading,true);
    return new SyncAdapterType(authority,accountType,userVisible,supportsUploading);
  }
  finally {
    sa.recycle();
  }
}
Program: 22928
Project: 22928
Buggy source:
public abstract V parseServiceAttributes(String packageName,AttributeSet attrs);

Fixed version (ground truth):
public abstract V parseServiceAttributes(Resources res,String packageName,AttributeSet attrs);
Program: 22929
Project: 22929
Buggy source:
private ServiceInfo<V> parseServiceInfo(ResolveInfo service) throws XmlPullParserException, IOException {
  android.content.pm.ServiceInfo si=service.serviceInfo;
  ComponentName componentName=new ComponentName(si.packageName,si.name);
  PackageManager pm=mContext.getPackageManager();
  XmlResourceParser parser=null;
  try {
    parser=si.loadXmlMetaData(pm,mMetaDataName);
    if (parser == null) {
      throw new XmlPullParserException("String_Node_Str" + mMetaDataName + "String_Node_Str");
    }
    AttributeSet attrs=Xml.asAttributeSet(parser);
    int type;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
    }
    String nodeName=parser.getName();
    if (!mAttributesName.equals(nodeName)) {
      throw new XmlPullParserException("String_Node_Str" + mAttributesName + "String_Node_Str");
    }
    V v=parseServiceAttributes(si.packageName,attrs);
    if (v == null) {
      return null;
    }
    final android.content.pm.ServiceInfo serviceInfo=service.serviceInfo;
    final ApplicationInfo applicationInfo=serviceInfo.applicationInfo;
    final int uid=applicationInfo.uid;
    return new ServiceInfo<V>(v,componentName,uid);
  }
  finally {
    if (parser != null)     parser.close();
  }
}

Fixed version (ground truth):
private ServiceInfo<V> parseServiceInfo(ResolveInfo service) throws XmlPullParserException, IOException {
  android.content.pm.ServiceInfo si=service.serviceInfo;
  ComponentName componentName=new ComponentName(si.packageName,si.name);
  PackageManager pm=mContext.getPackageManager();
  XmlResourceParser parser=null;
  try {
    parser=si.loadXmlMetaData(pm,mMetaDataName);
    if (parser == null) {
      throw new XmlPullParserException("String_Node_Str" + mMetaDataName + "String_Node_Str");
    }
    AttributeSet attrs=Xml.asAttributeSet(parser);
    int type;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
    }
    String nodeName=parser.getName();
    if (!mAttributesName.equals(nodeName)) {
      throw new XmlPullParserException("String_Node_Str" + mAttributesName + "String_Node_Str");
    }
    V v=parseServiceAttributes(pm.getResourcesForApplication(si.applicationInfo),si.packageName,attrs);
    if (v == null) {
      return null;
    }
    final android.content.pm.ServiceInfo serviceInfo=service.serviceInfo;
    final ApplicationInfo applicationInfo=serviceInfo.applicationInfo;
    final int uid=applicationInfo.uid;
    return new ServiceInfo<V>(v,componentName,uid);
  }
 catch (  NameNotFoundException e) {
    throw new XmlPullParserException("String_Node_Str" + si.packageName);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
Program: 22931
Project: 22931
Buggy source:
public void reportFailedUnlockAttempt(){
  mLockPatternUtils.reportFailedPasswordAttempt();
}

Fixed version (ground truth):
public void reportFailedUnlockAttempt(){
  mUpdateMonitor.reportFailedAttempt();
  final int failedAttempts=mUpdateMonitor.getFailedAttempts();
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + failedAttempts + "String_Node_Str"+ mEnableFallback+ "String_Node_Str");
  if (mEnableFallback && failedAttempts == (LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
    showAlmostAtAccountLoginDialog();
  }
 else   if (mEnableFallback && failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
    mLockPatternUtils.setPermanentlyLocked(true);
    updateScreen(mMode);
  }
 else   if ((failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0) {
    showTimeoutDialog();
  }
  mLockPatternUtils.reportFailedPasswordAttempt();
}
Program: 22932
Project: 22932
Buggy source:
/** 
 * Given the current state of things, what should the unlock screen be?
 */
private UnlockMode getUnlockMode(){
  final IccCard.State simState=mUpdateMonitor.getSimState();
  UnlockMode currentMode;
  if (simState == IccCard.State.PIN_REQUIRED || simState == IccCard.State.PUK_REQUIRED) {
    currentMode=UnlockMode.SimPin;
  }
 else {
    final int mode=mLockPatternUtils.getPasswordMode();
switch (mode) {
case LockPatternUtils.MODE_PIN:
case LockPatternUtils.MODE_PASSWORD:
      currentMode=UnlockMode.Password;
    break;
case LockPatternUtils.MODE_PATTERN:
  if (mForgotPattern && mLockPatternUtils.isPermanentlyLocked()) {
    currentMode=UnlockMode.Account;
  }
 else {
    currentMode=UnlockMode.Pattern;
  }
break;
default :
throw new IllegalStateException("String_Node_Str" + mode);
}
}
return currentMode;
}

Fixed version (ground truth):
/** 
 * Given the current state of things, what should the unlock screen be?
 */
private UnlockMode getUnlockMode(){
  final IccCard.State simState=mUpdateMonitor.getSimState();
  UnlockMode currentMode;
  if (simState == IccCard.State.PIN_REQUIRED || simState == IccCard.State.PUK_REQUIRED) {
    currentMode=UnlockMode.SimPin;
  }
 else {
    final int mode=mLockPatternUtils.getPasswordMode();
switch (mode) {
case LockPatternUtils.MODE_PIN:
case LockPatternUtils.MODE_PASSWORD:
      currentMode=UnlockMode.Password;
    break;
case LockPatternUtils.MODE_PATTERN:
  if (mForgotPattern || mLockPatternUtils.isPermanentlyLocked()) {
    currentMode=UnlockMode.Account;
  }
 else {
    currentMode=UnlockMode.Pattern;
  }
break;
default :
throw new IllegalStateException("String_Node_Str" + mode);
}
}
return currentMode;
}