nus-yam/ex-repair huggingface dataset:
Program: 192568
Project: 192568
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (!mActualHeightInitialized && mActualHeight == 0) {
    int initialHeight=getInitialHeight();
    if (initialHeight != 0) {
      setActualHeight(initialHeight);
    }
  }
  updateClipping();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  updateClipping();
}
Program: 192569
Project: 192569
Buggy source:
@Override public void run(){
  hiddenView.setVisible(false);
}

Fixed version (ground truth):
@Override public void run(){
  if (hiddenView != getTransformableViewForVisibleType(mVisibleType)) {
    hiddenView.setVisible(false);
  }
}
Program: 192570
Project: 192570
Buggy source:
public NotificationContentView(Context context,AttributeSet attrs){
  super(context,attrs);
  mHybridViewManager=new HybridNotificationViewManager(getContext(),this);
  mMinContractedHeight=getResources().getDimensionPixelSize(R.dimen.min_notification_layout_height);
  mNotificationContentMarginEnd=getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_content_margin_end);
  reset(true);
}

Fixed version (ground truth):
public NotificationContentView(Context context,AttributeSet attrs){
  super(context,attrs);
  mHybridViewManager=new HybridNotificationViewManager(getContext(),this);
  mMinContractedHeight=getResources().getDimensionPixelSize(R.dimen.min_notification_layout_height);
  mNotificationContentMarginEnd=getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_content_margin_end);
  reset();
}
Program: 192571
Project: 192571
Buggy source:
public void reset(boolean resetActualHeight){
  if (mContractedChild != null) {
    mContractedChild.animate().cancel();
    removeView(mContractedChild);
  }
  if (mExpandedChild != null) {
    mExpandedChild.animate().cancel();
    removeView(mExpandedChild);
  }
  if (mHeadsUpChild != null) {
    mHeadsUpChild.animate().cancel();
    removeView(mHeadsUpChild);
  }
  mContractedChild=null;
  mExpandedChild=null;
  mHeadsUpChild=null;
  mVisibleType=VISIBLE_TYPE_CONTRACTED;
  if (resetActualHeight) {
    mContentHeight=mSmallHeight;
  }
}

Fixed version (ground truth):
public void reset(){
  if (mContractedChild != null) {
    mContractedChild.animate().cancel();
    removeView(mContractedChild);
  }
  if (mExpandedChild != null) {
    mExpandedChild.animate().cancel();
    removeView(mExpandedChild);
  }
  if (mHeadsUpChild != null) {
    mHeadsUpChild.animate().cancel();
    removeView(mHeadsUpChild);
  }
  mContractedChild=null;
  mExpandedChild=null;
  mHeadsUpChild=null;
}
Program: 192572
Project: 192572
Buggy source:
/** 
 * @return one of the static enum types in this view, calculated form the current state
 */
private int calculateVisibleType(){
  if (mUserExpanding) {
    int height=!mIsChildInGroup || isGroupExpanded() || mContainingNotification.isExpanded() ? mContainingNotification.getMaxContentHeight() : mContainingNotification.getShowingLayout().getMinHeight();
    int expandedVisualType=getVisualTypeForHeight(height);
    int collapsedVisualType=getVisualTypeForHeight(mContainingNotification.getMinExpandHeight());
    return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType;
  }
  int viewHeight=Math.min(mContentHeight,mContainingNotification.getIntrinsicHeight());
  return getVisualTypeForHeight(viewHeight);
}

Fixed version (ground truth):
/** 
 * @return one of the static enum types in this view, calculated form the current state
 */
private int calculateVisibleType(){
  if (mUserExpanding) {
    int height=!mIsChildInGroup || isGroupExpanded() || mContainingNotification.isExpanded() ? mContainingNotification.getMaxContentHeight() : mContainingNotification.getShowingLayout().getMinHeight();
    if (height == 0) {
      height=mContentHeight;
    }
    int expandedVisualType=getVisualTypeForHeight(height);
    int collapsedVisualType=getVisualTypeForHeight(mContainingNotification.getMinExpandHeight());
    return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType;
  }
  int intrinsicHeight=mContainingNotification.getIntrinsicHeight();
  int viewHeight=mContentHeight;
  if (intrinsicHeight != 0) {
    viewHeight=Math.min(mContentHeight,intrinsicHeight);
  }
  return getVisualTypeForHeight(viewHeight);
}
Program: 192573
Project: 192573
Buggy source:
public void onNotificationUpdated(NotificationData.Entry entry){
  mStatusBarNotification=entry.notification;
  mBeforeN=entry.targetSdk < Build.VERSION_CODES.N;
  updateSingleLineView();
  applyRemoteInput(entry);
  selectLayout(false,true);
  if (mContractedChild != null) {
    mContractedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mExpandedChild != null) {
    mExpandedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mHeadsUpChild != null) {
    mHeadsUpWrapper.notifyContentUpdated(entry.notification);
  }
  setDark(mDark,false,0);
}

