nus-yam/ex-repair huggingface dataset:
Program: 4
Project: 4
Buggy source:
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STATS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}

Fixed version (ground truth):
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STARTS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}
Program: 6
Project: 6
Buggy source:
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}

Fixed version (ground truth):
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}
Program: 7
Project: 7
Buggy source:
public void createStack(int stackId,int displayId){
  mH.sendMessage(mH.obtainMessage(H.CREATE_STACK,stackId,displayId));
}

Fixed version (ground truth):
/** 
 * Create a new TaskStack and place it on a DisplayContent.
 * @param stackId The unique identifier of the new stack.
 * @param displayId The unique identifier of the DisplayContent.
 */
public void createStack(int stackId,int displayId){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      final DisplayContent displayContent=mDisplayContents.get(displayId);
      if (displayContent != null) {
        TaskStack stack=displayContent.createStack(stackId);
        mStackIdToStack.put(stackId,stack);
        performLayoutAndPlaceSurfacesLocked();
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 9
Project: 9
Buggy source:
public void createStack(int stackId,int displayId){
  mH.sendMessage(mH.obtainMessage(H.CREATE_STACK,stackId,displayId));
}

Fixed version (ground truth):
/** 
 * Create a new TaskStack and place it on a DisplayContent.
 * @param stackId The unique identifier of the new stack.
 * @param displayId The unique identifier of the DisplayContent.
 */
public void createStack(int stackId,int displayId){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      final DisplayContent displayContent=mDisplayContents.get(displayId);
      if (displayContent != null) {
        TaskStack stack=displayContent.createStack(stackId);
        mStackIdToStack.put(stackId,stack);
        performLayoutAndPlaceSurfacesLocked();
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 11
Project: 11
Buggy source:
public void createStack(int stackId,int displayId){
  mH.sendMessage(mH.obtainMessage(H.CREATE_STACK,stackId,displayId));
}

Fixed version (ground truth):
/** 
 * Create a new TaskStack and place it on a DisplayContent.
 * @param stackId The unique identifier of the new stack.
 * @param displayId The unique identifier of the DisplayContent.
 */
public void createStack(int stackId,int displayId){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      final DisplayContent displayContent=mDisplayContents.get(displayId);
      if (displayContent != null) {
        TaskStack stack=displayContent.createStack(stackId);
        mStackIdToStack.put(stackId,stack);
        performLayoutAndPlaceSurfacesLocked();
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 13
Project: 13
Buggy source:
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  if (item.hasSubMenu()) {
    actionView.setOnTouchListener(new ForwardingListener(actionView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionView.setOnTouchListener(null);
  }
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}

Fixed version (ground truth):
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}
Program: 14
Project: 14
Buggy source:
@Override public void bindItemView(MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
}

Fixed version (ground truth):
@Override public void bindItemView(final MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  final ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
  if (item.hasSubMenu()) {
    actionItemView.setOnTouchListener(new ForwardingListener(actionItemView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionItemView.setOnTouchListener(null);
  }
}
Program: 15
Project: 15
Buggy source:
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  if (item.hasSubMenu()) {
    actionView.setOnTouchListener(new ForwardingListener(actionView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionView.setOnTouchListener(null);
  }
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}

Fixed version (ground truth):
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}
Program: 16
Project: 16
Buggy source:
@Override public void bindItemView(MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
}

Fixed version (ground truth):
@Override public void bindItemView(final MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  final ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
  if (item.hasSubMenu()) {
    actionItemView.setOnTouchListener(new ForwardingListener(actionItemView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionItemView.setOnTouchListener(null);
  }
}
Program: 17
Project: 17
Buggy source:
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  if (item.hasSubMenu()) {
    actionView.setOnTouchListener(new ForwardingListener(actionView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionView.setOnTouchListener(null);
  }
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}

Fixed version (ground truth):
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}
Program: 18
Project: 18
Buggy source:
@Override public void bindItemView(MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
}

Fixed version (ground truth):
@Override public void bindItemView(final MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  final ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
  if (item.hasSubMenu()) {
    actionItemView.setOnTouchListener(new ForwardingListener(actionItemView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionItemView.setOnTouchListener(null);
  }
}
Program: 19
Project: 19
Buggy source:
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  if (item.hasSubMenu()) {
    actionView.setOnTouchListener(new ForwardingListener(actionView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionView.setOnTouchListener(null);
  }
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}

Fixed version (ground truth):
@Override public View getItemView(final MenuItemImpl item,View convertView,ViewGroup parent){
  View actionView=item.getActionView();
  if (actionView == null || item.hasCollapsibleActionView()) {
    actionView=super.getItemView(item,convertView,parent);
  }
  actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
  final ActionMenuView menuParent=(ActionMenuView)parent;
  final ViewGroup.LayoutParams lp=actionView.getLayoutParams();
  if (!menuParent.checkLayoutParams(lp)) {
    actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
  }
  return actionView;
}
Program: 20
Project: 20
Buggy source:
@Override public void bindItemView(MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
}

Fixed version (ground truth):
@Override public void bindItemView(final MenuItemImpl item,MenuView.ItemView itemView){
  itemView.initialize(item,0);
  final ActionMenuView menuView=(ActionMenuView)mMenuView;
  final ActionMenuItemView actionItemView=(ActionMenuItemView)itemView;
  actionItemView.setItemInvoker(menuView);
  if (item.hasSubMenu()) {
    actionItemView.setOnTouchListener(new ForwardingListener(actionItemView){
      @Override public ListPopupWindow getPopup(){
        return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null;
      }
      @Override protected boolean onForwardingStarted(){
        return onSubMenuSelected((SubMenuBuilder)item.getSubMenu());
      }
      @Override protected boolean onForwardingStopped(){
        return dismissPopupMenus();
      }
    }
);
  }
 else {
    actionItemView.setOnTouchListener(null);
  }
}
Program: 21
Project: 21
Buggy source:
@Override public void onRtlPropertiesChanged(int layoutDirection){
  super.onRtlPropertiesChanged(layoutDirection);
  mTextDir=getTextDirectionHeuristic();
}

Fixed version (ground truth):
@Override public void onRtlPropertiesChanged(int layoutDirection){
  super.onRtlPropertiesChanged(layoutDirection);
  mTextDir=getTextDirectionHeuristic();
  if (mLayout != null) {
    checkForRelayout();
  }
}
Program: 22
Project: 22
Buggy source:
private void handleDisable(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  stopNavigating();
  mAlarmManager.cancel(mWakeupIntent);
  mAlarmManager.cancel(mTimeoutIntent);
  native_cleanup();
}

Fixed version (ground truth):
private void handleDisable(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  updateClientUids(new WorkSource());
  stopNavigating();
  mAlarmManager.cancel(mWakeupIntent);
  mAlarmManager.cancel(mTimeoutIntent);
  native_cleanup();
}
Program: 23
Project: 23
Buggy source:
private void handleDisable(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  stopNavigating();
  mAlarmManager.cancel(mWakeupIntent);
  mAlarmManager.cancel(mTimeoutIntent);
  native_cleanup();
}

Fixed version (ground truth):
private void handleDisable(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  updateClientUids(new WorkSource());
  stopNavigating();
  mAlarmManager.cancel(mWakeupIntent);
  mAlarmManager.cancel(mTimeoutIntent);
  native_cleanup();
}
Program: 29
Project: 29
Buggy source:
/** 
 * Adds the children of a given View for accessibility. Since some Views are not important for accessibility the children for accessibility are not necessarily direct children of the view, rather they are the first level of descendants important for accessibility.
 * @param children The list of children for accessibility.
 */
public void addChildrenForAccessibility(ArrayList<View> children){
  if (includeForAccessibility()) {
    children.add(this);
  }
}

Fixed version (ground truth):
/** 
 * Adds the children of a given View for accessibility. Since some Views are not important for accessibility the children for accessibility are not necessarily direct children of the view, rather they are the first level of descendants important for accessibility.
 * @param children The list of children for accessibility.
 */
public void addChildrenForAccessibility(ArrayList<View> children){
}
Program: 30
Project: 30
Buggy source:
/** 
 * Convenience method for sending a   {@link AccessibilityEvent#TYPE_ANNOUNCEMENT}{@link AccessibilityEvent} to make an announcement which is related to somesort of a context change for which none of the events representing UI transitions is a good fit. For example, announcing a new page in a book. If accessibility is not enabled this method does nothing.
 * @param text The announcement text.
 */
public void announceForAccessibility(CharSequence text){
  if (AccessibilityManager.getInstance(mContext).isEnabled() && mParent != null) {
    AccessibilityEvent event=AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT);
    onInitializeAccessibilityEvent(event);
    event.getText().add(text);
    event.setContentDescription(null);
    mParent.requestSendAccessibilityEvent(this,event);
  }
}

Fixed version (ground truth):
/** 
 * Convenience method for sending a   {@link AccessibilityEvent#TYPE_ANNOUNCEMENT}{@link AccessibilityEvent} to make an announcement which is related to somesort of a context change for which none of the events representing UI transitions is a good fit. For example, announcing a new page in a book. If accessibility is not enabled this method does nothing.
 * @param text The announcement text.
 */
public void announceForAccessibility(CharSequence text){
  if (AccessibilityManager.getInstance(mContext).isEnabled() && mParent != null && isImportantForAccessibility()) {
    AccessibilityEvent event=AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT);
    onInitializeAccessibilityEvent(event);
    event.getText().add(text);
    event.setContentDescription(null);
    mParent.requestSendAccessibilityEvent(this,event);
  }
}
Program: 31
Project: 31
Buggy source:
/** 
 * @see #sendAccessibilityEventUnchecked(AccessibilityEvent) Note: Called from the default  {@link AccessibilityDelegate}.
 */
void sendAccessibilityEventUncheckedInternal(AccessibilityEvent event){
  if (!isShown()) {
    return;
  }
  onInitializeAccessibilityEvent(event);
  if ((event.getEventType() & POPULATING_ACCESSIBILITY_EVENT_TYPES) != 0) {
    dispatchPopulateAccessibilityEvent(event);
  }
  getParent().requestSendAccessibilityEvent(this,event);
}

Fixed version (ground truth):
/** 
 * @see #sendAccessibilityEventUnchecked(AccessibilityEvent) Note: Called from the default  {@link AccessibilityDelegate}.
 */
void sendAccessibilityEventUncheckedInternal(AccessibilityEvent event){
  if (!isShown() || !isImportantForAccessibility()) {
    return;
  }
  onInitializeAccessibilityEvent(event);
  if ((event.getEventType() & POPULATING_ACCESSIBILITY_EVENT_TYPES) != 0) {
    dispatchPopulateAccessibilityEvent(event);
  }
  getParent().requestSendAccessibilityEvent(this,event);
}
Program: 32
Project: 32
Buggy source:
/** 
 * Caches an   {@link AccessibilityNodeInfo} given its accessibility node id.
 * @param info The {@link AccessibilityNodeInfo} to cache.
 */
public void add(AccessibilityNodeInfo info){
  if (ENABLED) {
synchronized (mLock) {
      if (DEBUG) {
        Log.i(LOG_TAG,"String_Node_Str" + info + "String_Node_Str");
      }
      final long sourceId=info.getSourceNodeId();
      AccessibilityNodeInfo oldInfo=mCacheImpl.get(sourceId);
      if (oldInfo != null) {
        final LongArray newChildrenIds=info.getChildNodeIds();
        final int oldChildCount=oldInfo.getChildCount();
        for (int i=0; i < oldChildCount; i++) {
          final long oldChildId=oldInfo.getChildId(i);
          if (newChildrenIds.indexOf(oldChildId) < 0) {
            clearSubTreeLocked(oldChildId);
          }
        }
        final long oldParentId=oldInfo.getParentNodeId();
        if (info.getParentNodeId() != oldParentId) {
          clearSubTreeLocked(oldParentId);
        }
      }
      AccessibilityNodeInfo clone=AccessibilityNodeInfo.obtain(info);
      mCacheImpl.put(sourceId,clone);
    }
  }
}

Fixed version (ground truth):
/** 
 * Caches an   {@link AccessibilityNodeInfo} given its accessibility node id.
 * @param info The {@link AccessibilityNodeInfo} to cache.
 */
public void add(AccessibilityNodeInfo info){
  if (ENABLED) {
synchronized (mLock) {
      if (DEBUG) {
        Log.i(LOG_TAG,"String_Node_Str" + info + "String_Node_Str");
      }
      final long sourceId=info.getSourceNodeId();
      AccessibilityNodeInfo oldInfo=mCacheImpl.get(sourceId);
      if (oldInfo != null) {
        final LongArray newChildrenIds=info.getChildNodeIds();
        if (newChildrenIds != null) {
          final int oldChildCount=oldInfo.getChildCount();
          for (int i=0; i < oldChildCount; i++) {
            final long oldChildId=oldInfo.getChildId(i);
            if (newChildrenIds.indexOf(oldChildId) < 0) {
              clearSubTreeLocked(oldChildId);
            }
          }
        }
        final long oldParentId=oldInfo.getParentNodeId();
        if (info.getParentNodeId() != oldParentId) {
          clearSubTreeLocked(oldParentId);
        }
      }
      AccessibilityNodeInfo clone=AccessibilityNodeInfo.obtain(info);
      mCacheImpl.put(sourceId,clone);
    }
  }
}
Program: 33
Project: 33
Buggy source:
/** 
 * Adds the children of a given View for accessibility. Since some Views are not important for accessibility the children for accessibility are not necessarily direct children of the view, rather they are the first level of descendants important for accessibility.
 * @param children The list of children for accessibility.
 */
public void addChildrenForAccessibility(ArrayList<View> children){
  if (includeForAccessibility()) {
    children.add(this);
  }
}

Fixed version (ground truth):
/** 
 * Adds the children of a given View for accessibility. Since some Views are not important for accessibility the children for accessibility are not necessarily direct children of the view, rather they are the first level of descendants important for accessibility.
 * @param children The list of children for accessibility.
 */
public void addChildrenForAccessibility(ArrayList<View> children){
}
Program: 34
Project: 34
Buggy source:
/** 
 * Convenience method for sending a   {@link AccessibilityEvent#TYPE_ANNOUNCEMENT}{@link AccessibilityEvent} to make an announcement which is related to somesort of a context change for which none of the events representing UI transitions is a good fit. For example, announcing a new page in a book. If accessibility is not enabled this method does nothing.
 * @param text The announcement text.
 */
public void announceForAccessibility(CharSequence text){
  if (AccessibilityManager.getInstance(mContext).isEnabled() && mParent != null) {
    AccessibilityEvent event=AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT);
    onInitializeAccessibilityEvent(event);
    event.getText().add(text);
    event.setContentDescription(null);
    mParent.requestSendAccessibilityEvent(this,event);
  }
}

Fixed version (ground truth):
/** 
 * Convenience method for sending a   {@link AccessibilityEvent#TYPE_ANNOUNCEMENT}{@link AccessibilityEvent} to make an announcement which is related to somesort of a context change for which none of the events representing UI transitions is a good fit. For example, announcing a new page in a book. If accessibility is not enabled this method does nothing.
 * @param text The announcement text.
 */
public void announceForAccessibility(CharSequence text){
  if (AccessibilityManager.getInstance(mContext).isEnabled() && mParent != null && isImportantForAccessibility()) {
    AccessibilityEvent event=AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT);
    onInitializeAccessibilityEvent(event);
    event.getText().add(text);
    event.setContentDescription(null);
    mParent.requestSendAccessibilityEvent(this,event);
  }
}
Program: 35
Project: 35
Buggy source:
/** 
 * @see #sendAccessibilityEventUnchecked(AccessibilityEvent) Note: Called from the default  {@link AccessibilityDelegate}.
 */
void sendAccessibilityEventUncheckedInternal(AccessibilityEvent event){
  if (!isShown()) {
    return;
  }
  onInitializeAccessibilityEvent(event);
  if ((event.getEventType() & POPULATING_ACCESSIBILITY_EVENT_TYPES) != 0) {
    dispatchPopulateAccessibilityEvent(event);
  }
  getParent().requestSendAccessibilityEvent(this,event);
}

Fixed version (ground truth):
/** 
 * @see #sendAccessibilityEventUnchecked(AccessibilityEvent) Note: Called from the default  {@link AccessibilityDelegate}.
 */
void sendAccessibilityEventUncheckedInternal(AccessibilityEvent event){
  if (!isShown() || !isImportantForAccessibility()) {
    return;
  }
  onInitializeAccessibilityEvent(event);
  if ((event.getEventType() & POPULATING_ACCESSIBILITY_EVENT_TYPES) != 0) {
    dispatchPopulateAccessibilityEvent(event);
  }
  getParent().requestSendAccessibilityEvent(this,event);
}
Program: 36
Project: 36
Buggy source:
/** 
 * Caches an   {@link AccessibilityNodeInfo} given its accessibility node id.
 * @param info The {@link AccessibilityNodeInfo} to cache.
 */
public void add(AccessibilityNodeInfo info){
  if (ENABLED) {
synchronized (mLock) {
      if (DEBUG) {
        Log.i(LOG_TAG,"String_Node_Str" + info + "String_Node_Str");
      }
      final long sourceId=info.getSourceNodeId();
      AccessibilityNodeInfo oldInfo=mCacheImpl.get(sourceId);
      if (oldInfo != null) {
        final LongArray newChildrenIds=info.getChildNodeIds();
        final int oldChildCount=oldInfo.getChildCount();
        for (int i=0; i < oldChildCount; i++) {
          final long oldChildId=oldInfo.getChildId(i);
          if (newChildrenIds.indexOf(oldChildId) < 0) {
            clearSubTreeLocked(oldChildId);
          }
        }
        final long oldParentId=oldInfo.getParentNodeId();
        if (info.getParentNodeId() != oldParentId) {
          clearSubTreeLocked(oldParentId);
        }
      }
      AccessibilityNodeInfo clone=AccessibilityNodeInfo.obtain(info);
      mCacheImpl.put(sourceId,clone);
    }
  }
}

Fixed version (ground truth):
/** 
 * Caches an   {@link AccessibilityNodeInfo} given its accessibility node id.
 * @param info The {@link AccessibilityNodeInfo} to cache.
 */
public void add(AccessibilityNodeInfo info){
  if (ENABLED) {
synchronized (mLock) {
      if (DEBUG) {
        Log.i(LOG_TAG,"String_Node_Str" + info + "String_Node_Str");
      }
      final long sourceId=info.getSourceNodeId();
      AccessibilityNodeInfo oldInfo=mCacheImpl.get(sourceId);
      if (oldInfo != null) {
        final LongArray newChildrenIds=info.getChildNodeIds();
        if (newChildrenIds != null) {
          final int oldChildCount=oldInfo.getChildCount();
          for (int i=0; i < oldChildCount; i++) {
            final long oldChildId=oldInfo.getChildId(i);
            if (newChildrenIds.indexOf(oldChildId) < 0) {
              clearSubTreeLocked(oldChildId);
            }
          }
        }
        final long oldParentId=oldInfo.getParentNodeId();
        if (info.getParentNodeId() != oldParentId) {
          clearSubTreeLocked(oldParentId);
        }
      }
      AccessibilityNodeInfo clone=AccessibilityNodeInfo.obtain(info);
      mCacheImpl.put(sourceId,clone);
    }
  }
}
Program: 37
Project: 37
Buggy source:
private void updateMinScale(int w,int h,TileSource source,boolean resetScale){
synchronized (mLock) {
    if (resetScale) {
      mRenderer.scale=1;
    }
    if (source != null) {
      final float[] imageDims=getImageDims();
      final float imageWidth=imageDims[0];
      final float imageHeight=imageDims[1];
      mMinScale=Math.max(w / imageWidth,h / imageHeight);
      mRenderer.scale=Math.max(mMinScale,mRenderer.scale);
    }
  }
}

Fixed version (ground truth):
private void updateMinScale(int w,int h,TileSource source,boolean resetScale){
synchronized (mLock) {
    if (resetScale) {
      mRenderer.scale=1;
    }
    if (source != null) {
      final float[] imageDims=getImageDims();
      final float imageWidth=imageDims[0];
      final float imageHeight=imageDims[1];
      mMinScale=Math.max(w / imageWidth,h / imageHeight);
      mRenderer.scale=Math.max(mMinScale,resetScale ? Float.MIN_VALUE : mRenderer.scale);
    }
  }
}
Program: 39
Project: 39
Buggy source:
public void run(){
  int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
  int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
  wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
}

Fixed version (ground truth):
public void run(){
  updateWallpaperDimensions(outWidth,outHeight);
  if (finishActivityWhenDone) {
    setResult(Activity.RESULT_OK);
    finish();
  }
}
Program: 40
Project: 40
Buggy source:
static public void suggestWallpaperDimension(Resources res,final SharedPreferences sharedPrefs,WindowManager windowManager,final WallpaperManager wallpaperManager){
  final Point defaultWallpaperSize=getDefaultWallpaperSize(res,windowManager);
  new Thread("String_Node_Str"){
    public void run(){
      int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
      int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
      wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
    }
  }
.start();
}

Fixed version (ground truth):
static public void suggestWallpaperDimension(Resources res,final SharedPreferences sharedPrefs,WindowManager windowManager,final WallpaperManager wallpaperManager){
  final Point defaultWallpaperSize=getDefaultWallpaperSize(res,windowManager);
  new AsyncTask<Void,Void,Void>(){
    public Void doInBackground(    Void... args){
      int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
      int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
      wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
      return null;
    }
  }
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,(Void)null);
}
Program: 41
Project: 41
Buggy source:
@Override protected Boolean doInBackground(Void... params){
  return cropBitmap();
}

Fixed version (ground truth):
public Void doInBackground(Void... args){
  int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
  int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
  wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
  return null;
}
Program: 42
Project: 42
Buggy source:
private void updateMinScale(int w,int h,TileSource source,boolean resetScale){
synchronized (mLock) {
    if (resetScale) {
      mRenderer.scale=1;
    }
    if (source != null) {
      final float[] imageDims=getImageDims();
      final float imageWidth=imageDims[0];
      final float imageHeight=imageDims[1];
      mMinScale=Math.max(w / imageWidth,h / imageHeight);
      mRenderer.scale=Math.max(mMinScale,mRenderer.scale);
    }
  }
}

Fixed version (ground truth):
private void updateMinScale(int w,int h,TileSource source,boolean resetScale){
synchronized (mLock) {
    if (resetScale) {
      mRenderer.scale=1;
    }
    if (source != null) {
      final float[] imageDims=getImageDims();
      final float imageWidth=imageDims[0];
      final float imageHeight=imageDims[1];
      mMinScale=Math.max(w / imageWidth,h / imageHeight);
      mRenderer.scale=Math.max(mMinScale,resetScale ? Float.MIN_VALUE : mRenderer.scale);
    }
  }
}
Program: 44
Project: 44
Buggy source:
public void run(){
  int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
  int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
  wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
}

Fixed version (ground truth):
public void run(){
  updateWallpaperDimensions(outWidth,outHeight);
  if (finishActivityWhenDone) {
    setResult(Activity.RESULT_OK);
    finish();
  }
}
Program: 45
Project: 45
Buggy source:
static public void suggestWallpaperDimension(Resources res,final SharedPreferences sharedPrefs,WindowManager windowManager,final WallpaperManager wallpaperManager){
  final Point defaultWallpaperSize=getDefaultWallpaperSize(res,windowManager);
  new Thread("String_Node_Str"){
    public void run(){
      int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
      int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
      wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
    }
  }
.start();
}

Fixed version (ground truth):
static public void suggestWallpaperDimension(Resources res,final SharedPreferences sharedPrefs,WindowManager windowManager,final WallpaperManager wallpaperManager){
  final Point defaultWallpaperSize=getDefaultWallpaperSize(res,windowManager);
  new AsyncTask<Void,Void,Void>(){
    public Void doInBackground(    Void... args){
      int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
      int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
      wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
      return null;
    }
  }
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,(Void)null);
}
Program: 46
Project: 46
Buggy source:
@Override protected Boolean doInBackground(Void... params){
  return cropBitmap();
}

Fixed version (ground truth):
public Void doInBackground(Void... args){
  int savedWidth=sharedPrefs.getInt(WALLPAPER_WIDTH_KEY,defaultWallpaperSize.x);
  int savedHeight=sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY,defaultWallpaperSize.y);
  wallpaperManager.suggestDesiredDimensions(savedWidth,savedHeight);
  return null;
}
Program: 51
Project: 51
Buggy source:
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STATS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}

Fixed version (ground truth):
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STARTS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}
Program: 53
Project: 53
Buggy source:
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}

Fixed version (ground truth):
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}
Program: 58
Project: 58
Buggy source:
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STATS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}

Fixed version (ground truth):
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STARTS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}
Program: 60
Project: 60
Buggy source:
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}

