nus-yam/ex-repair huggingface dataset:
Program: 1838
Project: 1838
Buggy source:
/** 
 * Adds child transitions to this group. The order of the child transitions passed in determines the order in which they are started.
 * @param transitions A list of child transition to be added to this group.
 */
public void addTransitions(Transition... transitions){
  if (transitions != null) {
    int numTransitions=transitions.length;
    for (int i=0; i < numTransitions; ++i) {
      mTransitions.add(transitions[i]);
      transitions[i].mParent=this;
      if (mDuration >= 0) {
        transitions[0].setDuration(mDuration);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds child transitions to this group. The order of the child transitions passed in determines the order in which they are started.
 * @param transitions A list of child transition to be added to this group.
 */
public void addTransitions(Transition... transitions){
  if (transitions != null) {
    int numTransitions=transitions.length;
    for (int i=0; i < numTransitions; ++i) {
      mTransitions.add(transitions[i]);
      transitions[i].mParent=this;
      if (mDuration >= 0) {
        transitions[i].setDuration(mDuration);
      }
    }
  }
}
Program: 1839
Project: 1839
Buggy source:
@Override protected Animator appear(ViewGroup sceneRoot,TransitionValues startValues,int startVisibility,TransitionValues endValues,int endVisibility){
  View endView=(endValues != null) ? endValues.view : null;
  if ((mFadingMode & IN) != IN) {
    return null;
  }
  endView.setAlpha(0);
  return runAnimation(endView,0,1,null);
}

Fixed version (ground truth):
@Override protected Animator appear(ViewGroup sceneRoot,TransitionValues startValues,int startVisibility,TransitionValues endValues,int endVisibility){
  if ((mFadingMode & IN) != IN || endValues == null) {
    return null;
  }
  final View endView=endValues.view;
  endView.setAlpha(0);
  final Animator.AnimatorListener endListener=new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      endView.setAlpha(1);
    }
  }
;
  return runAnimation(endView,0,1,endListener);
}
Program: 1840
Project: 1840
Buggy source:
/** 
 * Adds child transitions to this group. The order of the child transitions passed in determines the order in which they are started.
 * @param transitions A list of child transition to be added to this group.
 */
public void addTransitions(Transition... transitions){
  if (transitions != null) {
    int numTransitions=transitions.length;
    for (int i=0; i < numTransitions; ++i) {
      mTransitions.add(transitions[i]);
      transitions[i].mParent=this;
      if (mDuration >= 0) {
        transitions[0].setDuration(mDuration);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds child transitions to this group. The order of the child transitions passed in determines the order in which they are started.
 * @param transitions A list of child transition to be added to this group.
 */
public void addTransitions(Transition... transitions){
  if (transitions != null) {
    int numTransitions=transitions.length;
    for (int i=0; i < numTransitions; ++i) {
      mTransitions.add(transitions[i]);
      transitions[i].mParent=this;
      if (mDuration >= 0) {
        transitions[i].setDuration(mDuration);
      }
    }
  }
}
Program: 1844
Project: 1844
Buggy source:
/** 
 * Updates (in a synchronized way) the periodic sync time of the specified authority id and target periodic sync
 */
public void setPeriodicSyncTime(int authorityId,Pair<Bundle,Long> targetPeriodicSync,long when){
synchronized (mAuthorities) {
    final AuthorityInfo authority=mAuthorities.get(authorityId);
    for (int i=0; i < authority.periodicSyncs.size(); i++) {
      Pair<Bundle,Long> periodicSync=authority.periodicSyncs.get(i);
      if (periodicSync.first == targetPeriodicSync.first && periodicSync.second == targetPeriodicSync.second) {
        mSyncStatus.get(authorityId).setPeriodicSyncTime(i,when);
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates (in a synchronized way) the periodic sync time of the specified authority id and target periodic sync
 */
public void setPeriodicSyncTime(int authorityId,Pair<Bundle,Long> targetPeriodicSync,long when){
  boolean found=false;
  final AuthorityInfo authorityInfo;
synchronized (mAuthorities) {
    authorityInfo=mAuthorities.get(authorityId);
    for (int i=0; i < authorityInfo.periodicSyncs.size(); i++) {
      Pair<Bundle,Long> periodicSync=authorityInfo.periodicSyncs.get(i);
      if (PeriodicSync.syncExtrasEquals(periodicSync.first,targetPeriodicSync.first) && periodicSync.second == targetPeriodicSync.second) {
        mSyncStatus.get(authorityId).setPeriodicSyncTime(i,when);
        found=true;
        break;
      }
    }
  }
  if (!found) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + authorityInfo.authority);
  }
}
Program: 1845
Project: 1845
Buggy source:
/** 
 * Updates (in a synchronized way) the periodic sync time of the specified authority id and target periodic sync
 */
public void setPeriodicSyncTime(int authorityId,Pair<Bundle,Long> targetPeriodicSync,long when){
synchronized (mAuthorities) {
    final AuthorityInfo authority=mAuthorities.get(authorityId);
    for (int i=0; i < authority.periodicSyncs.size(); i++) {
      Pair<Bundle,Long> periodicSync=authority.periodicSyncs.get(i);
      if (periodicSync.first == targetPeriodicSync.first && periodicSync.second == targetPeriodicSync.second) {
        mSyncStatus.get(authorityId).setPeriodicSyncTime(i,when);
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates (in a synchronized way) the periodic sync time of the specified authority id and target periodic sync
 */
public void setPeriodicSyncTime(int authorityId,Pair<Bundle,Long> targetPeriodicSync,long when){
  boolean found=false;
  final AuthorityInfo authorityInfo;
synchronized (mAuthorities) {
    authorityInfo=mAuthorities.get(authorityId);
    for (int i=0; i < authorityInfo.periodicSyncs.size(); i++) {
      Pair<Bundle,Long> periodicSync=authorityInfo.periodicSyncs.get(i);
      if (PeriodicSync.syncExtrasEquals(periodicSync.first,targetPeriodicSync.first) && periodicSync.second == targetPeriodicSync.second) {
        mSyncStatus.get(authorityId).setPeriodicSyncTime(i,when);
        found=true;
        break;
      }
    }
  }
  if (!found) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + authorityInfo.authority);
  }
}
Program: 1846
Project: 1846
Buggy source:
/** 
 * Updates (in a synchronized way) the periodic sync time of the specified authority id and target periodic sync
 */
public void setPeriodicSyncTime(int authorityId,Pair<Bundle,Long> targetPeriodicSync,long when){
synchronized (mAuthorities) {
    final AuthorityInfo authority=mAuthorities.get(authorityId);
    for (int i=0; i < authority.periodicSyncs.size(); i++) {
      Pair<Bundle,Long> periodicSync=authority.periodicSyncs.get(i);
      if (periodicSync.first == targetPeriodicSync.first && periodicSync.second == targetPeriodicSync.second) {
        mSyncStatus.get(authorityId).setPeriodicSyncTime(i,when);
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates (in a synchronized way) the periodic sync time of the specified authority id and target periodic sync
 */
public void setPeriodicSyncTime(int authorityId,Pair<Bundle,Long> targetPeriodicSync,long when){
  boolean found=false;
  final AuthorityInfo authorityInfo;
synchronized (mAuthorities) {
    authorityInfo=mAuthorities.get(authorityId);
    for (int i=0; i < authorityInfo.periodicSyncs.size(); i++) {
      Pair<Bundle,Long> periodicSync=authorityInfo.periodicSyncs.get(i);
      if (PeriodicSync.syncExtrasEquals(periodicSync.first,targetPeriodicSync.first) && periodicSync.second == targetPeriodicSync.second) {
        mSyncStatus.get(authorityId).setPeriodicSyncTime(i,when);
        found=true;
        break;
      }
    }
  }
  if (!found) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + authorityInfo.authority);
  }
}
Program: 1847
Project: 1847
Buggy source:
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    mLockScreenShown=shown;
    comeOutOfSleepIfNeededLocked();
  }
}

Fixed version (ground truth):
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    long ident=Binder.clearCallingIdentity();
    try {
      mLockScreenShown=shown;
      comeOutOfSleepIfNeededLocked();
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
  }
}
Program: 1848
Project: 1848
Buggy source:
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  if (persistent) {
    final ContentResolver resolver=mContext.getContentResolver();
    Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
    Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
  }
synchronized (this) {
    if (!persistent) {
      mOrigDebugApp=mDebugApp;
      mOrigWaitForDebugger=mWaitForDebugger;
    }
    mDebugApp=packageName;
    mWaitForDebugger=waitForDebugger;
    mDebugTransient=!persistent;
    if (packageName != null) {
      final long origId=Binder.clearCallingIdentity();
      forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 1849
Project: 1849
Buggy source:
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    mLockScreenShown=shown;
    comeOutOfSleepIfNeededLocked();
  }
}

Fixed version (ground truth):
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    long ident=Binder.clearCallingIdentity();
    try {
      mLockScreenShown=shown;
      comeOutOfSleepIfNeededLocked();
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
  }
}
Program: 1850
Project: 1850
Buggy source:
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  if (persistent) {
    final ContentResolver resolver=mContext.getContentResolver();
    Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
    Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
  }
synchronized (this) {
    if (!persistent) {
      mOrigDebugApp=mDebugApp;
      mOrigWaitForDebugger=mWaitForDebugger;
    }
    mDebugApp=packageName;
    mWaitForDebugger=waitForDebugger;
    mDebugTransient=!persistent;
    if (packageName != null) {
      final long origId=Binder.clearCallingIdentity();
      forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 1851
Project: 1851
Buggy source:
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    mLockScreenShown=shown;
    comeOutOfSleepIfNeededLocked();
  }
}

Fixed version (ground truth):
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    long ident=Binder.clearCallingIdentity();
    try {
      mLockScreenShown=shown;
      comeOutOfSleepIfNeededLocked();
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
  }
}
Program: 1852
Project: 1852
Buggy source:
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  if (persistent) {
    final ContentResolver resolver=mContext.getContentResolver();
    Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
    Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
  }
synchronized (this) {
    if (!persistent) {
      mOrigDebugApp=mDebugApp;
      mOrigWaitForDebugger=mWaitForDebugger;
    }
    mDebugApp=packageName;
    mWaitForDebugger=waitForDebugger;
    mDebugTransient=!persistent;
    if (packageName != null) {
      final long origId=Binder.clearCallingIdentity();
      forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
public void setDebugApp(String packageName,boolean waitForDebugger,boolean persistent){
  enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  try {
    if (persistent) {
      final ContentResolver resolver=mContext.getContentResolver();
      Settings.Global.putString(resolver,Settings.Global.DEBUG_APP,packageName);
      Settings.Global.putInt(resolver,Settings.Global.WAIT_FOR_DEBUGGER,waitForDebugger ? 1 : 0);
    }
synchronized (this) {
      if (!persistent) {
        mOrigDebugApp=mDebugApp;
        mOrigWaitForDebugger=mWaitForDebugger;
      }
      mDebugApp=packageName;
      mWaitForDebugger=waitForDebugger;
      mDebugTransient=!persistent;
      if (packageName != null) {
        forceStopPackageLocked(packageName,-1,false,false,true,true,UserHandle.USER_ALL,"String_Node_Str");
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 1853
Project: 1853
Buggy source:
public void removePeriodicSyncTime(int index){
  ensurePeriodicSyncTimeSize(index);
  periodicSyncTimes.remove(index);
}

Fixed version (ground truth):
public void removePeriodicSyncTime(int index){
  if (periodicSyncTimes != null && index < periodicSyncTimes.size()) {
    periodicSyncTimes.remove(index);
  }
}
Program: 1854
Project: 1854
Buggy source:
public SyncStatusInfo(Parcel parcel){
  int version=parcel.readInt();
  if (version != VERSION && version != 1) {
    Log.w("String_Node_Str","String_Node_Str" + version);
  }
  authorityId=parcel.readInt();
  totalElapsedTime=parcel.readLong();
  numSyncs=parcel.readInt();
  numSourcePoll=parcel.readInt();
  numSourceServer=parcel.readInt();
  numSourceLocal=parcel.readInt();
  numSourceUser=parcel.readInt();
  lastSuccessTime=parcel.readLong();
  lastSuccessSource=parcel.readInt();
  lastFailureTime=parcel.readLong();
  lastFailureSource=parcel.readInt();
  lastFailureMesg=parcel.readString();
  initialFailureTime=parcel.readLong();
  pending=parcel.readInt() != 0;
  initialize=parcel.readInt() != 0;
  if (version == 1) {
    periodicSyncTimes=null;
  }
 else {
    int N=parcel.readInt();
    if (N < 0) {
      periodicSyncTimes=null;
    }
 else {
      periodicSyncTimes=new ArrayList<Long>();
      for (int i=0; i < N; i++) {
        periodicSyncTimes.add(parcel.readLong());
      }
    }
  }
}

Fixed version (ground truth):
public SyncStatusInfo(SyncStatusInfo other){
  authorityId=other.authorityId;
  totalElapsedTime=other.totalElapsedTime;
  numSyncs=other.numSyncs;
  numSourcePoll=other.numSourcePoll;
  numSourceServer=other.numSourceServer;
  numSourceLocal=other.numSourceLocal;
  numSourceUser=other.numSourceUser;
  numSourcePeriodic=other.numSourcePeriodic;
  lastSuccessTime=other.lastSuccessTime;
  lastSuccessSource=other.lastSuccessSource;
  lastFailureTime=other.lastFailureTime;
  lastFailureSource=other.lastFailureSource;
  lastFailureMesg=other.lastFailureMesg;
  initialFailureTime=other.initialFailureTime;
  pending=other.pending;
  initialize=other.initialize;
  if (other.periodicSyncTimes != null) {
    periodicSyncTimes=new ArrayList<Long>(other.periodicSyncTimes);
  }
}
Program: 1855
Project: 1855
Buggy source:
public long getPeriodicSyncTime(int index){
  if (periodicSyncTimes == null || periodicSyncTimes.size() < (index + 1)) {
    return 0;
  }
  return periodicSyncTimes.get(index);
}

Fixed version (ground truth):
public long getPeriodicSyncTime(int index){
  if (periodicSyncTimes != null && index < periodicSyncTimes.size()) {
    return periodicSyncTimes.get(index);
  }
 else {
    return 0;
  }
}
Program: 1858
Project: 1858
Buggy source:
public void removePeriodicSyncTime(int index){
  ensurePeriodicSyncTimeSize(index);
  periodicSyncTimes.remove(index);
}

Fixed version (ground truth):
public void removePeriodicSyncTime(int index){
  if (periodicSyncTimes != null && index < periodicSyncTimes.size()) {
    periodicSyncTimes.remove(index);
  }
}
Program: 1859
Project: 1859
Buggy source:
public SyncStatusInfo(Parcel parcel){
  int version=parcel.readInt();
  if (version != VERSION && version != 1) {
    Log.w("String_Node_Str","String_Node_Str" + version);
  }
  authorityId=parcel.readInt();
  totalElapsedTime=parcel.readLong();
  numSyncs=parcel.readInt();
  numSourcePoll=parcel.readInt();
  numSourceServer=parcel.readInt();
  numSourceLocal=parcel.readInt();
  numSourceUser=parcel.readInt();
  lastSuccessTime=parcel.readLong();
  lastSuccessSource=parcel.readInt();
  lastFailureTime=parcel.readLong();
  lastFailureSource=parcel.readInt();
  lastFailureMesg=parcel.readString();
  initialFailureTime=parcel.readLong();
  pending=parcel.readInt() != 0;
  initialize=parcel.readInt() != 0;
  if (version == 1) {
    periodicSyncTimes=null;
  }
 else {
    int N=parcel.readInt();
    if (N < 0) {
      periodicSyncTimes=null;
    }
 else {
      periodicSyncTimes=new ArrayList<Long>();
      for (int i=0; i < N; i++) {
        periodicSyncTimes.add(parcel.readLong());
      }
    }
  }
}

Fixed version (ground truth):
public SyncStatusInfo(SyncStatusInfo other){
  authorityId=other.authorityId;
  totalElapsedTime=other.totalElapsedTime;
  numSyncs=other.numSyncs;
  numSourcePoll=other.numSourcePoll;
  numSourceServer=other.numSourceServer;
  numSourceLocal=other.numSourceLocal;
  numSourceUser=other.numSourceUser;
  numSourcePeriodic=other.numSourcePeriodic;
  lastSuccessTime=other.lastSuccessTime;
  lastSuccessSource=other.lastSuccessSource;
  lastFailureTime=other.lastFailureTime;
  lastFailureSource=other.lastFailureSource;
  lastFailureMesg=other.lastFailureMesg;
  initialFailureTime=other.initialFailureTime;
  pending=other.pending;
  initialize=other.initialize;
  if (other.periodicSyncTimes != null) {
    periodicSyncTimes=new ArrayList<Long>(other.periodicSyncTimes);
  }
}
Program: 1860
Project: 1860
Buggy source:
public long getPeriodicSyncTime(int index){
  if (periodicSyncTimes == null || periodicSyncTimes.size() < (index + 1)) {
    return 0;
  }
  return periodicSyncTimes.get(index);
}

Fixed version (ground truth):
public long getPeriodicSyncTime(int index){
  if (periodicSyncTimes != null && index < periodicSyncTimes.size()) {
    return periodicSyncTimes.get(index);
  }
 else {
    return 0;
  }
}
Program: 1865
Project: 1865
Buggy source:
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      stack.moveTaskToBackLocked(taskId,null);
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      stack.moveTaskToBackLocked(taskId,null);
      Binder.restoreCallingIdentity(origId);
    }
  }
}
Program: 1866
Project: 1866
Buggy source:
/** 
 * TODO: Add mController hook
 */
@Override public void moveTaskToFront(int task,int flags,Bundle options){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      ActivityOptions.abort(options);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    try {
      mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
    ActivityOptions.abort(options);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Add mController hook
 */
@Override public void moveTaskToFront(int task,int flags,Bundle options){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
  if (DEBUG_STACK)   Slog.d(TAG,"String_Node_Str" + task);
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      ActivityOptions.abort(options);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    try {
      mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
    ActivityOptions.abort(options);
  }
}
Program: 1867
Project: 1867
Buggy source:
@Override public void moveTaskToStack(int taskId,int stackId,boolean toTop){
  if (stackId == HOME_STACK_ID) {
    Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str",new RuntimeException("String_Node_Str").fillInStackTrace());
  }
synchronized (this) {
    mStackSupervisor.moveTaskToStack(taskId,stackId,toTop);
  }
}

Fixed version (ground truth):
@Override public void moveTaskToStack(int taskId,int stackId,boolean toTop){
  if (stackId == HOME_STACK_ID) {
    Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str",new RuntimeException("String_Node_Str").fillInStackTrace());
  }
synchronized (this) {
    if (DEBUG_STACK)     Slog.d(TAG,"String_Node_Str" + taskId + "String_Node_Str"+ stackId+ "String_Node_Str"+ toTop);
    mStackSupervisor.moveTaskToStack(taskId,stackId,toTop);
  }
}
Program: 1868
Project: 1868
Buggy source:
ActivityStack getCorrectStack(ActivityRecord r){
  if (r.isApplicationActivity() || (r.task != null && r.task.isApplicationTask())) {
    int stackNdx;
    for (stackNdx=mStacks.size() - 1; stackNdx > 0; --stackNdx) {
      if (mStacks.get(stackNdx).mCurrentUser == mCurrentUser) {
        break;
      }
    }
    if (stackNdx == 0) {
      int stackId=mService.createStack(-1,HOME_STACK_ID,StackBox.TASK_STACK_GOES_OVER,1.0f);
      mFocusedStack=getStack(stackId);
    }
    return mFocusedStack;
  }
  return mHomeStack;
}

Fixed version (ground truth):
ActivityStack getCorrectStack(ActivityRecord r){
  final TaskRecord task=r.task;
  if (r.isApplicationActivity() || (task != null && task.isApplicationTask())) {
    int stackNdx;
    for (stackNdx=mStacks.size() - 1; stackNdx > 0; --stackNdx) {
      if (mStacks.get(stackNdx).mCurrentUser == mCurrentUser) {
        break;
      }
    }
    if (stackNdx == 0) {
      int stackId=mService.createStack(-1,HOME_STACK_ID,StackBox.TASK_STACK_GOES_OVER,1.0f);
      mFocusedStack=getStack(stackId);
    }
    if (task != null) {
      mFocusedStack=task.stack;
    }
    return mFocusedStack;
  }
  return mHomeStack;
}
Program: 1870
Project: 1870
Buggy source:
boolean reportResumedActivityLocked(ActivityRecord r){
  final ActivityStack stack=r.task.stack;
  if (isFrontStack(stack)) {
    mService.updateUsageStats(r,true);
    mService.setFocusedActivityLocked(r);
  }
  if (allResumedActivitiesComplete()) {
    ensureActivitiesVisibleLocked(null,0);
    mWindowManager.executeAppTransition();
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean reportResumedActivityLocked(ActivityRecord r){
  final ActivityStack stack=r.task.stack;
  if (isFrontStack(stack)) {
    mService.updateUsageStats(r,true);
  }
  if (allResumedActivitiesComplete()) {
    ensureActivitiesVisibleLocked(null,0);
    mWindowManager.executeAppTransition();
    return true;
  }
  return false;
}
Program: 1871
Project: 1871
Buggy source:
void findTaskToMoveToFrontLocked(int taskId,int flags,Bundle options){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    if (mStacks.get(stackNdx).findTaskToMoveToFrontLocked(taskId,flags,options)) {
      return;
    }
  }
}

Fixed version (ground truth):
void findTaskToMoveToFrontLocked(int taskId,int flags,Bundle options){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    if (mStacks.get(stackNdx).findTaskToMoveToFrontLocked(taskId,flags,options)) {
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + mStacks.get(stackNdx));
      return;
    }
  }
}
Program: 1872
Project: 1872
Buggy source:
public void removeTask(int taskId){
synchronized (mWindowMap) {
    Task task=mTaskIdToTask.get(taskId);
    if (task == null) {
      return;
    }
    final TaskStack stack=task.mStack;
    stack.removeTask(task);
    stack.getDisplayContent().layoutNeeded=true;
  }
}

Fixed version (ground truth):
public void removeTask(int taskId){
synchronized (mWindowMap) {
    Task task=mTaskIdToTask.get(taskId);
    if (task == null) {
      if (DEBUG_STACK)       Slog.i(TAG,"String_Node_Str" + taskId);
      return;
    }
    final TaskStack stack=task.mStack;
    stack.removeTask(task);
    stack.getDisplayContent().layoutNeeded=true;
  }
}
Program: 1874
Project: 1874
Buggy source:
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      stack.moveTaskToBackLocked(taskId,null);
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      stack.moveTaskToBackLocked(taskId,null);
      Binder.restoreCallingIdentity(origId);
    }
  }
}
Program: 1875
Project: 1875
Buggy source:
/** 
 * TODO: Add mController hook
 */
@Override public void moveTaskToFront(int task,int flags,Bundle options){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      ActivityOptions.abort(options);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    try {
      mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
    ActivityOptions.abort(options);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Add mController hook
 */
@Override public void moveTaskToFront(int task,int flags,Bundle options){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
  if (DEBUG_STACK)   Slog.d(TAG,"String_Node_Str" + task);
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      ActivityOptions.abort(options);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    try {
      mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
    ActivityOptions.abort(options);
  }
}
Program: 1876
Project: 1876
Buggy source:
@Override public void moveTaskToStack(int taskId,int stackId,boolean toTop){
  if (stackId == HOME_STACK_ID) {
    Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str",new RuntimeException("String_Node_Str").fillInStackTrace());
  }
synchronized (this) {
    mStackSupervisor.moveTaskToStack(taskId,stackId,toTop);
  }
}

Fixed version (ground truth):
@Override public void moveTaskToStack(int taskId,int stackId,boolean toTop){
  if (stackId == HOME_STACK_ID) {
    Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str",new RuntimeException("String_Node_Str").fillInStackTrace());
  }
synchronized (this) {
    if (DEBUG_STACK)     Slog.d(TAG,"String_Node_Str" + taskId + "String_Node_Str"+ stackId+ "String_Node_Str"+ toTop);
    mStackSupervisor.moveTaskToStack(taskId,stackId,toTop);
  }
}
Program: 1877
Project: 1877
Buggy source:
ActivityStack getCorrectStack(ActivityRecord r){
  if (r.isApplicationActivity() || (r.task != null && r.task.isApplicationTask())) {
    int stackNdx;
    for (stackNdx=mStacks.size() - 1; stackNdx > 0; --stackNdx) {
      if (mStacks.get(stackNdx).mCurrentUser == mCurrentUser) {
        break;
      }
    }
    if (stackNdx == 0) {
      int stackId=mService.createStack(-1,HOME_STACK_ID,StackBox.TASK_STACK_GOES_OVER,1.0f);
      mFocusedStack=getStack(stackId);
    }
    return mFocusedStack;
  }
  return mHomeStack;
}

Fixed version (ground truth):
ActivityStack getCorrectStack(ActivityRecord r){
  final TaskRecord task=r.task;
  if (r.isApplicationActivity() || (task != null && task.isApplicationTask())) {
    int stackNdx;
    for (stackNdx=mStacks.size() - 1; stackNdx > 0; --stackNdx) {
      if (mStacks.get(stackNdx).mCurrentUser == mCurrentUser) {
        break;
      }
    }
    if (stackNdx == 0) {
      int stackId=mService.createStack(-1,HOME_STACK_ID,StackBox.TASK_STACK_GOES_OVER,1.0f);
      mFocusedStack=getStack(stackId);
    }
    if (task != null) {
      mFocusedStack=task.stack;
    }
    return mFocusedStack;
  }
  return mHomeStack;
}
Program: 1879
Project: 1879
Buggy source:
boolean reportResumedActivityLocked(ActivityRecord r){
  final ActivityStack stack=r.task.stack;
  if (isFrontStack(stack)) {
    mService.updateUsageStats(r,true);
    mService.setFocusedActivityLocked(r);
  }
  if (allResumedActivitiesComplete()) {
    ensureActivitiesVisibleLocked(null,0);
    mWindowManager.executeAppTransition();
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean reportResumedActivityLocked(ActivityRecord r){
  final ActivityStack stack=r.task.stack;
  if (isFrontStack(stack)) {
    mService.updateUsageStats(r,true);
  }
  if (allResumedActivitiesComplete()) {
    ensureActivitiesVisibleLocked(null,0);
    mWindowManager.executeAppTransition();
    return true;
  }
  return false;
}
Program: 1880
Project: 1880
Buggy source:
void findTaskToMoveToFrontLocked(int taskId,int flags,Bundle options){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    if (mStacks.get(stackNdx).findTaskToMoveToFrontLocked(taskId,flags,options)) {
      return;
    }
  }
}

Fixed version (ground truth):
void findTaskToMoveToFrontLocked(int taskId,int flags,Bundle options){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    if (mStacks.get(stackNdx).findTaskToMoveToFrontLocked(taskId,flags,options)) {
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + mStacks.get(stackNdx));
      return;
    }
  }
}
Program: 1881
Project: 1881
Buggy source:
public void removeTask(int taskId){
synchronized (mWindowMap) {
    Task task=mTaskIdToTask.get(taskId);
    if (task == null) {
      return;
    }
    final TaskStack stack=task.mStack;
    stack.removeTask(task);
    stack.getDisplayContent().layoutNeeded=true;
  }
}

Fixed version (ground truth):
public void removeTask(int taskId){
synchronized (mWindowMap) {
    Task task=mTaskIdToTask.get(taskId);
    if (task == null) {
      if (DEBUG_STACK)       Slog.i(TAG,"String_Node_Str" + taskId);
      return;
    }
    final TaskStack stack=task.mStack;
    stack.removeTask(task);
    stack.getDisplayContent().layoutNeeded=true;
  }
}
Program: 1883
Project: 1883
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  final View child=getChildAt(0);
  final int childHeight=child.getMeasuredHeight();
  if (!hasLayout()) {
    final int scrollRange=Math.max(0,childHeight - (b - t - mPaddingBottom- mPaddingTop));
    if (mSavedState != null) {
      mScrollY=mSavedState.scrollPosition;
      mSavedState=null;
    }
    if (mScrollY > scrollRange) {
      mScrollY=scrollRange;
    }
 else     if (mScrollY < 0) {
      mScrollY=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  if (!hasLayout()) {
    if (mSavedState != null) {
      mScrollY=mSavedState.scrollPosition;
      mSavedState=null;
    }
    final int childHeight=(getChildCount() > 0) ? getChildAt(0).getMeasuredHeight() : 0;
    final int scrollRange=Math.max(0,childHeight - (b - t - mPaddingBottom- mPaddingTop));
    if (mScrollY > scrollRange) {
      mScrollY=scrollRange;
    }
 else     if (mScrollY < 0) {
      mScrollY=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}
Program: 1884
Project: 1884
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  final View child=getChildAt(0);
  final int childHeight=child.getMeasuredHeight();
  if (!hasLayout()) {
    final int scrollRange=Math.max(0,childHeight - (b - t - mPaddingBottom- mPaddingTop));
    if (mSavedState != null) {
      mScrollY=mSavedState.scrollPosition;
      mSavedState=null;
    }
    if (mScrollY > scrollRange) {
      mScrollY=scrollRange;
    }
 else     if (mScrollY < 0) {
      mScrollY=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  if (!hasLayout()) {
    if (mSavedState != null) {
      mScrollY=mSavedState.scrollPosition;
      mSavedState=null;
    }
    final int childHeight=(getChildCount() > 0) ? getChildAt(0).getMeasuredHeight() : 0;
    final int scrollRange=Math.max(0,childHeight - (b - t - mPaddingBottom- mPaddingTop));
    if (mScrollY > scrollRange) {
      mScrollY=scrollRange;
    }
 else     if (mScrollY < 0) {
      mScrollY=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}
Program: 1885
Project: 1885
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  final View child=getChildAt(0);
  final int childWidth=child.getMeasuredWidth();
  final LayoutParams childParams=(LayoutParams)child.getLayoutParams();
  final int available=r - l - getPaddingLeftWithForeground()- getPaddingRightWithForeground()- childParams.leftMargin- childParams.rightMargin;
  final boolean forceLeftGravity=(childWidth > available);
  layoutChildren(l,t,r,b,forceLeftGravity);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  if (!hasLayout()) {
    final int scrollRange=Math.max(0,childWidth - (r - l - mPaddingLeft- mPaddingRight));
    if (mSavedState != null) {
      if (isLayoutRtl() == mSavedState.isLayoutRtl) {
        mScrollX=mSavedState.scrollPosition;
      }
 else {
        mScrollX=scrollRange - mSavedState.scrollPosition;
      }
    }
 else {
      if (isLayoutRtl()) {
        mScrollX=scrollRange - mScrollX;
      }
    }
    if (mScrollX > scrollRange) {
      mScrollX=scrollRange;
    }
 else     if (mScrollX < 0) {
      mScrollX=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  final View child=getChildAt(0);
  final int childWidth=child.getMeasuredWidth();
  final LayoutParams childParams=(LayoutParams)child.getLayoutParams();
  final int available=r - l - getPaddingLeftWithForeground()- getPaddingRightWithForeground()- childParams.leftMargin- childParams.rightMargin;
  final boolean forceLeftGravity=(childWidth > available);
  layoutChildren(l,t,r,b,forceLeftGravity);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  if (!hasLayout()) {
    final int scrollRange=Math.max(0,childWidth - (r - l - mPaddingLeft- mPaddingRight));
    if (mSavedState != null) {
      if (isLayoutRtl() == mSavedState.isLayoutRtl) {
        mScrollX=mSavedState.scrollPosition;
      }
 else {
        mScrollX=scrollRange - mSavedState.scrollPosition;
      }
      mSavedState=null;
    }
 else {
      if (isLayoutRtl()) {
        mScrollX=scrollRange - mScrollX;
      }
    }
    if (mScrollX > scrollRange) {
      mScrollX=scrollRange;
    }
 else     if (mScrollX < 0) {
      mScrollX=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}
Program: 1886
Project: 1886
Buggy source:
private int getPaddingRightWithForeground(){
  return mForegroundInPadding ? Math.max(mPaddingRight,mForegroundPaddingRight) : mPaddingRight + mForegroundPaddingRight;
}

Fixed version (ground truth):
int getPaddingRightWithForeground(){
  return mForegroundInPadding ? Math.max(mPaddingRight,mForegroundPaddingRight) : mPaddingRight + mForegroundPaddingRight;
}
Program: 1887
Project: 1887
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  final int count=getChildCount();
  final int parentLeft=getPaddingLeftWithForeground();
  final int parentRight=right - left - getPaddingRightWithForeground();
  final int parentTop=getPaddingTopWithForeground();
  final int parentBottom=bottom - top - getPaddingBottomWithForeground();
  mForegroundBoundsChanged=true;
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      final int width=child.getMeasuredWidth();
      final int height=child.getMeasuredHeight();
      int childLeft;
      int childTop;
      int gravity=lp.gravity;
      if (gravity == -1) {
        gravity=DEFAULT_CHILD_GRAVITY;
      }
      final int layoutDirection=getLayoutDirection();
      final int absoluteGravity=Gravity.getAbsoluteGravity(gravity,layoutDirection);
      final int verticalGravity=gravity & Gravity.VERTICAL_GRAVITY_MASK;
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.LEFT:
        childLeft=parentLeft + lp.leftMargin;
      break;
case Gravity.CENTER_HORIZONTAL:
    childLeft=parentLeft + (parentRight - parentLeft - width) / 2 + lp.leftMargin - lp.rightMargin;
  break;
case Gravity.RIGHT:
childLeft=parentRight - width - lp.rightMargin;
break;
default :
childLeft=parentLeft + lp.leftMargin;
}
switch (verticalGravity) {
case Gravity.TOP:
childTop=parentTop + lp.topMargin;
break;
case Gravity.CENTER_VERTICAL:
childTop=parentTop + (parentBottom - parentTop - height) / 2 + lp.topMargin - lp.bottomMargin;
break;
case Gravity.BOTTOM:
childTop=parentBottom - height - lp.bottomMargin;
break;
default :
childTop=parentTop + lp.topMargin;
}
child.layout(childLeft,childTop,childLeft + width,childTop + height);
}
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  layoutChildren(left,top,right,bottom,false);
}
Program: 1888
Project: 1888
Buggy source:
private int getPaddingLeftWithForeground(){
  return mForegroundInPadding ? Math.max(mPaddingLeft,mForegroundPaddingLeft) : mPaddingLeft + mForegroundPaddingLeft;
}

Fixed version (ground truth):
int getPaddingLeftWithForeground(){
  return mForegroundInPadding ? Math.max(mPaddingLeft,mForegroundPaddingLeft) : mPaddingLeft + mForegroundPaddingLeft;
}
Program: 1889
Project: 1889
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  scrollTo(mScrollX,mScrollY);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  final View child=getChildAt(0);
  final int childWidth=child.getMeasuredWidth();
  final LayoutParams childParams=(LayoutParams)child.getLayoutParams();
  final int available=r - l - getPaddingLeftWithForeground()- getPaddingRightWithForeground()- childParams.leftMargin- childParams.rightMargin;
  final boolean forceLeftGravity=(childWidth > available);
  layoutChildren(l,t,r,b,forceLeftGravity);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  if (!hasLayout()) {
    final int scrollRange=Math.max(0,childWidth - (r - l - mPaddingLeft- mPaddingRight));
    if (mSavedState != null) {
      if (isLayoutRtl() == mSavedState.isLayoutRtl) {
        mScrollX=mSavedState.scrollPosition;
      }
 else {
        mScrollX=scrollRange - mSavedState.scrollPosition;
      }
    }
 else {
      if (isLayoutRtl()) {
        mScrollX=scrollRange - mScrollX;
      }
    }
    if (mScrollX > scrollRange) {
      mScrollX=scrollRange;
    }
 else     if (mScrollX < 0) {
      mScrollX=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}
Program: 1890
Project: 1890
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  final View child=getChildAt(0);
  final int childWidth=child.getMeasuredWidth();
  final LayoutParams childParams=(LayoutParams)child.getLayoutParams();
  final int available=r - l - getPaddingLeftWithForeground()- getPaddingRightWithForeground()- childParams.leftMargin- childParams.rightMargin;
  final boolean forceLeftGravity=(childWidth > available);
  layoutChildren(l,t,r,b,forceLeftGravity);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  if (!hasLayout()) {
    final int scrollRange=Math.max(0,childWidth - (r - l - mPaddingLeft- mPaddingRight));
    if (mSavedState != null) {
      if (isLayoutRtl() == mSavedState.isLayoutRtl) {
        mScrollX=mSavedState.scrollPosition;
      }
 else {
        mScrollX=scrollRange - mSavedState.scrollPosition;
      }
    }
 else {
      if (isLayoutRtl()) {
        mScrollX=scrollRange - mScrollX;
      }
    }
    if (mScrollX > scrollRange) {
      mScrollX=scrollRange;
    }
 else     if (mScrollX < 0) {
      mScrollX=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  final View child=getChildAt(0);
  final int childWidth=child.getMeasuredWidth();
  final LayoutParams childParams=(LayoutParams)child.getLayoutParams();
  final int available=r - l - getPaddingLeftWithForeground()- getPaddingRightWithForeground()- childParams.leftMargin- childParams.rightMargin;
  final boolean forceLeftGravity=(childWidth > available);
  layoutChildren(l,t,r,b,forceLeftGravity);
  mIsLayoutDirty=false;
  if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo,this)) {
    scrollToChild(mChildToScrollTo);
  }
  mChildToScrollTo=null;
  if (!hasLayout()) {
    final int scrollRange=Math.max(0,childWidth - (r - l - mPaddingLeft- mPaddingRight));
    if (mSavedState != null) {
      if (isLayoutRtl() == mSavedState.isLayoutRtl) {
        mScrollX=mSavedState.scrollPosition;
      }
 else {
        mScrollX=scrollRange - mSavedState.scrollPosition;
      }
      mSavedState=null;
    }
 else {
      if (isLayoutRtl()) {
        mScrollX=scrollRange - mScrollX;
      }
    }
    if (mScrollX > scrollRange) {
      mScrollX=scrollRange;
    }
 else     if (mScrollX < 0) {
      mScrollX=0;
    }
  }
  scrollTo(mScrollX,mScrollY);
}