Fixed version (ground truth):
public void onNotificationUpdated(NotificationData.Entry entry){
  mStatusBarNotification=entry.notification;
  mBeforeN=entry.targetSdk < Build.VERSION_CODES.N;
  updateSingleLineView();
  applyRemoteInput(entry);
  if (mContractedChild != null) {
    mContractedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mExpandedChild != null) {
    mExpandedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mHeadsUpChild != null) {
    mHeadsUpWrapper.notifyContentUpdated(entry.notification);
  }
  selectLayout(false,true);
  setDark(mDark,false,0);
}
Program: 192574
Project: 192574
Buggy source:
private void animateToVisibleType(int visibleType){
  final TransformableView shownView=getTransformableViewForVisibleType(visibleType);
  final TransformableView hiddenView=getTransformableViewForVisibleType(mVisibleType);
  shownView.transformFrom(hiddenView);
  getViewForVisibleType(visibleType).setVisibility(View.VISIBLE);
  hiddenView.transformTo(shownView,new Runnable(){
    @Override public void run(){
      hiddenView.setVisible(false);
    }
  }
);
}

Fixed version (ground truth):
private void animateToVisibleType(int visibleType){
  final TransformableView shownView=getTransformableViewForVisibleType(visibleType);
  final TransformableView hiddenView=getTransformableViewForVisibleType(mVisibleType);
  if (shownView == hiddenView) {
    shownView.setVisible(true);
    return;
  }
  shownView.transformFrom(hiddenView);
  getViewForVisibleType(visibleType).setVisibility(View.VISIBLE);
  hiddenView.transformTo(shownView,new Runnable(){
    @Override public void run(){
      if (hiddenView != getTransformableViewForVisibleType(mVisibleType)) {
        hiddenView.setVisible(false);
      }
    }
  }
);
}
Program: 192575
Project: 192575
Buggy source:
final void performStart(){
  mActivityTransitionState.setEnterActivityOptions(this,getActivityOptions());
  mFragments.noteStateNotSaved();
  mCalled=false;
  mFragments.execPendingActions();
  mInstrumentation.callActivityOnStart(this);
  if (!mCalled) {
    throw new SuperNotCalledException("String_Node_Str" + mComponent.toShortString() + "String_Node_Str");
  }
  mFragments.dispatchStart();
  mFragments.reportLoaderStart();
  boolean isDlwarningEnabled=SystemProperties.getInt("String_Node_Str",0) == 1;
  boolean isAppDebuggable=(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  if (isAppDebuggable || isDlwarningEnabled) {
    String dlwarning=getDlWarning();
    if (dlwarning != null) {
      String appName=getString(mApplication.getApplicationInfo().labelRes);
      String warning="String_Node_Str" + "String_Node_Str" + dlwarning;
      if (isAppDebuggable) {
        new AlertDialog.Builder(this).setTitle(appName).setMessage(warning).setPositiveButton(android.R.string.ok,null).setCancelable(false).show();
      }
 else {
        Toast.makeText(this,appName + "String_Node_Str" + warning,Toast.LENGTH_LONG).show();
      }
    }
  }
  mActivityTransitionState.enterReady(this);
}

Fixed version (ground truth):
final void performStart(){
  mActivityTransitionState.setEnterActivityOptions(this,getActivityOptions());
  mFragments.noteStateNotSaved();
  mCalled=false;
  mFragments.execPendingActions();
  mInstrumentation.callActivityOnStart(this);
  if (!mCalled) {
    throw new SuperNotCalledException("String_Node_Str" + mComponent.toShortString() + "String_Node_Str");
  }
  mFragments.dispatchStart();
  mFragments.reportLoaderStart();
  boolean isDlwarningEnabled=SystemProperties.getInt("String_Node_Str",0) == 1;
  boolean isAppDebuggable=(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  if (isAppDebuggable || isDlwarningEnabled) {
    String dlwarning=getDlWarning();
    if (dlwarning != null) {
      String appName=getApplicationInfo().loadLabel(getPackageManager()).toString();
      String warning="String_Node_Str" + "String_Node_Str" + dlwarning;
      if (isAppDebuggable) {
        new AlertDialog.Builder(this).setTitle(appName).setMessage(warning).setPositiveButton(android.R.string.ok,null).setCancelable(false).show();
      }
 else {
        Toast.makeText(this,appName + "String_Node_Str" + warning,Toast.LENGTH_LONG).show();
      }
    }
  }
  mActivityTransitionState.enterReady(this);
}
Program: 192576
Project: 192576
Buggy source:
final void performStart(){
  mActivityTransitionState.setEnterActivityOptions(this,getActivityOptions());
  mFragments.noteStateNotSaved();
  mCalled=false;
  mFragments.execPendingActions();
  mInstrumentation.callActivityOnStart(this);
  if (!mCalled) {
    throw new SuperNotCalledException("String_Node_Str" + mComponent.toShortString() + "String_Node_Str");
  }
  mFragments.dispatchStart();
  mFragments.reportLoaderStart();
  boolean isDlwarningEnabled=SystemProperties.getInt("String_Node_Str",0) == 1;
  boolean isAppDebuggable=(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  if (isAppDebuggable || isDlwarningEnabled) {
    String dlwarning=getDlWarning();
    if (dlwarning != null) {
      String appName=getString(mApplication.getApplicationInfo().labelRes);
      String warning="String_Node_Str" + "String_Node_Str" + dlwarning;
      if (isAppDebuggable) {
        new AlertDialog.Builder(this).setTitle(appName).setMessage(warning).setPositiveButton(android.R.string.ok,null).setCancelable(false).show();
      }
 else {
        Toast.makeText(this,appName + "String_Node_Str" + warning,Toast.LENGTH_LONG).show();
      }
    }
  }
  mActivityTransitionState.enterReady(this);
}

Fixed version (ground truth):
final void performStart(){
  mActivityTransitionState.setEnterActivityOptions(this,getActivityOptions());
  mFragments.noteStateNotSaved();
  mCalled=false;
  mFragments.execPendingActions();
  mInstrumentation.callActivityOnStart(this);
  if (!mCalled) {
    throw new SuperNotCalledException("String_Node_Str" + mComponent.toShortString() + "String_Node_Str");
  }
  mFragments.dispatchStart();
  mFragments.reportLoaderStart();
  boolean isDlwarningEnabled=SystemProperties.getInt("String_Node_Str",0) == 1;
  boolean isAppDebuggable=(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  if (isAppDebuggable || isDlwarningEnabled) {
    String dlwarning=getDlWarning();
    if (dlwarning != null) {
      String appName=getApplicationInfo().loadLabel(getPackageManager()).toString();
      String warning="String_Node_Str" + "String_Node_Str" + dlwarning;
      if (isAppDebuggable) {
        new AlertDialog.Builder(this).setTitle(appName).setMessage(warning).setPositiveButton(android.R.string.ok,null).setCancelable(false).show();
      }
 else {
        Toast.makeText(this,appName + "String_Node_Str" + warning,Toast.LENGTH_LONG).show();
      }
    }
  }
  mActivityTransitionState.enterReady(this);
}
Program: 192577
Project: 192577
Buggy source:
final void performStart(){
  mActivityTransitionState.setEnterActivityOptions(this,getActivityOptions());
  mFragments.noteStateNotSaved();
  mCalled=false;
  mFragments.execPendingActions();
  mInstrumentation.callActivityOnStart(this);
  if (!mCalled) {
    throw new SuperNotCalledException("String_Node_Str" + mComponent.toShortString() + "String_Node_Str");
  }
  mFragments.dispatchStart();
  mFragments.reportLoaderStart();
  boolean isDlwarningEnabled=SystemProperties.getInt("String_Node_Str",0) == 1;
  boolean isAppDebuggable=(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  if (isAppDebuggable || isDlwarningEnabled) {
    String dlwarning=getDlWarning();
    if (dlwarning != null) {
      String appName=getString(mApplication.getApplicationInfo().labelRes);
      String warning="String_Node_Str" + "String_Node_Str" + dlwarning;
      if (isAppDebuggable) {
        new AlertDialog.Builder(this).setTitle(appName).setMessage(warning).setPositiveButton(android.R.string.ok,null).setCancelable(false).show();
      }
 else {
        Toast.makeText(this,appName + "String_Node_Str" + warning,Toast.LENGTH_LONG).show();
      }
    }
  }
  mActivityTransitionState.enterReady(this);
}

Fixed version (ground truth):
final void performStart(){
  mActivityTransitionState.setEnterActivityOptions(this,getActivityOptions());
  mFragments.noteStateNotSaved();
  mCalled=false;
  mFragments.execPendingActions();
  mInstrumentation.callActivityOnStart(this);
  if (!mCalled) {
    throw new SuperNotCalledException("String_Node_Str" + mComponent.toShortString() + "String_Node_Str");
  }
  mFragments.dispatchStart();
  mFragments.reportLoaderStart();
  boolean isDlwarningEnabled=SystemProperties.getInt("String_Node_Str",0) == 1;
  boolean isAppDebuggable=(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  if (isAppDebuggable || isDlwarningEnabled) {
    String dlwarning=getDlWarning();
    if (dlwarning != null) {
      String appName=getApplicationInfo().loadLabel(getPackageManager()).toString();
      String warning="String_Node_Str" + "String_Node_Str" + dlwarning;
      if (isAppDebuggable) {
        new AlertDialog.Builder(this).setTitle(appName).setMessage(warning).setPositiveButton(android.R.string.ok,null).setCancelable(false).show();
      }
 else {
        Toast.makeText(this,appName + "String_Node_Str" + warning,Toast.LENGTH_LONG).show();
      }
    }
  }
  mActivityTransitionState.enterReady(this);
}
Program: 192579
Project: 192579
Buggy source:
@Override public void initFrom(View view){
  super.initFrom(view);
  if (view instanceof TextView) {
    TextView txt=(TextView)view;
    mText=txt.getText();
  }
}

Fixed version (ground truth):
@Override public void initFrom(View view){
  super.initFrom(view);
  if (view instanceof TextView) {
    mText=(TextView)view;
  }
}
Program: 192580
Project: 192580
Buggy source:
@Override protected boolean sameAs(TransformState otherState){
  if (otherState instanceof TextViewTransformState) {
    TextViewTransformState otherTvs=(TextViewTransformState)otherState;
    return TextUtils.equals(otherTvs.mText,mText);
  }
  return super.sameAs(otherState);
}

Fixed version (ground truth):
@Override protected boolean sameAs(TransformState otherState){
  if (otherState instanceof TextViewTransformState) {
    TextViewTransformState otherTvs=(TextViewTransformState)otherState;
    if (TextUtils.equals(otherTvs.mText.getText(),mText.getText())) {
      int ownEllipsized=getEllipsisCount();
      int otherEllipsized=otherTvs.getEllipsisCount();
      return ownEllipsized == otherEllipsized;
    }
  }
  return super.sameAs(otherState);
}
Program: 192582
Project: 192582
Buggy source:
/** 
 * Add a child notification to this view.
 * @param row the row to add
 * @param childIndex the index to add it at, if -1 it will be added at the end
 */
public void addNotification(ExpandableNotificationRow row,int childIndex){
  int newIndex=childIndex < 0 ? mChildren.size() : childIndex;
  mChildren.add(newIndex,row);
  addView(row);
  View divider=inflateDivider();
  addView(divider);
  mDividers.add(newIndex,divider);
  updateGroupOverflow();
}

Fixed version (ground truth):
/** 
 * Add a child notification to this view.
 * @param row the row to add
 * @param childIndex the index to add it at, if -1 it will be added at the end
 */
public void addNotification(ExpandableNotificationRow row,int childIndex){
  int newIndex=childIndex < 0 ? mChildren.size() : childIndex;
  mChildren.add(newIndex,row);
  addView(row);
  row.setUserLocked(mUserLocked);
  View divider=inflateDivider();
  addView(divider);
  mDividers.add(newIndex,divider);
  updateGroupOverflow();
}
Program: 192583
Project: 192583
Buggy source:
public void removeNotification(ExpandableNotificationRow row){
  int childIndex=mChildren.indexOf(row);
  mChildren.remove(row);
  removeView(row);
  final View divider=mDividers.remove(childIndex);
  removeView(divider);
  getOverlay().add(divider);
  CrossFadeHelper.fadeOut(divider,new Runnable(){
    @Override public void run(){
      getOverlay().remove(divider);
    }
  }
);
  row.setSystemChildExpanded(false);
  updateGroupOverflow();
}

Fixed version (ground truth):
public void removeNotification(ExpandableNotificationRow row){
  int childIndex=mChildren.indexOf(row);
  mChildren.remove(row);
  removeView(row);
  final View divider=mDividers.remove(childIndex);
  removeView(divider);
  getOverlay().add(divider);
  CrossFadeHelper.fadeOut(divider,new Runnable(){
    @Override public void run(){
      getOverlay().remove(divider);
    }
  }
);
  row.setSystemChildExpanded(false);
  row.setUserLocked(false);
  updateGroupOverflow();
}
Program: 192584
Project: 192584
Buggy source:
private void handleExpansion(float heightDelta,ExpandableView child){
  if (heightDelta < 0) {
    heightDelta=0;
  }
  boolean expandable=child.isContentExpandable();
  float rubberbandFactor=expandable ? RUBBERBAND_FACTOR_EXPANDABLE : RUBBERBAND_FACTOR_STATIC;
  float rubberband=heightDelta * rubberbandFactor;
  if (expandable && (rubberband + child.getMinHeight()) > child.getMaxContentHeight()) {
    float overshoot=(rubberband + child.getMinHeight()) - child.getMaxContentHeight();
    overshoot*=(1 - RUBBERBAND_FACTOR_STATIC);
    rubberband-=overshoot;
  }
  child.setActualHeight((int)(child.getMinHeight() + rubberband));
}

Fixed version (ground truth):
private void handleExpansion(float heightDelta,ExpandableView child){
  if (heightDelta < 0) {
    heightDelta=0;
  }
  boolean expandable=child.isContentExpandable();
  float rubberbandFactor=expandable ? RUBBERBAND_FACTOR_EXPANDABLE : RUBBERBAND_FACTOR_STATIC;
  float rubberband=heightDelta * rubberbandFactor;
  if (expandable && (rubberband + child.getMinExpandHeight()) > child.getMaxContentHeight()) {
    float overshoot=(rubberband + child.getMinExpandHeight()) - child.getMaxContentHeight();
    overshoot*=(1 - RUBBERBAND_FACTOR_STATIC);
    rubberband-=overshoot;
  }
  child.setActualHeight((int)(child.getMinExpandHeight() + rubberband));
}
Program: 192585
Project: 192585
Buggy source:
@Override public int getMinExpandHeight(){
  if (mIsSummaryWithChildren && !mOnKeyguard) {
    return mChildrenContainer.getMinExpandHeight();
  }
  return getMinHeight();
}

Fixed version (ground truth):
@Override public int getMinExpandHeight(){
  if (mIsSummaryWithChildren && !mShowingPublic) {
    return mChildrenContainer.getMinExpandHeight(mOnKeyguard);
  }
  return getMinHeight();
}
Program: 192586
Project: 192586
Buggy source:
public int getMinExpandHeight(){
  return getIntrinsicHeight(getMaxAllowedVisibleChildren(true));
}

Fixed version (ground truth):
public int getMinExpandHeight(boolean onKeyguard){
  int maxAllowedVisibleChildren=onKeyguard ? NUMBER_OF_CHILDREN_WHEN_COLLAPSED : getMaxAllowedVisibleChildren(true);
  int minExpandHeight=mNotificationHeaderHeight;
  int visibleChildren=0;
  boolean firstChild=true;
  int childCount=mChildren.size();
  for (int i=0; i < childCount; i++) {
    if (visibleChildren >= maxAllowedVisibleChildren) {
      break;
    }
    if (!firstChild) {
      minExpandHeight+=mChildPadding;
    }
 else {
      firstChild=false;
    }
    ExpandableNotificationRow child=mChildren.get(i);
    minExpandHeight+=child.getMinHeight();
    visibleChildren++;
  }
  minExpandHeight+=mCollapsedBottompadding;
  return minExpandHeight;
}
Program: 192588
Project: 192588
Buggy source:
private void startAdvancedPrintOptionsActivity(PrinterInfo printer){
  ComponentName serviceName=printer.getId().getServiceName();
  String activityName=PrintOptionUtils.getAdvancedOptionsActivityName(this,serviceName);
  if (TextUtils.isEmpty(activityName)) {
    return;
  }
  Intent intent=new Intent(Intent.ACTION_MAIN);
  intent.setComponent(new ComponentName(serviceName.getPackageName(),activityName));
  List<ResolveInfo> resolvedActivities=getPackageManager().queryIntentActivities(intent,0);
  if (resolvedActivities.isEmpty()) {
    return;
  }
  if (resolvedActivities.get(0).activityInfo.exported) {
    intent.putExtra(PrintService.EXTRA_PRINT_JOB_INFO,mPrintJob);
    intent.putExtra(PrintService.EXTRA_PRINTER_INFO,printer);
    intent.putExtra(PrintService.EXTRA_PRINT_DOCUMENT_INFO,mPrintedDocument.getDocumentInfo().info);
    try {
      startActivityForResult(intent,ACTIVITY_REQUEST_POPULATE_ADVANCED_PRINT_OPTIONS);
    }
 catch (    ActivityNotFoundException anfe) {
      Log.e(LOG_TAG,"String_Node_Str" + intent,anfe);
    }
  }
}

Fixed version (ground truth):
private void startAdvancedPrintOptionsActivity(PrinterInfo printer){
  ComponentName serviceName=printer.getId().getServiceName();
  String activityName=PrintOptionUtils.getAdvancedOptionsActivityName(this,serviceName);
  if (TextUtils.isEmpty(activityName)) {
    return;
  }
  Intent intent=new Intent(Intent.ACTION_MAIN);
  intent.setComponent(new ComponentName(serviceName.getPackageName(),activityName));
  List<ResolveInfo> resolvedActivities=getPackageManager().queryIntentActivities(intent,0);
  if (resolvedActivities.isEmpty()) {
    return;
  }
  if (resolvedActivities.get(0).activityInfo.exported) {
    PrintJobInfo.Builder printJobBuilder=new PrintJobInfo.Builder(mPrintJob);
    printJobBuilder.setPages(mSelectedPages);
    intent.putExtra(PrintService.EXTRA_PRINT_JOB_INFO,printJobBuilder.build());
    intent.putExtra(PrintService.EXTRA_PRINTER_INFO,printer);
    intent.putExtra(PrintService.EXTRA_PRINT_DOCUMENT_INFO,mPrintedDocument.getDocumentInfo().info);
    try {
      startActivityForResult(intent,ACTIVITY_REQUEST_POPULATE_ADVANCED_PRINT_OPTIONS);
    }
 catch (    ActivityNotFoundException anfe) {
      Log.e(LOG_TAG,"String_Node_Str" + intent,anfe);
    }
  }
}
Program: 192590
Project: 192590
Buggy source:
MyActivityController(String gdbPort){
  mGdbPort=gdbPort;
}

Fixed version (ground truth):
MyActivityController(String gdbPort,boolean monkey){
  mGdbPort=gdbPort;
  mMonkey=monkey;
}
Program: 192591
Project: 192591
Buggy source:
private void runMonitor() throws Exception {
  String opt;
  String gdbPort=null;
  while ((opt=nextOption()) != null) {
    if (opt.equals("String_Node_Str")) {
      gdbPort=nextArgRequired();
    }
 else {
      System.err.println("String_Node_Str" + opt);
      return;
    }
  }
  MyActivityController controller=new MyActivityController(gdbPort);
  controller.run();
}

Fixed version (ground truth):
private void runMonitor() throws Exception {
  String opt;
  String gdbPort=null;
  boolean monkey=false;
  while ((opt=nextOption()) != null) {
    if (opt.equals("String_Node_Str")) {
      gdbPort=nextArgRequired();
    }
 else     if (opt.equals("String_Node_Str")) {
      monkey=true;
    }
 else {
      System.err.println("String_Node_Str" + opt);
      return;
    }
  }
  MyActivityController controller=new MyActivityController(gdbPort,monkey);
  controller.run();
}
Program: 192592
Project: 192592
Buggy source:
/** 
 * Enable or disable monkey test mode. Setting test as "monkey" indicates to some applications that a test framework is running as a "monkey" type. Such applications may choose not to perform actions that do submits so to avoid allowing monkey tests from doing harm or performing annoying actions such as dialing 911 or posting messages to public forums, etc.
 * @param isSet True to set as monkey test. False to set as regular functional test (default).
 * @see {@link ActivityManager#isUserAMonkey()}
 */
public void setRunAsMonkey(boolean isSet){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    if (isSet) {
      am.setActivityController(new DummyActivityController());
    }
 else {
      am.setActivityController(null);
    }
  }
 catch (  RemoteException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable monkey test mode. Setting test as "monkey" indicates to some applications that a test framework is running as a "monkey" type. Such applications may choose not to perform actions that do submits so to avoid allowing monkey tests from doing harm or performing annoying actions such as dialing 911 or posting messages to public forums, etc.
 * @param isSet True to set as monkey test. False to set as regular functional test (default).
 * @see {@link ActivityManager#isUserAMonkey()}
 */
public void setRunAsMonkey(boolean isSet){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    if (isSet) {
      am.setActivityController(new DummyActivityController(),true);
    }
 else {
      am.setActivityController(null,true);
    }
  }
 catch (  RemoteException e) {
    throw new RuntimeException(e);
  }
}
Program: 192594
Project: 192594
Buggy source:
public void setActivityController(IActivityController watcher) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
  mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION,data,reply,0);
  reply.readException();
  data.recycle();
  reply.recycle();
}

Fixed version (ground truth):
public void setActivityController(IActivityController watcher,boolean imAMonkey) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
  data.writeInt(imAMonkey ? 1 : 0);
  mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION,data,reply,0);
  reply.readException();
  data.recycle();
  reply.recycle();
}
Program: 192595
Project: 192595
Buggy source:
public void setActivityController(IActivityController watcher) throws RemoteException ;

Fixed version (ground truth):
public void setActivityController(IActivityController watcher,boolean imAMonkey) throws RemoteException ;
Program: 192597
Project: 192597
Buggy source:
@Override public void setActivityController(IActivityController controller){
  enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER,"String_Node_Str");
synchronized (this) {
    mController=controller;
    Watchdog.getInstance().setActivityController(controller);
  }
}

Fixed version (ground truth):
@Override public void setActivityController(IActivityController controller,boolean imAMonkey){
  enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER,"String_Node_Str");
synchronized (this) {
    mController=controller;
    mControllerIsAMonkey=imAMonkey;
    Watchdog.getInstance().setActivityController(controller);
  }
}
Program: 192598
Project: 192598
Buggy source:
@Override public boolean isUserAMonkey(){
synchronized (this) {
    return (mUserIsMonkey || mController != null);
  }
}

Fixed version (ground truth):
@Override public boolean isUserAMonkey(){
synchronized (this) {
    return (mUserIsMonkey || (mController != null && mControllerIsAMonkey));
  }
}
Program: 192599
Project: 192599
Buggy source:
@SmallTest public void testSET_ACTIVITY_WATCHER(){
  try {
    mAm.setActivityController(null);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  SecurityException e) {
  }
catch (  RemoteException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
@SmallTest public void testSET_ACTIVITY_WATCHER(){
  try {
    mAm.setActivityController(null,false);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  SecurityException e) {
  }
catch (  RemoteException e) {
    fail("String_Node_Str");
  }
}
Program: 192600
Project: 192600
Buggy source:
public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive){
  mHideSensitiveForIntrinsicHeight=hideSensitive;
}

Fixed version (ground truth):
public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive){
  mHideSensitiveForIntrinsicHeight=hideSensitive;
  if (mIsSummaryWithChildren) {
    List<ExpandableNotificationRow> notificationChildren=mChildrenContainer.getNotificationChildren();
    for (int i=0; i < notificationChildren.size(); i++) {
      ExpandableNotificationRow child=notificationChildren.get(i);
      child.setHideSensitiveForIntrinsicHeight(hideSensitive);
    }
  }
}
Program: 192602
Project: 192602
Buggy source:
MyActivityController(String gdbPort){
  mGdbPort=gdbPort;
}

Fixed version (ground truth):
MyActivityController(String gdbPort,boolean monkey){
  mGdbPort=gdbPort;
  mMonkey=monkey;
}
Program: 192603
Project: 192603
Buggy source:
private void runMonitor() throws Exception {
  String opt;
  String gdbPort=null;
  while ((opt=nextOption()) != null) {
    if (opt.equals("String_Node_Str")) {
      gdbPort=nextArgRequired();
    }
 else {
      System.err.println("String_Node_Str" + opt);
      return;
    }
  }
  MyActivityController controller=new MyActivityController(gdbPort);
  controller.run();
}

Fixed version (ground truth):
private void runMonitor() throws Exception {
  String opt;
  String gdbPort=null;
  boolean monkey=false;
  while ((opt=nextOption()) != null) {
    if (opt.equals("String_Node_Str")) {
      gdbPort=nextArgRequired();
    }
 else     if (opt.equals("String_Node_Str")) {
      monkey=true;
    }
 else {
      System.err.println("String_Node_Str" + opt);
      return;
    }
  }
  MyActivityController controller=new MyActivityController(gdbPort,monkey);
  controller.run();
}
Program: 192604
Project: 192604
Buggy source:
/** 
 * Enable or disable monkey test mode. Setting test as "monkey" indicates to some applications that a test framework is running as a "monkey" type. Such applications may choose not to perform actions that do submits so to avoid allowing monkey tests from doing harm or performing annoying actions such as dialing 911 or posting messages to public forums, etc.
 * @param isSet True to set as monkey test. False to set as regular functional test (default).
 * @see {@link ActivityManager#isUserAMonkey()}
 */
public void setRunAsMonkey(boolean isSet){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    if (isSet) {
      am.setActivityController(new DummyActivityController());
    }
 else {
      am.setActivityController(null);
    }
  }
 catch (  RemoteException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable monkey test mode. Setting test as "monkey" indicates to some applications that a test framework is running as a "monkey" type. Such applications may choose not to perform actions that do submits so to avoid allowing monkey tests from doing harm or performing annoying actions such as dialing 911 or posting messages to public forums, etc.
 * @param isSet True to set as monkey test. False to set as regular functional test (default).
 * @see {@link ActivityManager#isUserAMonkey()}
 */
public void setRunAsMonkey(boolean isSet){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    if (isSet) {
      am.setActivityController(new DummyActivityController(),true);
    }
 else {
      am.setActivityController(null,true);
    }
  }
 catch (  RemoteException e) {
    throw new RuntimeException(e);
  }
}
Program: 192606
Project: 192606
Buggy source:
public void setActivityController(IActivityController watcher) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
  mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION,data,reply,0);
  reply.readException();
  data.recycle();
  reply.recycle();
}