Fixed version (ground truth):
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}
Program: 65
Project: 65
Buggy source:
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STATS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}

Fixed version (ground truth):
ComponentName startServiceInnerLocked(ServiceMap smap,Intent service,ServiceRecord r,boolean callerFg,boolean addToStarting){
  ProcessStats.ServiceState stracker=r.getTracker();
  if (stracker != null) {
    stracker.setStarted(true,mAm.mProcessStats.getMemFactorLocked(),r.lastActivity);
  }
  r.callStart=false;
synchronized (r.stats.getBatteryStats()) {
    r.stats.startRunningLocked();
  }
  String error=bringUpServiceLocked(r,service.getFlags(),callerFg,false);
  if (error != null) {
    return new ComponentName("String_Node_Str",error);
  }
  if (r.startRequested && addToStarting) {
    boolean first=smap.mStartingBackground.size() == 0;
    smap.mStartingBackground.add(r);
    r.startingBgTimeout=SystemClock.uptimeMillis() + BG_START_TIMEOUT;
    if (DEBUG_DELAYED_SERVICE) {
      RuntimeException here=new RuntimeException("String_Node_Str");
      here.fillInStackTrace();
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r,here);
    }
 else     if (DEBUG_DELAYED_STARTS) {
      Slog.v(TAG,"String_Node_Str" + first + "String_Node_Str"+ r);
    }
    if (first) {
      smap.rescheduleDelayedStarts();
    }
  }
 else   if (callerFg) {
    smap.ensureNotStartingBackground(r);
  }
  return r.name;
}
Program: 67
Project: 67
Buggy source:
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STATS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}

