nus-yam/ex-repair huggingface dataset:
Program: 190889
Project: 190889
Buggy source:
IBackupAgent bindToAgentSynchronous(ApplicationInfo app,int mode){
  IBackupAgent agent=null;
synchronized (mAgentConnectLock) {
    mConnecting=true;
    mConnectedAgent=null;
    try {
      if (mActivityManager.bindBackupAgent(app.packageName,mode,UserHandle.USER_OWNER)) {
        Slog.d(TAG,"String_Node_Str" + app);
        long timeoutMark=System.currentTimeMillis() + TIMEOUT_INTERVAL;
        while (mConnecting && mConnectedAgent == null && (System.currentTimeMillis() < timeoutMark)) {
          try {
            mAgentConnectLock.wait(5000);
          }
 catch (          InterruptedException e) {
            Slog.w(TAG,"String_Node_Str" + e);
            mActivityManager.clearPendingBackup();
            return null;
          }
        }
        if (mConnecting == true) {
          Slog.w(TAG,"String_Node_Str" + app);
          mActivityManager.clearPendingBackup();
          return null;
        }
        if (DEBUG)         Slog.i(TAG,"String_Node_Str" + mConnectedAgent);
        agent=mConnectedAgent;
      }
    }
 catch (    RemoteException e) {
    }
  }
  return agent;
}

Fixed version (ground truth):
IBackupAgent bindToAgentSynchronous(ApplicationInfo app,int mode){
  IBackupAgent agent=null;
synchronized (mAgentConnectLock) {
    mConnecting=true;
    mConnectedAgent=null;
    try {
      if (mActivityManager.bindBackupAgent(app.packageName,mode,UserHandle.USER_OWNER)) {
        Slog.d(TAG,"String_Node_Str" + app);
        long timeoutMark=System.currentTimeMillis() + TIMEOUT_INTERVAL;
        while (mConnecting && mConnectedAgent == null && (System.currentTimeMillis() < timeoutMark)) {
          try {
            mAgentConnectLock.wait(5000);
          }
 catch (          InterruptedException e) {
            Slog.w(TAG,"String_Node_Str" + e);
            mConnecting=false;
            mConnectedAgent=null;
          }
        }
        if (mConnecting == true) {
          Slog.w(TAG,"String_Node_Str" + app);
          mConnectedAgent=null;
        }
        if (DEBUG)         Slog.i(TAG,"String_Node_Str" + mConnectedAgent);
        agent=mConnectedAgent;
      }
    }
 catch (    RemoteException e) {
    }
  }
  if (agent == null) {
    try {
      mActivityManager.clearPendingBackup();
    }
 catch (    RemoteException e) {
    }
  }
  return agent;
}
Program: 190891
Project: 190891
Buggy source:
private static void performEmergencyCall(Context context){
  Intent intent=new Intent(Intent.ACTION_CALL_EMERGENCY);
  intent.setData(getPhoneUri(context));
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivity(intent);
}

Fixed version (ground truth):
private static void performEmergencyCall(Context context){
  Intent intent=new Intent(Intent.ACTION_CALL_EMERGENCY);
  intent.setData(getPhoneUri(context));
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivityAsUser(intent,UserHandle.CURRENT);
}
Program: 190892
Project: 190892
Buggy source:
/** 
 * {@hide} 
 */
private int getPhoneTypeFromNetworkType(int phoneId){
  String mode=getTelephonyProperty(phoneId,"String_Node_Str",null);
  if (mode != null) {
    return TelephonyManager.getPhoneType(Integer.parseInt(mode));
  }
  return TelephonyManager.PHONE_TYPE_NONE;
}

Fixed version (ground truth):
/** 
 * {@hide} 
 */
private int getPhoneTypeFromNetworkType(int phoneId){
  String mode=getTelephonyProperty(phoneId,"String_Node_Str",null);
  if (mode != null && !mode.isEmpty()) {
    return TelephonyManager.getPhoneType(Integer.parseInt(mode));
  }
  return TelephonyManager.PHONE_TYPE_NONE;
}
Program: 190893
Project: 190893
Buggy source:
/** 
 * {@hide} 
 */
private int getPhoneTypeFromProperty(int phoneId){
  String type=getTelephonyProperty(phoneId,TelephonyProperties.CURRENT_ACTIVE_PHONE,null);
  if (type == null || type.equals("String_Node_Str")) {
    return getPhoneTypeFromNetworkType(phoneId);
  }
  return Integer.parseInt(type);
}

Fixed version (ground truth):
/** 
 * {@hide} 
 */
private int getPhoneTypeFromProperty(int phoneId){
  String type=getTelephonyProperty(phoneId,TelephonyProperties.CURRENT_ACTIVE_PHONE,null);
  if (type == null || type.isEmpty()) {
    return getPhoneTypeFromNetworkType(phoneId);
  }
  return Integer.parseInt(type);
}
Program: 190894
Project: 190894
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  setTheme(R.style.systemui_theme);
  SystemUIFactory.createFromConfig(this);
  if (Process.myUserHandle().equals(UserHandle.SYSTEM)) {
    IntentFilter filter=new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
    filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
    registerReceiver(new BroadcastReceiver(){
      @Override public void onReceive(      Context context,      Intent intent){
        if (mBootCompleted)         return;
        if (DEBUG)         Log.v(TAG,"String_Node_Str");
        unregisterReceiver(this);
        mBootCompleted=true;
        if (mServicesStarted) {
          final int N=mServices.length;
          for (int i=0; i < N; i++) {
            mServices[i].onBootCompleted();
          }
        }
      }
    }
,filter);
  }
 else {
    startServicesIfNeeded(SERVICES_PER_USER);
  }
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  setTheme(R.style.systemui_theme);
  SystemUIFactory.createFromConfig(this);
  if (Process.myUserHandle().equals(UserHandle.SYSTEM)) {
    IntentFilter filter=new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
    filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
    registerReceiver(new BroadcastReceiver(){
      @Override public void onReceive(      Context context,      Intent intent){
        if (mBootCompleted)         return;
        if (DEBUG)         Log.v(TAG,"String_Node_Str");
        unregisterReceiver(this);
        mBootCompleted=true;
        if (mServicesStarted) {
          final int N=mServices.length;
          for (int i=0; i < N; i++) {
            mServices[i].onBootCompleted();
          }
        }
      }
    }
,filter);
  }
 else {
    String processName=ActivityThread.currentProcessName();
    ApplicationInfo info=getApplicationInfo();
    if (processName != null && processName.startsWith(info.processName + "String_Node_Str")) {
      return;
    }
    startServicesIfNeeded(SERVICES_PER_USER);
  }
}
Program: 190895
Project: 190895
Buggy source:
private static void performEmergencyCall(Context context){
  Intent intent=new Intent(Intent.ACTION_CALL_EMERGENCY);
  intent.setData(getPhoneUri(context));
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivity(intent);
}