Fixed version (ground truth):
public void setActivityController(IActivityController watcher,boolean imAMonkey) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
  data.writeInt(imAMonkey ? 1 : 0);
  mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION,data,reply,0);
  reply.readException();
  data.recycle();
  reply.recycle();
}
Program: 192607
Project: 192607
Buggy source:
public void setActivityController(IActivityController watcher) throws RemoteException ;

Fixed version (ground truth):
public void setActivityController(IActivityController watcher,boolean imAMonkey) throws RemoteException ;
Program: 192609
Project: 192609
Buggy source:
@Override public void setActivityController(IActivityController controller){
  enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER,"String_Node_Str");
synchronized (this) {
    mController=controller;
    Watchdog.getInstance().setActivityController(controller);
  }
}

Fixed version (ground truth):
@Override public void setActivityController(IActivityController controller,boolean imAMonkey){
  enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER,"String_Node_Str");
synchronized (this) {
    mController=controller;
    mControllerIsAMonkey=imAMonkey;
    Watchdog.getInstance().setActivityController(controller);
  }
}
Program: 192610
Project: 192610
Buggy source:
@Override public boolean isUserAMonkey(){
synchronized (this) {
    return (mUserIsMonkey || mController != null);
  }
}

Fixed version (ground truth):
@Override public boolean isUserAMonkey(){
synchronized (this) {
    return (mUserIsMonkey || (mController != null && mControllerIsAMonkey));
  }
}
Program: 192611
Project: 192611
Buggy source:
@SmallTest public void testSET_ACTIVITY_WATCHER(){
  try {
    mAm.setActivityController(null);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  SecurityException e) {
  }
catch (  RemoteException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
@SmallTest public void testSET_ACTIVITY_WATCHER(){
  try {
    mAm.setActivityController(null,false);
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  SecurityException e) {
  }
catch (  RemoteException e) {
    fail("String_Node_Str");
  }
}
Program: 192612
Project: 192612
Buggy source:
public void setDark(boolean dark,boolean fade,long delay,boolean force){
  if ((!force && mDark == dark) || mContractedChild == null) {
    return;
  }
  mDark=dark;
  dark=dark && !mShowingLegacyBackground;
  if (mVisibleType == VISIBLE_TYPE_CONTRACTED || !dark) {
    mContractedWrapper.setDark(dark,fade,delay);
  }
  if (mVisibleType == VISIBLE_TYPE_EXPANDED || (mExpandedChild != null && !dark)) {
    mExpandedWrapper.setDark(dark,fade,delay);
  }
  if (mVisibleType == VISIBLE_TYPE_HEADSUP || (mHeadsUpChild != null && !dark)) {
    mHeadsUpWrapper.setDark(dark,fade,delay);
  }
  if (mSingleLineView != null && (mVisibleType == VISIBLE_TYPE_SINGLELINE || !dark)) {
    mSingleLineView.setDark(dark,fade,delay);
  }
}

Fixed version (ground truth):
public void setDark(boolean dark,boolean fade,long delay){
  if (mContractedChild == null) {
    return;
  }
  mDark=dark;
  dark=dark && !mShowingLegacyBackground;
  if (mVisibleType == VISIBLE_TYPE_CONTRACTED || !dark) {
    mContractedWrapper.setDark(dark,fade,delay);
  }
  if (mVisibleType == VISIBLE_TYPE_EXPANDED || (mExpandedChild != null && !dark)) {
    mExpandedWrapper.setDark(dark,fade,delay);
  }
  if (mVisibleType == VISIBLE_TYPE_HEADSUP || (mHeadsUpChild != null && !dark)) {
    mHeadsUpWrapper.setDark(dark,fade,delay);
  }
  if (mSingleLineView != null && (mVisibleType == VISIBLE_TYPE_SINGLELINE || !dark)) {
    mSingleLineView.setDark(dark,fade,delay);
  }
}
Program: 192613
Project: 192613
Buggy source:
public void onNotificationUpdated(NotificationData.Entry entry){
  mStatusBarNotification=entry.notification;
  mBeforeN=entry.targetSdk < Build.VERSION_CODES.N;
  updateSingleLineView();
  applyRemoteInput(entry);
  selectLayout(false,true);
  if (mContractedChild != null) {
    mContractedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mExpandedChild != null) {
    mExpandedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mHeadsUpChild != null) {
    mHeadsUpWrapper.notifyContentUpdated(entry.notification);
  }
  setDark(mDark,false,0,true);
}

Fixed version (ground truth):
public void onNotificationUpdated(NotificationData.Entry entry){
  mStatusBarNotification=entry.notification;
  mBeforeN=entry.targetSdk < Build.VERSION_CODES.N;
  updateSingleLineView();
  applyRemoteInput(entry);
  selectLayout(false,true);
  if (mContractedChild != null) {
    mContractedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mExpandedChild != null) {
    mExpandedWrapper.notifyContentUpdated(entry.notification);
  }
  if (mHeadsUpChild != null) {
    mHeadsUpWrapper.notifyContentUpdated(entry.notification);
  }
  setDark(mDark,false,0);
}
Program: 192614
Project: 192614
Buggy source:
@Override public void setDark(boolean dark,boolean fade,long delay){
  if (dark == mDark) {
    return;
  }
  super.setDark(dark,fade,delay);
  if (fade) {
    mInvertHelper.fade(dark,delay);
  }
 else {
    mInvertHelper.update(dark);
  }
}

Fixed version (ground truth):
@Override public void setDark(boolean dark,boolean fade,long delay){
  if (dark == mDark && mDarkInitialized) {
    return;
  }
  super.setDark(dark,fade,delay);
  if (fade) {
    mInvertHelper.fade(dark,delay);
  }
 else {
    mInvertHelper.update(dark);
  }
}
Program: 192615
Project: 192615
Buggy source:
@Override public void setDark(boolean dark,boolean fade,long delay){
  if (dark == mDark) {
    return;
  }
  super.setDark(dark,fade,delay);
  if (fade) {
    mInvertHelper.fade(dark,delay);
  }
 else {
    mInvertHelper.update(dark);
  }
  if (mIcon != null) {
    boolean hadColorFilter=mNotificationHeader.getOriginalIconColor() != NotificationHeaderView.NO_COLOR;
    if (fade) {
      if (hadColorFilter) {
        fadeIconColorFilter(mIcon,dark,delay);
        fadeIconAlpha(mIcon,dark,delay);
      }
 else {
        fadeGrayscale(mIcon,dark,delay);
      }
    }
 else {
      if (hadColorFilter) {
        updateIconColorFilter(mIcon,dark);
        updateIconAlpha(mIcon,dark);
      }
 else {
        updateGrayscale(mIcon,dark);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void setDark(boolean dark,boolean fade,long delay){
  if (dark == mDark && mDarkInitialized) {
    return;
  }
  super.setDark(dark,fade,delay);
  if (fade) {
    mInvertHelper.fade(dark,delay);
  }
 else {
    mInvertHelper.update(dark);
  }
  if (mIcon != null) {
    boolean hadColorFilter=mNotificationHeader.getOriginalIconColor() != NotificationHeaderView.NO_COLOR;
    if (fade) {
      if (hadColorFilter) {
        fadeIconColorFilter(mIcon,dark,delay);
        fadeIconAlpha(mIcon,dark,delay);
      }
 else {
        fadeGrayscale(mIcon,dark,delay);
      }
    }
 else {
      if (hadColorFilter) {
        updateIconColorFilter(mIcon,dark);
        updateIconAlpha(mIcon,dark);
      }
 else {
        updateGrayscale(mIcon,dark);
      }
    }
  }
}
Program: 192616
Project: 192616
Buggy source:
@Override public void setDark(boolean dark,boolean fade,long delay){
  if (dark == mDark) {
    return;
  }
  super.setDark(dark,fade,delay);
  setPictureGrayscale(dark,fade,delay);
  setProgressBarDark(dark,fade,delay);
}

Fixed version (ground truth):
@Override public void setDark(boolean dark,boolean fade,long delay){
  if (dark == mDark && mDarkInitialized) {
    return;
  }
  super.setDark(dark,fade,delay);
  setPictureGrayscale(dark,fade,delay);
  setProgressBarDark(dark,fade,delay);
}
Program: 192617
Project: 192617
Buggy source:
/** 
 * In dark mode, we draw as little as possible, assuming a black background.
 * @param dark whether we should display ourselves in dark mode
 * @param fade whether to animate the transition if the mode changes
 * @param delay if fading, the delay of the animation
 */
public void setDark(boolean dark,boolean fade,long delay){
  mDark=dark;
}

Fixed version (ground truth):
/** 
 * In dark mode, we draw as little as possible, assuming a black background.
 * @param dark whether we should display ourselves in dark mode
 * @param fade whether to animate the transition if the mode changes
 * @param delay if fading, the delay of the animation
 */
public void setDark(boolean dark,boolean fade,long delay){
  mDark=dark;
  mDarkInitialized=true;
}
Program: 192618
Project: 192618
Buggy source:
/** 
 * Notifies this wrapper that the content of the view might have changed.
 * @param notification
 */
public void notifyContentUpdated(StatusBarNotification notification){
  mDark=false;
}

Fixed version (ground truth):
/** 
 * Notifies this wrapper that the content of the view might have changed.
 * @param notification
 */
public void notifyContentUpdated(StatusBarNotification notification){
  mDarkInitialized=false;
}
Program: 192621
Project: 192621
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;
    }
    mScroller.fling(mScrollX,mOwnScrollY,1,velocityY,0,0,0,Math.max(0,scrollRange),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) {
      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();
  }
}
Program: 192622
Project: 192622
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;
    }
    mScroller.fling(mScrollX,mOwnScrollY,1,velocityY,0,0,0,Math.max(0,scrollRange),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) {
      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();
  }
}