Fixed version (ground truth):
void ensureNotStartingBackground(ServiceRecord r){
  if (mStartingBackground.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
    rescheduleDelayedStarts();
  }
  if (mDelayedStartList.remove(r)) {
    if (DEBUG_DELAYED_STARTS)     Slog.v(TAG,"String_Node_Str" + r);
  }
}
Program: 68
Project: 68
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  mMenu.performItemAction(mAdapter.getItem(position),0);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  mMenu.performItemAction(mAdapter.getItem(position),this,0);
}
Program: 69
Project: 69
Buggy source:
private boolean dispatchSubMenuSelected(SubMenuBuilder subMenu){
  if (mPresenters.isEmpty())   return false;
  boolean result=false;
  for (  WeakReference<MenuPresenter> ref : mPresenters) {
    final MenuPresenter presenter=ref.get();
    if (presenter == null) {
      mPresenters.remove(ref);
    }
 else     if (!result) {
      result=presenter.onSubMenuSelected(subMenu);
    }
  }
  return result;
}

Fixed version (ground truth):
private boolean dispatchSubMenuSelected(SubMenuBuilder subMenu,MenuPresenter preferredPresenter){
  if (mPresenters.isEmpty())   return false;
  boolean result=false;
  if (preferredPresenter != null) {
    result=preferredPresenter.onSubMenuSelected(subMenu);
  }
  for (  WeakReference<MenuPresenter> ref : mPresenters) {
    final MenuPresenter presenter=ref.get();
    if (presenter == null) {
      mPresenters.remove(ref);
    }
 else     if (!result) {
      result=presenter.onSubMenuSelected(subMenu);
    }
  }
  return result;
}