Fixed version (ground truth):
private static void performEmergencyCall(Context context){
  Intent intent=new Intent(Intent.ACTION_CALL_EMERGENCY);
  intent.setData(getPhoneUri(context));
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivityAsUser(intent,UserHandle.CURRENT);
}
Program: 190896
Project: 190896
Buggy source:
/** 
 * Filter extras to only basic types.
 * @hide
 */
public void removeUnsafeExtras(){
  if (mExtras != null) {
    mExtras.filterValues();
  }
}

Fixed version (ground truth):
/** 
 * Filter extras to only basic types.
 * @hide
 */
public void removeUnsafeExtras(){
  if (mExtras != null) {
    mExtras=mExtras.filterValues();
  }
}
Program: 190897
Project: 190897
Buggy source:
/** 
 * Filter values in Bundle to only basic types.
 * @hide
 */
public void filterValues(){
  unparcel();
  if (mMap != null) {
    for (int i=mMap.size() - 1; i >= 0; i--) {
      Object value=mMap.valueAt(i);
      if (PersistableBundle.isValidType(value)) {
        continue;
      }
      if (value instanceof Bundle) {
        ((Bundle)value).filterValues();
      }
      if (value.getClass().getName().startsWith("String_Node_Str")) {
        continue;
      }
      mMap.removeAt(i);
    }
  }
  mFlags|=FLAG_HAS_FDS_KNOWN;
  mFlags&=~FLAG_HAS_FDS;
}

Fixed version (ground truth):
/** 
 * Filter values in Bundle to only basic types.
 * @hide
 */
public Bundle filterValues(){
  unparcel();
  Bundle bundle=this;
  if (mMap != null) {
    ArrayMap<String,Object> map=mMap;
    for (int i=map.size() - 1; i >= 0; i--) {
      Object value=map.valueAt(i);
      if (PersistableBundle.isValidType(value)) {
        continue;
      }
      if (value instanceof Bundle) {
        Bundle newBundle=((Bundle)value).filterValues();
        if (newBundle != value) {
          if (map == mMap) {
            bundle=new Bundle(this);
            map=bundle.mMap;
          }
          map.setValueAt(i,newBundle);
        }
        continue;
      }
      if (value.getClass().getName().startsWith("String_Node_Str")) {
        continue;
      }
      if (map == mMap) {
        bundle=new Bundle(this);
        map=bundle.mMap;
      }
      map.removeAt(i);
    }
  }
  mFlags|=FLAG_HAS_FDS_KNOWN;
  mFlags&=~FLAG_HAS_FDS;
  return bundle;
}
Program: 190898
Project: 190898
Buggy source:
/** 
 * Filter extras to only basic types.
 * @hide
 */
public void removeUnsafeExtras(){
  if (mExtras != null) {
    mExtras.filterValues();
  }
}

Fixed version (ground truth):
/** 
 * Filter extras to only basic types.
 * @hide
 */
public void removeUnsafeExtras(){
  if (mExtras != null) {
    mExtras=mExtras.filterValues();
  }
}
Program: 190899
Project: 190899
Buggy source:
/** 
 * Filter values in Bundle to only basic types.
 * @hide
 */
public void filterValues(){
  unparcel();
  if (mMap != null) {
    for (int i=mMap.size() - 1; i >= 0; i--) {
      Object value=mMap.valueAt(i);
      if (PersistableBundle.isValidType(value)) {
        continue;
      }
      if (value instanceof Bundle) {
        ((Bundle)value).filterValues();
      }
      if (value.getClass().getName().startsWith("String_Node_Str")) {
        continue;
      }
      mMap.removeAt(i);
    }
  }
  mFlags|=FLAG_HAS_FDS_KNOWN;
  mFlags&=~FLAG_HAS_FDS;
}

Fixed version (ground truth):
/** 
 * Filter values in Bundle to only basic types.
 * @hide
 */
public Bundle filterValues(){
  unparcel();
  Bundle bundle=this;
  if (mMap != null) {
    ArrayMap<String,Object> map=mMap;
    for (int i=map.size() - 1; i >= 0; i--) {
      Object value=map.valueAt(i);
      if (PersistableBundle.isValidType(value)) {
        continue;
      }
      if (value instanceof Bundle) {
        Bundle newBundle=((Bundle)value).filterValues();
        if (newBundle != value) {
          if (map == mMap) {
            bundle=new Bundle(this);
            map=bundle.mMap;
          }
          map.setValueAt(i,newBundle);
        }
        continue;
      }
      if (value.getClass().getName().startsWith("String_Node_Str")) {
        continue;
      }
      if (map == mMap) {
        bundle=new Bundle(this);
        map=bundle.mMap;
      }
      map.removeAt(i);
    }
  }
  mFlags|=FLAG_HAS_FDS_KNOWN;
  mFlags&=~FLAG_HAS_FDS;
  return bundle;
}
Program: 190900
Project: 190900
Buggy source:
@Override public int getMaxExpandHeight(ExpandableView view){
  int maxContentHeight=view.getMaxContentHeight();
  if (view.isSummaryWithChildren()) {
    mGroupExpandedForMeasure=true;
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    row.setForceUnlocked(true);
    mAmbientState.setLayoutHeight(mMaxLayoutHeight);
    mStackScrollAlgorithm.getStackScrollState(mAmbientState,mCurrentStackScrollState);
    mAmbientState.setLayoutHeight(getLayoutHeight());
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    mGroupExpandedForMeasure=false;
    row.setForceUnlocked(false);
    int height=mCurrentStackScrollState.getViewStateForView(view).height;
    return Math.min(height,maxContentHeight);
  }
  return maxContentHeight;
}

Fixed version (ground truth):
@Override public int getMaxExpandHeight(ExpandableView view){
  int maxContentHeight=view.getMaxContentHeight();
  if (view.isSummaryWithChildren() && view.getParent() == this) {
    mGroupExpandedForMeasure=true;
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    row.setForceUnlocked(true);
    mAmbientState.setLayoutHeight(mMaxLayoutHeight);
    mStackScrollAlgorithm.getStackScrollState(mAmbientState,mCurrentStackScrollState);
    mAmbientState.setLayoutHeight(getLayoutHeight());
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    mGroupExpandedForMeasure=false;
    row.setForceUnlocked(false);
    StackViewState viewState=mCurrentStackScrollState.getViewStateForView(view);
    if (viewState != null) {
      return Math.min(viewState.height,maxContentHeight);
    }
  }
  return maxContentHeight;
}
Program: 190901
Project: 190901
Buggy source:
private void updateEmergencyAffordanceNeeded(){
synchronized (mLock) {
    mEmergencyAffordanceNeeded=mSimNeedsEmergencyAffordance || mNetworkNeedsEmergencyAffordance;
    Settings.Global.putInt(mContext.getContentResolver(),Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,mEmergencyAffordanceNeeded ? 1 : 0);
    if (mEmergencyAffordanceNeeded) {
      stopScanning();
    }
  }
}

Fixed version (ground truth):
private void updateEmergencyAffordanceNeeded(){
synchronized (mLock) {
    mEmergencyAffordanceNeeded=mVoiceCapable && (mSimNeedsEmergencyAffordance || mNetworkNeedsEmergencyAffordance);
    Settings.Global.putInt(mContext.getContentResolver(),Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,mEmergencyAffordanceNeeded ? 1 : 0);
    if (mEmergencyAffordanceNeeded) {
      stopScanning();
    }
  }
}
Program: 190902
Project: 190902
Buggy source:
@Override public void onBootPhase(int phase){
  if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
    mTelephonyManager=mContext.getSystemService(TelephonyManager.class);
    mSubscriptionManager=SubscriptionManager.from(mContext);
    HandlerThread thread=new HandlerThread(TAG);
    thread.start();
    mHandler=new MyHandler(thread.getLooper());
    mHandler.obtainMessage(INITIALIZE_STATE).sendToTarget();
    startScanning();
    IntentFilter filter=new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    mContext.registerReceiver(mAirplaneModeReceiver,filter);
    mSubscriptionManager.addOnSubscriptionsChangedListener(mSubscriptionChangedListener);
  }
}

Fixed version (ground truth):
@Override public void onBootPhase(int phase){
  if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
    mTelephonyManager=mContext.getSystemService(TelephonyManager.class);
    mVoiceCapable=mTelephonyManager.isVoiceCapable();
    if (!mVoiceCapable) {
      updateEmergencyAffordanceNeeded();
      return;
    }
    mSubscriptionManager=SubscriptionManager.from(mContext);
    HandlerThread thread=new HandlerThread(TAG);
    thread.start();
    mHandler=new MyHandler(thread.getLooper());
    mHandler.obtainMessage(INITIALIZE_STATE).sendToTarget();
    startScanning();
    IntentFilter filter=new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    mContext.registerReceiver(mAirplaneModeReceiver,filter);
    mSubscriptionManager.addOnSubscriptionsChangedListener(mSubscriptionChangedListener);
  }
}
Program: 190903
Project: 190903
Buggy source:
/** 
 * Confirm passkey for   {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing.<p>Requires  {@link android.Manifest.permission#BLUETOOTH_ADMIN}.
 * @return true confirmation has been sent outfalse for error
 */
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public boolean setPairingConfirmation(boolean confirm){
  if (sService == null) {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  try {
    return sService.setPairingConfirmation(this,confirm);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Confirm passkey for   {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing.<p>Requires  {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}.
 * @return true confirmation has been sent outfalse for error
 */
@RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setPairingConfirmation(boolean confirm){
  if (sService == null) {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  try {
    return sService.setPairingConfirmation(this,confirm);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
  return false;
}
Program: 190904
Project: 190904
Buggy source:
@Override public int getMaxExpandHeight(ExpandableView view){
  int maxContentHeight=view.getMaxContentHeight();
  if (view.isSummaryWithChildren()) {
    mGroupExpandedForMeasure=true;
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    row.setForceUnlocked(true);
    mAmbientState.setLayoutHeight(mMaxLayoutHeight);
    mStackScrollAlgorithm.getStackScrollState(mAmbientState,mCurrentStackScrollState);
    mAmbientState.setLayoutHeight(getLayoutHeight());
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    mGroupExpandedForMeasure=false;
    row.setForceUnlocked(false);
    int height=mCurrentStackScrollState.getViewStateForView(view).height;
    return Math.min(height,maxContentHeight);
  }
  return maxContentHeight;
}

Fixed version (ground truth):
@Override public int getMaxExpandHeight(ExpandableView view){
  int maxContentHeight=view.getMaxContentHeight();
  if (view.isSummaryWithChildren() && view.getParent() == this) {
    mGroupExpandedForMeasure=true;
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    row.setForceUnlocked(true);
    mAmbientState.setLayoutHeight(mMaxLayoutHeight);
    mStackScrollAlgorithm.getStackScrollState(mAmbientState,mCurrentStackScrollState);
    mAmbientState.setLayoutHeight(getLayoutHeight());
    mGroupManager.toggleGroupExpansion(row.getStatusBarNotification());
    mGroupExpandedForMeasure=false;
    row.setForceUnlocked(false);
    StackViewState viewState=mCurrentStackScrollState.getViewStateForView(view);
    if (viewState != null) {
      return Math.min(viewState.height,maxContentHeight);
    }
  }
  return maxContentHeight;
}
Program: 190905
Project: 190905
Buggy source:
private void updateEmergencyAffordanceNeeded(){
synchronized (mLock) {
    mEmergencyAffordanceNeeded=mSimNeedsEmergencyAffordance || mNetworkNeedsEmergencyAffordance;
    Settings.Global.putInt(mContext.getContentResolver(),Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,mEmergencyAffordanceNeeded ? 1 : 0);
    if (mEmergencyAffordanceNeeded) {
      stopScanning();
    }
  }
}

Fixed version (ground truth):
private void updateEmergencyAffordanceNeeded(){
synchronized (mLock) {
    mEmergencyAffordanceNeeded=mVoiceCapable && (mSimNeedsEmergencyAffordance || mNetworkNeedsEmergencyAffordance);
    Settings.Global.putInt(mContext.getContentResolver(),Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,mEmergencyAffordanceNeeded ? 1 : 0);
    if (mEmergencyAffordanceNeeded) {
      stopScanning();
    }
  }
}
Program: 190906
Project: 190906
Buggy source:
@Override public void onBootPhase(int phase){
  if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
    mTelephonyManager=mContext.getSystemService(TelephonyManager.class);
    mSubscriptionManager=SubscriptionManager.from(mContext);
    HandlerThread thread=new HandlerThread(TAG);
    thread.start();
    mHandler=new MyHandler(thread.getLooper());
    mHandler.obtainMessage(INITIALIZE_STATE).sendToTarget();
    startScanning();
    IntentFilter filter=new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    mContext.registerReceiver(mAirplaneModeReceiver,filter);
    mSubscriptionManager.addOnSubscriptionsChangedListener(mSubscriptionChangedListener);
  }
}

Fixed version (ground truth):
@Override public void onBootPhase(int phase){
  if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
    mTelephonyManager=mContext.getSystemService(TelephonyManager.class);
    mVoiceCapable=mTelephonyManager.isVoiceCapable();
    if (!mVoiceCapable) {
      updateEmergencyAffordanceNeeded();
      return;
    }
    mSubscriptionManager=SubscriptionManager.from(mContext);
    HandlerThread thread=new HandlerThread(TAG);
    thread.start();
    mHandler=new MyHandler(thread.getLooper());
    mHandler.obtainMessage(INITIALIZE_STATE).sendToTarget();
    startScanning();
    IntentFilter filter=new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    mContext.registerReceiver(mAirplaneModeReceiver,filter);
    mSubscriptionManager.addOnSubscriptionsChangedListener(mSubscriptionChangedListener);
  }
}
Program: 190907
Project: 190907
Buggy source:
public void setBarState(int statusBarState,boolean keyguardFadingAway,boolean goingToFullShade){
  int oldState=mStatusBarState;
  boolean keyguardShowing=statusBarState == StatusBarState.KEYGUARD;
  setKeyguardStatusViewVisibility(statusBarState,keyguardFadingAway,goingToFullShade);
  setKeyguardBottomAreaVisibility(statusBarState,goingToFullShade);
  mStatusBarState=statusBarState;
  mKeyguardShowing=keyguardShowing;
  mQsContainer.setKeyguardShowing(mKeyguardShowing);
  if (goingToFullShade || (oldState == StatusBarState.KEYGUARD && statusBarState == StatusBarState.SHADE_LOCKED)) {
    animateKeyguardStatusBarOut();
    long delay=mStatusBarState == StatusBarState.SHADE_LOCKED ? 0 : mStatusBar.calculateGoingToFullShadeDelay();
    mQsContainer.animateHeaderSlidingIn(delay);
  }
 else   if (oldState == StatusBarState.SHADE_LOCKED && statusBarState == StatusBarState.KEYGUARD) {
    animateKeyguardStatusBarIn(StackStateAnimator.ANIMATION_DURATION_STANDARD);
    mQsContainer.animateHeaderSlidingOut();
  }
 else {
    mKeyguardStatusBar.setAlpha(1f);
    mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
    if (keyguardShowing && oldState != mStatusBarState) {
      mKeyguardBottomArea.onKeyguardShowingChanged();
    }
  }
  if (keyguardShowing) {
    updateDozingVisibilities(false);
  }
  resetVerticalPanelPosition();
  updateQsState();
}

Fixed version (ground truth):
public void setBarState(int statusBarState,boolean keyguardFadingAway,boolean goingToFullShade){
  int oldState=mStatusBarState;
  boolean keyguardShowing=statusBarState == StatusBarState.KEYGUARD;
  setKeyguardStatusViewVisibility(statusBarState,keyguardFadingAway,goingToFullShade);
  setKeyguardBottomAreaVisibility(statusBarState,goingToFullShade);
  mStatusBarState=statusBarState;
  mKeyguardShowing=keyguardShowing;
  mQsContainer.setKeyguardShowing(mKeyguardShowing);
  if (oldState == StatusBarState.KEYGUARD && (goingToFullShade || statusBarState == StatusBarState.SHADE_LOCKED)) {
    animateKeyguardStatusBarOut();
    long delay=mStatusBarState == StatusBarState.SHADE_LOCKED ? 0 : mStatusBar.calculateGoingToFullShadeDelay();
    mQsContainer.animateHeaderSlidingIn(delay);
  }
 else   if (oldState == StatusBarState.SHADE_LOCKED && statusBarState == StatusBarState.KEYGUARD) {
    animateKeyguardStatusBarIn(StackStateAnimator.ANIMATION_DURATION_STANDARD);
    mQsContainer.animateHeaderSlidingOut();
  }
 else {
    mKeyguardStatusBar.setAlpha(1f);
    mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
    if (keyguardShowing && oldState != mStatusBarState) {
      mKeyguardBottomArea.onKeyguardShowingChanged();
      mQsContainer.hideImmediately();
    }
  }
  if (keyguardShowing) {
    updateDozingVisibilities(false);
  }
  resetVerticalPanelPosition();
  updateQsState();
}
Program: 190910
Project: 190910
Buggy source:
public void setBarState(int statusBarState,boolean keyguardFadingAway,boolean goingToFullShade){
  int oldState=mStatusBarState;
  boolean keyguardShowing=statusBarState == StatusBarState.KEYGUARD;
  setKeyguardStatusViewVisibility(statusBarState,keyguardFadingAway,goingToFullShade);
  setKeyguardBottomAreaVisibility(statusBarState,goingToFullShade);
  mStatusBarState=statusBarState;
  mKeyguardShowing=keyguardShowing;
  mQsContainer.setKeyguardShowing(mKeyguardShowing);
  if (goingToFullShade || (oldState == StatusBarState.KEYGUARD && statusBarState == StatusBarState.SHADE_LOCKED)) {
    animateKeyguardStatusBarOut();
    long delay=mStatusBarState == StatusBarState.SHADE_LOCKED ? 0 : mStatusBar.calculateGoingToFullShadeDelay();
    mQsContainer.animateHeaderSlidingIn(delay);
  }
 else   if (oldState == StatusBarState.SHADE_LOCKED && statusBarState == StatusBarState.KEYGUARD) {
    animateKeyguardStatusBarIn(StackStateAnimator.ANIMATION_DURATION_STANDARD);
    mQsContainer.animateHeaderSlidingOut();
  }
 else {
    mKeyguardStatusBar.setAlpha(1f);
    mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
    if (keyguardShowing && oldState != mStatusBarState) {
      mKeyguardBottomArea.onKeyguardShowingChanged();
    }
  }
  if (keyguardShowing) {
    updateDozingVisibilities(false);
  }
  resetVerticalPanelPosition();
  updateQsState();
}

Fixed version (ground truth):
public void setBarState(int statusBarState,boolean keyguardFadingAway,boolean goingToFullShade){
  int oldState=mStatusBarState;
  boolean keyguardShowing=statusBarState == StatusBarState.KEYGUARD;
  setKeyguardStatusViewVisibility(statusBarState,keyguardFadingAway,goingToFullShade);
  setKeyguardBottomAreaVisibility(statusBarState,goingToFullShade);
  mStatusBarState=statusBarState;
  mKeyguardShowing=keyguardShowing;
  mQsContainer.setKeyguardShowing(mKeyguardShowing);
  if (oldState == StatusBarState.KEYGUARD && (goingToFullShade || statusBarState == StatusBarState.SHADE_LOCKED)) {
    animateKeyguardStatusBarOut();
    long delay=mStatusBarState == StatusBarState.SHADE_LOCKED ? 0 : mStatusBar.calculateGoingToFullShadeDelay();
    mQsContainer.animateHeaderSlidingIn(delay);
  }
 else   if (oldState == StatusBarState.SHADE_LOCKED && statusBarState == StatusBarState.KEYGUARD) {
    animateKeyguardStatusBarIn(StackStateAnimator.ANIMATION_DURATION_STANDARD);
    mQsContainer.animateHeaderSlidingOut();
  }
 else {
    mKeyguardStatusBar.setAlpha(1f);
    mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
    if (keyguardShowing && oldState != mStatusBarState) {
      mKeyguardBottomArea.onKeyguardShowingChanged();
      mQsContainer.hideImmediately();
    }
  }
  if (keyguardShowing) {
    updateDozingVisibilities(false);
  }
  resetVerticalPanelPosition();
  updateQsState();
}
Program: 190914
Project: 190914
Buggy source:
private void updateScrollability(){
  boolean scrollable=getScrollRange() > 0;
  if (scrollable != mScrollable) {
    mScrollable=scrollable;
    setFocusable(scrollable);
  }
}

Fixed version (ground truth):
private void updateScrollability(){
  boolean scrollable=getScrollRange() > 0;
  if (scrollable != mScrollable) {
    mScrollable=scrollable;
    setFocusable(scrollable);
    updateForwardAndBackwardScrollability();
  }
}
Program: 190915
Project: 190915
Buggy source:
private void updateForcedScroll(){
  if (mForcedScroll != null && (!mForcedScroll.hasFocus() || !mForcedScroll.isAttachedToWindow())) {
    mForcedScroll=null;
  }
  if (mForcedScroll != null) {
    ExpandableView expandableView=(ExpandableView)mForcedScroll;
    int positionInLinearLayout=getPositionInLinearLayout(expandableView);
    int targetScroll=targetScrollForView(expandableView,positionInLinearLayout);
    int outOfViewScroll=positionInLinearLayout + expandableView.getIntrinsicHeight();
    targetScroll=Math.max(0,Math.min(targetScroll,getScrollRange()));
    if (mOwnScrollY < targetScroll || outOfViewScroll < mOwnScrollY) {
      mOwnScrollY=targetScroll;
    }
  }
}

Fixed version (ground truth):
private void updateForcedScroll(){
  if (mForcedScroll != null && (!mForcedScroll.hasFocus() || !mForcedScroll.isAttachedToWindow())) {
    mForcedScroll=null;
  }
  if (mForcedScroll != null) {
    ExpandableView expandableView=(ExpandableView)mForcedScroll;
    int positionInLinearLayout=getPositionInLinearLayout(expandableView);
    int targetScroll=targetScrollForView(expandableView,positionInLinearLayout);
    int outOfViewScroll=positionInLinearLayout + expandableView.getIntrinsicHeight();
    targetScroll=Math.max(0,Math.min(targetScroll,getScrollRange()));
    if (mOwnScrollY < targetScroll || outOfViewScroll < mOwnScrollY) {
      setOwnScrollY(targetScroll);
    }
  }
}
Program: 190916
Project: 190916
Buggy source:
/** 
 * Perform a scroll downward and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll downwards, has to be negative.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollDown(int deltaY){
  deltaY=Math.min(deltaY,0);
  float currentBottomAmount=getCurrentOverScrollAmount(false);
  float newBottomAmount=currentBottomAmount + deltaY;
  if (currentBottomAmount > 0) {
    setOverScrollAmount(newBottomAmount,false,false);
  }
  float scrollAmount=newBottomAmount < 0 ? newBottomAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY < 0) {
    float currentTopPixels=getCurrentOverScrolledPixels(true);
    setOverScrolledPixels(currentTopPixels - newScrollY,true,false);
    mOwnScrollY=0;
    scrollAmount=0.0f;
  }
  return scrollAmount;
}

Fixed version (ground truth):
/** 
 * Perform a scroll downward and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll downwards, has to be negative.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollDown(int deltaY){
  deltaY=Math.min(deltaY,0);
  float currentBottomAmount=getCurrentOverScrollAmount(false);
  float newBottomAmount=currentBottomAmount + deltaY;
  if (currentBottomAmount > 0) {
    setOverScrollAmount(newBottomAmount,false,false);
  }
  float scrollAmount=newBottomAmount < 0 ? newBottomAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY < 0) {
    float currentTopPixels=getCurrentOverScrolledPixels(true);
    setOverScrolledPixels(currentTopPixels - newScrollY,true,false);
    setOwnScrollY(0);
    scrollAmount=0.0f;
  }
  return scrollAmount;
}
Program: 190917
Project: 190917
Buggy source:
private void updateScrollStateForAddedChildren(){
  if (mChildrenToAddAnimated.isEmpty()) {
    return;
  }
  for (int i=0; i < getChildCount(); i++) {
    ExpandableView child=(ExpandableView)getChildAt(i);
    if (mChildrenToAddAnimated.contains(child)) {
      int startingPosition=getPositionInLinearLayout(child);
      int padding=child.getIncreasedPaddingAmount() == 1.0f ? mIncreasedPaddingBetweenElements : mPaddingBetweenElements;
      int childHeight=getIntrinsicHeight(child) + padding;
      if (startingPosition < mOwnScrollY) {
        mOwnScrollY+=childHeight;
      }
    }
  }
  clampScrollPosition();
}

Fixed version (ground truth):
private void updateScrollStateForAddedChildren(){
  if (mChildrenToAddAnimated.isEmpty()) {
    return;
  }
  for (int i=0; i < getChildCount(); i++) {
    ExpandableView child=(ExpandableView)getChildAt(i);
    if (mChildrenToAddAnimated.contains(child)) {
      int startingPosition=getPositionInLinearLayout(child);
      int padding=child.getIncreasedPaddingAmount() == 1.0f ? mIncreasedPaddingBetweenElements : mPaddingBetweenElements;
      int childHeight=getIntrinsicHeight(child) + padding;
      if (startingPosition < mOwnScrollY) {
        setOwnScrollY(mOwnScrollY + childHeight);
      }
    }
  }
  clampScrollPosition();
}
Program: 190918
Project: 190918
Buggy source:
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(ExpandableView removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int padding=(int)NotificationUtils.interpolate(mPaddingBetweenElements,mIncreasedPaddingBetweenElements,removedChild.getIncreasedPaddingAmount());
  int childHeight=getIntrinsicHeight(removedChild) + padding;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    mOwnScrollY-=childHeight;
  }
 else   if (startingPosition < mOwnScrollY) {
    mOwnScrollY=startingPosition;
  }
}

Fixed version (ground truth):
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(ExpandableView removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int padding=(int)NotificationUtils.interpolate(mPaddingBetweenElements,mIncreasedPaddingBetweenElements,removedChild.getIncreasedPaddingAmount());
  int childHeight=getIntrinsicHeight(removedChild) + padding;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    setOwnScrollY(mOwnScrollY - childHeight);
  }
 else   if (startingPosition < mOwnScrollY) {
    setOwnScrollY(startingPosition);
  }
}
Program: 190919
Project: 190919
Buggy source:
/** 
 * Fling the scroll view
 * @param velocityY The initial velocity in the Y direction. Positivenumbers mean that the finger/cursor is moving down the screen, which means we want to scroll towards the top.
 */
private void fling(int velocityY){
  if (getChildCount() > 0) {
    int scrollRange=getScrollRange();
    float topAmount=getCurrentOverScrollAmount(true);
    float bottomAmount=getCurrentOverScrollAmount(false);
    if (velocityY < 0 && topAmount > 0) {
      mOwnScrollY-=(int)topAmount;
      mDontReportNextOverScroll=true;
      setOverScrollAmount(0,true,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(true) * mOverflingDistance + topAmount;
    }
 else     if (velocityY > 0 && bottomAmount > 0) {
      mOwnScrollY+=bottomAmount;
      setOverScrollAmount(0,false,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(false) * mOverflingDistance + bottomAmount;
    }
 else {
      mMaxOverScroll=0.0f;
    }
    int minScrollY=Math.max(0,scrollRange);
    if (mExpandedInThisMotion) {
      minScrollY=Math.min(minScrollY,mMaxScrollAfterExpand);
    }
    mScroller.fling(mScrollX,mOwnScrollY,1,velocityY,0,0,0,minScrollY,0,mExpandedInThisMotion && mOwnScrollY >= 0 ? 0 : Integer.MAX_VALUE / 2);
    postInvalidateOnAnimation();
  }
}

Fixed version (ground truth):
/** 
 * Fling the scroll view
 * @param velocityY The initial velocity in the Y direction. Positivenumbers mean that the finger/cursor is moving down the screen, which means we want to scroll towards the top.
 */
private void fling(int velocityY){
  if (getChildCount() > 0) {
    int scrollRange=getScrollRange();
    float topAmount=getCurrentOverScrollAmount(true);
    float bottomAmount=getCurrentOverScrollAmount(false);
    if (velocityY < 0 && topAmount > 0) {
      setOwnScrollY(mOwnScrollY - (int)topAmount);
      mDontReportNextOverScroll=true;
      setOverScrollAmount(0,true,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(true) * mOverflingDistance + topAmount;
    }
 else     if (velocityY > 0 && bottomAmount > 0) {
      setOwnScrollY((int)(mOwnScrollY + bottomAmount));
      setOverScrollAmount(0,false,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(false) * mOverflingDistance + bottomAmount;
    }
 else {
      mMaxOverScroll=0.0f;
    }
    int minScrollY=Math.max(0,scrollRange);
    if (mExpandedInThisMotion) {
      minScrollY=Math.min(minScrollY,mMaxScrollAfterExpand);
    }
    mScroller.fling(mScrollX,mOwnScrollY,1,velocityY,0,0,0,minScrollY,0,mExpandedInThisMotion && mOwnScrollY >= 0 ? 0 : Integer.MAX_VALUE / 2);
    postInvalidateOnAnimation();
  }
}
Program: 190920
Project: 190920
Buggy source:
public void onExpansionStopped(){
  mIsExpansionChanging=false;
  if (!mIsExpanded) {
    mOwnScrollY=0;
    mPhoneStatusBar.resetUserExpandedStates();
    clearTemporaryViews(this);
    for (int i=0; i < getChildCount(); i++) {
      ExpandableView child=(ExpandableView)getChildAt(i);
      if (child instanceof ExpandableNotificationRow) {
        ExpandableNotificationRow row=(ExpandableNotificationRow)child;
        clearTemporaryViews(row.getChildrenContainer());
      }
    }
  }
}

Fixed version (ground truth):
public void onExpansionStopped(){
  mIsExpansionChanging=false;
  if (!mIsExpanded) {
    setOwnScrollY(0);
    mPhoneStatusBar.resetUserExpandedStates();
    clearTemporaryViews(this);
    for (int i=0; i < getChildCount(); i++) {
      ExpandableView child=(ExpandableView)getChildAt(i);
      if (child instanceof ExpandableNotificationRow) {
        ExpandableNotificationRow row=(ExpandableNotificationRow)child;
        clearTemporaryViews(row.getChildrenContainer());
      }
    }
  }
}
Program: 190921
Project: 190921
Buggy source:
@Override protected void onOverScrolled(int scrollX,int scrollY,boolean clampedX,boolean clampedY){
  if (!mScroller.isFinished()) {
    final int oldX=mScrollX;
    final int oldY=mOwnScrollY;
    mScrollX=scrollX;
    mOwnScrollY=scrollY;
    if (clampedY) {
      springBack();
    }
 else {
      onScrollChanged(mScrollX,mOwnScrollY,oldX,oldY);
      invalidateParentIfNeeded();
      updateChildren();
      float overScrollTop=getCurrentOverScrollAmount(true);
      if (mOwnScrollY < 0) {
        notifyOverscrollTopListener(-mOwnScrollY,isRubberbanded(true));
      }
 else {
        notifyOverscrollTopListener(overScrollTop,isRubberbanded(true));
      }
    }
  }
 else {
    customScrollTo(scrollY);
    scrollTo(scrollX,mScrollY);
  }
}

Fixed version (ground truth):
@Override protected void onOverScrolled(int scrollX,int scrollY,boolean clampedX,boolean clampedY){
  if (!mScroller.isFinished()) {
    final int oldX=mScrollX;
    final int oldY=mOwnScrollY;
    mScrollX=scrollX;
    setOwnScrollY(scrollY);
    if (clampedY) {
      springBack();
    }
 else {
      onScrollChanged(mScrollX,mOwnScrollY,oldX,oldY);
      invalidateParentIfNeeded();
      updateChildren();
      float overScrollTop=getCurrentOverScrollAmount(true);
      if (mOwnScrollY < 0) {
        notifyOverscrollTopListener(-mOwnScrollY,isRubberbanded(true));
      }
 else {
        notifyOverscrollTopListener(overScrollTop,isRubberbanded(true));
      }
    }
  }
 else {
    customScrollTo(scrollY);
    scrollTo(scrollX,mScrollY);
  }
}
Program: 190922
Project: 190922
Buggy source:
private void clampScrollPosition(){
  int scrollRange=getScrollRange();
  if (scrollRange < mOwnScrollY) {
    mOwnScrollY=scrollRange;
  }
}

Fixed version (ground truth):
private void clampScrollPosition(){
  int scrollRange=getScrollRange();
  if (scrollRange < mOwnScrollY) {
    setOwnScrollY(scrollRange);
  }
}
Program: 190923
Project: 190923
Buggy source:
private void customScrollTo(int y){
  mOwnScrollY=y;
  updateChildren();
}

Fixed version (ground truth):
private void customScrollTo(int y){
  setOwnScrollY(y);
  updateChildren();
}
Program: 190924
Project: 190924
Buggy source:
public void resetScrollPosition(){
  mScroller.abortAnimation();
  mOwnScrollY=0;
}

Fixed version (ground truth):
public void resetScrollPosition(){
  mScroller.abortAnimation();
  setOwnScrollY(0);
}
Program: 190925
Project: 190925
Buggy source:
private void springBack(){
  int scrollRange=getScrollRange();
  boolean overScrolledTop=mOwnScrollY <= 0;
  boolean overScrolledBottom=mOwnScrollY >= scrollRange;
  if (overScrolledTop || overScrolledBottom) {
    boolean onTop;
    float newAmount;
    if (overScrolledTop) {
      onTop=true;
      newAmount=-mOwnScrollY;
      mOwnScrollY=0;
      mDontReportNextOverScroll=true;
    }
 else {
      onTop=false;
      newAmount=mOwnScrollY - scrollRange;
      mOwnScrollY=scrollRange;
    }
    setOverScrollAmount(newAmount,onTop,false);
    setOverScrollAmount(0.0f,onTop,true);
    mScroller.forceFinished(true);
  }
}

Fixed version (ground truth):
private void springBack(){
  int scrollRange=getScrollRange();
  boolean overScrolledTop=mOwnScrollY <= 0;
  boolean overScrolledBottom=mOwnScrollY >= scrollRange;
  if (overScrolledTop || overScrolledBottom) {
    boolean onTop;
    float newAmount;
    if (overScrolledTop) {
      onTop=true;
      newAmount=-mOwnScrollY;
      setOwnScrollY(0);
      mDontReportNextOverScroll=true;
    }
 else {
      onTop=false;
      newAmount=mOwnScrollY - scrollRange;
      setOwnScrollY(scrollRange);
    }
    setOverScrollAmount(newAmount,onTop,false);
    setOverScrollAmount(0.0f,onTop,true);
    mScroller.forceFinished(true);
  }
}
Program: 190926
Project: 190926
Buggy source:
private void updateScrollPositionOnExpandInBottom(ExpandableView view){
  if (view instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    if (row.isUserLocked() && row != getFirstChildNotGone()) {
      if (row.isSummaryWithChildren()) {
        return;
      }
      float endPosition=row.getTranslationY() + row.getActualHeight();
      if (row.isChildInGroup()) {
        endPosition+=row.getNotificationParent().getTranslationY();
      }
      int stackEnd=getStackEndPosition();
      if (endPosition > stackEnd) {
        mOwnScrollY+=endPosition - stackEnd;
        mDisallowScrollingInThisMotion=true;
      }
    }
  }
}

Fixed version (ground truth):
private void updateScrollPositionOnExpandInBottom(ExpandableView view){
  if (view instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    if (row.isUserLocked() && row != getFirstChildNotGone()) {
      if (row.isSummaryWithChildren()) {
        return;
      }
      float endPosition=row.getTranslationY() + row.getActualHeight();
      if (row.isChildInGroup()) {
        endPosition+=row.getNotificationParent().getTranslationY();
      }
      int stackEnd=getStackEndPosition();
      if (endPosition > stackEnd) {
        setOwnScrollY((int)(mOwnScrollY + endPosition - stackEnd));
        mDisallowScrollingInThisMotion=true;
      }
    }
  }
}
Program: 190927
Project: 190927
Buggy source:
@Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info){
  super.onInitializeAccessibilityNodeInfoInternal(info);
  final int scrollRange=getScrollRange();
  if (scrollRange > 0) {
    info.setScrollable(true);
    if (mScrollY > 0) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_UP);
    }
    if (mScrollY < scrollRange) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_DOWN);
    }
  }
  info.setClassName(ScrollView.class.getName());
}

Fixed version (ground truth):
@Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info){
  super.onInitializeAccessibilityNodeInfoInternal(info);
  if (mScrollable) {
    info.setScrollable(true);
    if (mBackwardScrollable) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_UP);
    }
    if (mForwardScrollable) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_DOWN);
    }
  }
  info.setClassName(ScrollView.class.getName());
}
Program: 190928
Project: 190928
Buggy source:
/** 
 * Perform a scroll upwards and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll upwards, has to be positive.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollUp(int deltaY,int range){
  deltaY=Math.max(deltaY,0);
  float currentTopAmount=getCurrentOverScrollAmount(true);
  float newTopAmount=currentTopAmount - deltaY;
  if (currentTopAmount > 0) {
    setOverScrollAmount(newTopAmount,true,false);
  }
  float scrollAmount=newTopAmount < 0 ? -newTopAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY > range) {
    if (!mExpandedInThisMotion) {
      float currentBottomPixels=getCurrentOverScrolledPixels(false);
      setOverScrolledPixels(currentBottomPixels + newScrollY - range,false,false);
    }
    mOwnScrollY=range;
    scrollAmount=0.0f;
  }
  return scrollAmount;
}

Fixed version (ground truth):
/** 
 * Perform a scroll upwards and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll upwards, has to be positive.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollUp(int deltaY,int range){
  deltaY=Math.max(deltaY,0);
  float currentTopAmount=getCurrentOverScrollAmount(true);
  float newTopAmount=currentTopAmount - deltaY;
  if (currentTopAmount > 0) {
    setOverScrollAmount(newTopAmount,true,false);
  }
  float scrollAmount=newTopAmount < 0 ? -newTopAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY > range) {
    if (!mExpandedInThisMotion) {
      float currentBottomPixels=getCurrentOverScrolledPixels(false);
      setOverScrolledPixels(currentBottomPixels + newScrollY - range,false,false);
    }
    setOwnScrollY(range);
    scrollAmount=0.0f;
  }
  return scrollAmount;
}
Program: 190929
Project: 190929
Buggy source:
private void updateScrollability(){
  boolean scrollable=getScrollRange() > 0;
  if (scrollable != mScrollable) {
    mScrollable=scrollable;
    setFocusable(scrollable);
  }
}

Fixed version (ground truth):
private void updateScrollability(){
  boolean scrollable=getScrollRange() > 0;
  if (scrollable != mScrollable) {
    mScrollable=scrollable;
    setFocusable(scrollable);
    updateForwardAndBackwardScrollability();
  }
}
Program: 190930
Project: 190930
Buggy source:
private void updateForcedScroll(){
  if (mForcedScroll != null && (!mForcedScroll.hasFocus() || !mForcedScroll.isAttachedToWindow())) {
    mForcedScroll=null;
  }
  if (mForcedScroll != null) {
    ExpandableView expandableView=(ExpandableView)mForcedScroll;
    int positionInLinearLayout=getPositionInLinearLayout(expandableView);
    int targetScroll=targetScrollForView(expandableView,positionInLinearLayout);
    int outOfViewScroll=positionInLinearLayout + expandableView.getIntrinsicHeight();
    targetScroll=Math.max(0,Math.min(targetScroll,getScrollRange()));
    if (mOwnScrollY < targetScroll || outOfViewScroll < mOwnScrollY) {
      mOwnScrollY=targetScroll;
    }
  }
}

Fixed version (ground truth):
private void updateForcedScroll(){
  if (mForcedScroll != null && (!mForcedScroll.hasFocus() || !mForcedScroll.isAttachedToWindow())) {
    mForcedScroll=null;
  }
  if (mForcedScroll != null) {
    ExpandableView expandableView=(ExpandableView)mForcedScroll;
    int positionInLinearLayout=getPositionInLinearLayout(expandableView);
    int targetScroll=targetScrollForView(expandableView,positionInLinearLayout);
    int outOfViewScroll=positionInLinearLayout + expandableView.getIntrinsicHeight();
    targetScroll=Math.max(0,Math.min(targetScroll,getScrollRange()));
    if (mOwnScrollY < targetScroll || outOfViewScroll < mOwnScrollY) {
      setOwnScrollY(targetScroll);
    }
  }
}