nus-yam/ex-repair huggingface dataset:
Program: 193508
Project: 193508
Buggy source:
RowViewHolder createViewHolder(ViewGroup parent){
  final ViewGroup row=(ViewGroup)mLayoutInflater.inflate(R.layout.chooser_row,parent,false);
  final RowViewHolder holder=new RowViewHolder(row,mColumnCount);
  final int spec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  for (int i=0; i < mColumnCount; i++) {
    final View v=mChooserListAdapter.createView(row);
    v.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startSelected(holder.itemIndex,false,true);
      }
    }
);
    v.setOnLongClickListener(new OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndex,true));
        return true;
      }
    }
);
    row.addView(v);
    holder.cells[i]=v;
    LayoutParams lp=v.getLayoutParams();
    v.measure(spec,spec);
    if (lp == null) {
      lp=new LayoutParams(LayoutParams.MATCH_PARENT,v.getMeasuredHeight());
      row.setLayoutParams(lp);
    }
 else {
      lp.height=v.getMeasuredHeight();
    }
  }
  holder.measure();
  LayoutParams lp=row.getLayoutParams();
  if (lp == null) {
    lp=new LayoutParams(LayoutParams.MATCH_PARENT,holder.measuredRowHeight);
    row.setLayoutParams(lp);
  }
 else {
    lp.height=holder.measuredRowHeight;
  }
  row.setTag(holder);
  return holder;
}

Fixed version (ground truth):
RowViewHolder createViewHolder(ViewGroup parent){
  final ViewGroup row=(ViewGroup)mLayoutInflater.inflate(R.layout.chooser_row,parent,false);
  final RowViewHolder holder=new RowViewHolder(row,mColumnCount);
  final int spec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  for (int i=0; i < mColumnCount; i++) {
    final View v=mChooserListAdapter.createView(row);
    final int column=i;
    v.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startSelected(holder.itemIndices[column],false,true);
      }
    }
);
    v.setOnLongClickListener(new OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndices[column],true));
        return true;
      }
    }
);
    row.addView(v);
    holder.cells[i]=v;
    LayoutParams lp=v.getLayoutParams();
    v.measure(spec,spec);
    if (lp == null) {
      lp=new LayoutParams(LayoutParams.MATCH_PARENT,v.getMeasuredHeight());
      row.setLayoutParams(lp);
    }
 else {
      lp.height=v.getMeasuredHeight();
    }
  }
  holder.measure();
  LayoutParams lp=row.getLayoutParams();
  if (lp == null) {
    lp=new LayoutParams(LayoutParams.MATCH_PARENT,holder.measuredRowHeight);
    row.setLayoutParams(lp);
  }
 else {
    lp.height=holder.measuredRowHeight;
  }
  row.setTag(holder);
  return holder;
}
Program: 193509
Project: 193509
Buggy source:
public RowViewHolder(ViewGroup row,int cellCount){
  this.row=row;
  this.cells=new View[cellCount];
}

Fixed version (ground truth):
public RowViewHolder(ViewGroup row,int cellCount){
  this.row=row;
  this.cells=new View[cellCount];
  this.itemIndices=new int[cellCount];
}
Program: 193510
Project: 193510
Buggy source:
public ChooserRowAdapter(ChooserListAdapter wrappedAdapter){
  mChooserListAdapter=wrappedAdapter;
  mLayoutInflater=LayoutInflater.from(ChooserActivity.this);
  mInterpolator=AnimationUtils.loadInterpolator(ChooserActivity.this,android.R.interpolator.decelerate_quint);
  wrappedAdapter.registerDataSetObserver(new DataSetObserver(){
    @Override public void onChanged(){
      super.onChanged();
      final int rcount=getServiceTargetRowCount();
      if (mServiceTargetScale == null || mServiceTargetScale.length != rcount) {
        RowScale[] old=mServiceTargetScale;
        int oldRCount=old != null ? old.length : 0;
        mServiceTargetScale=new RowScale[rcount];
        if (old != null && rcount > 0) {
          System.arraycopy(old,0,mServiceTargetScale,0,Math.min(old.length,rcount));
        }
        for (int i=rcount; i < oldRCount; i++) {
          old[i].cancelAnimation();
        }
        for (int i=oldRCount; i < rcount; i++) {
          final RowScale rs=new RowScale(ChooserRowAdapter.this,0.f,1.f).setInterpolator(mInterpolator);
          mServiceTargetScale[i]=rs;
          rs.startAnimation();
        }
      }
      notifyDataSetChanged();
    }
    @Override public void onInvalidated(){
      super.onInvalidated();
      notifyDataSetInvalidated();
      if (mServiceTargetScale != null) {
        for (        RowScale rs : mServiceTargetScale) {
          rs.cancelAnimation();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public ChooserRowAdapter(ChooserListAdapter wrappedAdapter){
  mChooserListAdapter=wrappedAdapter;
  mLayoutInflater=LayoutInflater.from(ChooserActivity.this);
  mInterpolator=AnimationUtils.loadInterpolator(ChooserActivity.this,android.R.interpolator.decelerate_quint);
  wrappedAdapter.registerDataSetObserver(new DataSetObserver(){
    @Override public void onChanged(){
      super.onChanged();
      final int rcount=getServiceTargetRowCount();
      if (mServiceTargetScale == null || mServiceTargetScale.length != rcount) {
        RowScale[] old=mServiceTargetScale;
        int oldRCount=old != null ? old.length : 0;
        mServiceTargetScale=new RowScale[rcount];
        if (old != null && rcount > 0) {
          System.arraycopy(old,0,mServiceTargetScale,0,Math.min(old.length,rcount));
        }
        for (int i=rcount; i < oldRCount; i++) {
          old[i].cancelAnimation();
        }
        for (int i=oldRCount; i < rcount; i++) {
          final RowScale rs=new RowScale(ChooserRowAdapter.this,0.f,1.f).setInterpolator(mInterpolator);
          mServiceTargetScale[i]=rs;
        }
        for (int i=oldRCount; i < rcount; i++) {
          mServiceTargetScale[i].startAnimation();
        }
      }
      notifyDataSetChanged();
    }
    @Override public void onInvalidated(){
      super.onInvalidated();
      notifyDataSetInvalidated();
      if (mServiceTargetScale != null) {
        for (        RowScale rs : mServiceTargetScale) {
          rs.cancelAnimation();
        }
      }
    }
  }
);
}
Program: 193511
Project: 193511
Buggy source:
void bindViewHolder(int rowPosition,RowViewHolder holder){
  final int start=getFirstRowPosition(rowPosition);
  final int startType=mChooserListAdapter.getPositionTargetType(start);
  int end=start + mColumnCount - 1;
  while (mChooserListAdapter.getPositionTargetType(end) != startType && end >= start) {
    end--;
  }
  if (startType == ChooserListAdapter.TARGET_SERVICE) {
    holder.row.setBackgroundColor(getColor(R.color.chooser_service_row_background_color));
  }
 else {
    holder.row.setBackgroundColor(Color.TRANSPARENT);
  }
  final int oldHeight=holder.row.getLayoutParams().height;
  holder.row.getLayoutParams().height=Math.max(1,(int)(holder.measuredRowHeight * getRowScale(rowPosition)));
  if (holder.row.getLayoutParams().height != oldHeight) {
    holder.row.requestLayout();
  }
  for (int i=0; i < mColumnCount; i++) {
    final View v=holder.cells[i];
    if (start + i <= end) {
      v.setVisibility(View.VISIBLE);
      holder.itemIndex=start + i;
      mChooserListAdapter.bindView(holder.itemIndex,v);
    }
 else {
      v.setVisibility(View.GONE);
    }
  }
}

Fixed version (ground truth):
void bindViewHolder(int rowPosition,RowViewHolder holder){
  final int start=getFirstRowPosition(rowPosition);
  final int startType=mChooserListAdapter.getPositionTargetType(start);
  int end=start + mColumnCount - 1;
  while (mChooserListAdapter.getPositionTargetType(end) != startType && end >= start) {
    end--;
  }
  if (startType == ChooserListAdapter.TARGET_SERVICE) {
    holder.row.setBackgroundColor(getColor(R.color.chooser_service_row_background_color));
  }
 else {
    holder.row.setBackgroundColor(Color.TRANSPARENT);
  }
  final int oldHeight=holder.row.getLayoutParams().height;
  holder.row.getLayoutParams().height=Math.max(1,(int)(holder.measuredRowHeight * getRowScale(rowPosition)));
  if (holder.row.getLayoutParams().height != oldHeight) {
    holder.row.requestLayout();
  }
  for (int i=0; i < mColumnCount; i++) {
    final View v=holder.cells[i];
    if (start + i <= end) {
      v.setVisibility(View.VISIBLE);
      holder.itemIndices[i]=start + i;
      mChooserListAdapter.bindView(holder.itemIndices[i],v);
    }
 else {
      v.setVisibility(View.GONE);
    }
  }
}
Program: 193512
Project: 193512
Buggy source:
@Override public void onChanged(){
  if (mResolverDrawerLayout == null) {
    return;
  }
  final int chooserTargetRows=mChooserRowAdapter.getServiceTargetRowCount();
  int offset=0;
  for (int i=0; i < chooserTargetRows; i++) {
    final int pos=mChooserRowAdapter.getCallerTargetRowCount() + i;
    final int vt=mChooserRowAdapter.getItemViewType(pos);
    if (vt != mCachedViewType) {
      mCachedView=null;
    }
    final View v=mChooserRowAdapter.getView(pos,mCachedView,mListView);
    int height=((RowViewHolder)(v.getTag())).measuredRowHeight;
    offset+=(int)(height * mChooserRowAdapter.getRowScale(pos) * chooserTargetRows);
    if (vt >= 0) {
      mCachedViewType=vt;
      mCachedView=v;
    }
 else {
      mCachedViewType=-1;
    }
  }
  mResolverDrawerLayout.setCollapsibleHeightReserved(offset);
}

Fixed version (ground truth):
@Override public void onChanged(){
  if (mResolverDrawerLayout == null) {
    return;
  }
  final int chooserTargetRows=mChooserRowAdapter.getServiceTargetRowCount();
  int offset=0;
  for (int i=0; i < chooserTargetRows; i++) {
    final int pos=mChooserRowAdapter.getCallerTargetRowCount() + i;
    final int vt=mChooserRowAdapter.getItemViewType(pos);
    if (vt != mCachedViewType) {
      mCachedView=null;
    }
    final View v=mChooserRowAdapter.getView(pos,mCachedView,mListView);
    int height=((RowViewHolder)(v.getTag())).measuredRowHeight;
    offset+=(int)(height * mChooserRowAdapter.getRowScale(pos));
    if (vt >= 0) {
      mCachedViewType=vt;
      mCachedView=v;
    }
 else {
      mCachedViewType=-1;
    }
  }
  mResolverDrawerLayout.setCollapsibleHeightReserved(offset);
}
Program: 193513
Project: 193513
Buggy source:
@Override public boolean onLongClick(View v){
  showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndex,true));
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndices[column],true));
  return true;
}
Program: 193514
Project: 193514
Buggy source:
@Override public void onClick(View v){
  startSelected(holder.itemIndex,false,true);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  startSelected(holder.itemIndices[column],false,true);
}
Program: 193515
Project: 193515
Buggy source:
RowViewHolder createViewHolder(ViewGroup parent){
  final ViewGroup row=(ViewGroup)mLayoutInflater.inflate(R.layout.chooser_row,parent,false);
  final RowViewHolder holder=new RowViewHolder(row,mColumnCount);
  final int spec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  for (int i=0; i < mColumnCount; i++) {
    final View v=mChooserListAdapter.createView(row);
    v.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startSelected(holder.itemIndex,false,true);
      }
    }
);
    v.setOnLongClickListener(new OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndex,true));
        return true;
      }
    }
);
    row.addView(v);
    holder.cells[i]=v;
    LayoutParams lp=v.getLayoutParams();
    v.measure(spec,spec);
    if (lp == null) {
      lp=new LayoutParams(LayoutParams.MATCH_PARENT,v.getMeasuredHeight());
      row.setLayoutParams(lp);
    }
 else {
      lp.height=v.getMeasuredHeight();
    }
  }
  holder.measure();
  LayoutParams lp=row.getLayoutParams();
  if (lp == null) {
    lp=new LayoutParams(LayoutParams.MATCH_PARENT,holder.measuredRowHeight);
    row.setLayoutParams(lp);
  }
 else {
    lp.height=holder.measuredRowHeight;
  }
  row.setTag(holder);
  return holder;
}

Fixed version (ground truth):
RowViewHolder createViewHolder(ViewGroup parent){
  final ViewGroup row=(ViewGroup)mLayoutInflater.inflate(R.layout.chooser_row,parent,false);
  final RowViewHolder holder=new RowViewHolder(row,mColumnCount);
  final int spec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  for (int i=0; i < mColumnCount; i++) {
    final View v=mChooserListAdapter.createView(row);
    final int column=i;
    v.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startSelected(holder.itemIndices[column],false,true);
      }
    }
);
    v.setOnLongClickListener(new OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndices[column],true));
        return true;
      }
    }
);
    row.addView(v);
    holder.cells[i]=v;
    LayoutParams lp=v.getLayoutParams();
    v.measure(spec,spec);
    if (lp == null) {
      lp=new LayoutParams(LayoutParams.MATCH_PARENT,v.getMeasuredHeight());
      row.setLayoutParams(lp);
    }
 else {
      lp.height=v.getMeasuredHeight();
    }
  }
  holder.measure();
  LayoutParams lp=row.getLayoutParams();
  if (lp == null) {
    lp=new LayoutParams(LayoutParams.MATCH_PARENT,holder.measuredRowHeight);
    row.setLayoutParams(lp);
  }
 else {
    lp.height=holder.measuredRowHeight;
  }
  row.setTag(holder);
  return holder;
}
Program: 193516
Project: 193516
Buggy source:
public RowViewHolder(ViewGroup row,int cellCount){
  this.row=row;
  this.cells=new View[cellCount];
}

Fixed version (ground truth):
public RowViewHolder(ViewGroup row,int cellCount){
  this.row=row;
  this.cells=new View[cellCount];
  this.itemIndices=new int[cellCount];
}
Program: 193517
Project: 193517
Buggy source:
public ChooserRowAdapter(ChooserListAdapter wrappedAdapter){
  mChooserListAdapter=wrappedAdapter;
  mLayoutInflater=LayoutInflater.from(ChooserActivity.this);
  mInterpolator=AnimationUtils.loadInterpolator(ChooserActivity.this,android.R.interpolator.decelerate_quint);
  wrappedAdapter.registerDataSetObserver(new DataSetObserver(){
    @Override public void onChanged(){
      super.onChanged();
      final int rcount=getServiceTargetRowCount();
      if (mServiceTargetScale == null || mServiceTargetScale.length != rcount) {
        RowScale[] old=mServiceTargetScale;
        int oldRCount=old != null ? old.length : 0;
        mServiceTargetScale=new RowScale[rcount];
        if (old != null && rcount > 0) {
          System.arraycopy(old,0,mServiceTargetScale,0,Math.min(old.length,rcount));
        }
        for (int i=rcount; i < oldRCount; i++) {
          old[i].cancelAnimation();
        }
        for (int i=oldRCount; i < rcount; i++) {
          final RowScale rs=new RowScale(ChooserRowAdapter.this,0.f,1.f).setInterpolator(mInterpolator);
          mServiceTargetScale[i]=rs;
          rs.startAnimation();
        }
      }
      notifyDataSetChanged();
    }
    @Override public void onInvalidated(){
      super.onInvalidated();
      notifyDataSetInvalidated();
      if (mServiceTargetScale != null) {
        for (        RowScale rs : mServiceTargetScale) {
          rs.cancelAnimation();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public ChooserRowAdapter(ChooserListAdapter wrappedAdapter){
  mChooserListAdapter=wrappedAdapter;
  mLayoutInflater=LayoutInflater.from(ChooserActivity.this);
  mInterpolator=AnimationUtils.loadInterpolator(ChooserActivity.this,android.R.interpolator.decelerate_quint);
  wrappedAdapter.registerDataSetObserver(new DataSetObserver(){
    @Override public void onChanged(){
      super.onChanged();
      final int rcount=getServiceTargetRowCount();
      if (mServiceTargetScale == null || mServiceTargetScale.length != rcount) {
        RowScale[] old=mServiceTargetScale;
        int oldRCount=old != null ? old.length : 0;
        mServiceTargetScale=new RowScale[rcount];
        if (old != null && rcount > 0) {
          System.arraycopy(old,0,mServiceTargetScale,0,Math.min(old.length,rcount));
        }
        for (int i=rcount; i < oldRCount; i++) {
          old[i].cancelAnimation();
        }
        for (int i=oldRCount; i < rcount; i++) {
          final RowScale rs=new RowScale(ChooserRowAdapter.this,0.f,1.f).setInterpolator(mInterpolator);
          mServiceTargetScale[i]=rs;
        }
        for (int i=oldRCount; i < rcount; i++) {
          mServiceTargetScale[i].startAnimation();
        }
      }
      notifyDataSetChanged();
    }
    @Override public void onInvalidated(){
      super.onInvalidated();
      notifyDataSetInvalidated();
      if (mServiceTargetScale != null) {
        for (        RowScale rs : mServiceTargetScale) {
          rs.cancelAnimation();
        }
      }
    }
  }
);
}
Program: 193518
Project: 193518
Buggy source:
void bindViewHolder(int rowPosition,RowViewHolder holder){
  final int start=getFirstRowPosition(rowPosition);
  final int startType=mChooserListAdapter.getPositionTargetType(start);
  int end=start + mColumnCount - 1;
  while (mChooserListAdapter.getPositionTargetType(end) != startType && end >= start) {
    end--;
  }
  if (startType == ChooserListAdapter.TARGET_SERVICE) {
    holder.row.setBackgroundColor(getColor(R.color.chooser_service_row_background_color));
  }
 else {
    holder.row.setBackgroundColor(Color.TRANSPARENT);
  }
  final int oldHeight=holder.row.getLayoutParams().height;
  holder.row.getLayoutParams().height=Math.max(1,(int)(holder.measuredRowHeight * getRowScale(rowPosition)));
  if (holder.row.getLayoutParams().height != oldHeight) {
    holder.row.requestLayout();
  }
  for (int i=0; i < mColumnCount; i++) {
    final View v=holder.cells[i];
    if (start + i <= end) {
      v.setVisibility(View.VISIBLE);
      holder.itemIndex=start + i;
      mChooserListAdapter.bindView(holder.itemIndex,v);
    }
 else {
      v.setVisibility(View.GONE);
    }
  }
}

Fixed version (ground truth):
void bindViewHolder(int rowPosition,RowViewHolder holder){
  final int start=getFirstRowPosition(rowPosition);
  final int startType=mChooserListAdapter.getPositionTargetType(start);
  int end=start + mColumnCount - 1;
  while (mChooserListAdapter.getPositionTargetType(end) != startType && end >= start) {
    end--;
  }
  if (startType == ChooserListAdapter.TARGET_SERVICE) {
    holder.row.setBackgroundColor(getColor(R.color.chooser_service_row_background_color));
  }
 else {
    holder.row.setBackgroundColor(Color.TRANSPARENT);
  }
  final int oldHeight=holder.row.getLayoutParams().height;
  holder.row.getLayoutParams().height=Math.max(1,(int)(holder.measuredRowHeight * getRowScale(rowPosition)));
  if (holder.row.getLayoutParams().height != oldHeight) {
    holder.row.requestLayout();
  }
  for (int i=0; i < mColumnCount; i++) {
    final View v=holder.cells[i];
    if (start + i <= end) {
      v.setVisibility(View.VISIBLE);
      holder.itemIndices[i]=start + i;
      mChooserListAdapter.bindView(holder.itemIndices[i],v);
    }
 else {
      v.setVisibility(View.GONE);
    }
  }
}
Program: 193519
Project: 193519
Buggy source:
@Override public void onChanged(){
  if (mResolverDrawerLayout == null) {
    return;
  }
  final int chooserTargetRows=mChooserRowAdapter.getServiceTargetRowCount();
  int offset=0;
  for (int i=0; i < chooserTargetRows; i++) {
    final int pos=mChooserRowAdapter.getCallerTargetRowCount() + i;
    final int vt=mChooserRowAdapter.getItemViewType(pos);
    if (vt != mCachedViewType) {
      mCachedView=null;
    }
    final View v=mChooserRowAdapter.getView(pos,mCachedView,mListView);
    int height=((RowViewHolder)(v.getTag())).measuredRowHeight;
    offset+=(int)(height * mChooserRowAdapter.getRowScale(pos) * chooserTargetRows);
    if (vt >= 0) {
      mCachedViewType=vt;
      mCachedView=v;
    }
 else {
      mCachedViewType=-1;
    }
  }
  mResolverDrawerLayout.setCollapsibleHeightReserved(offset);
}

Fixed version (ground truth):
@Override public void onChanged(){
  if (mResolverDrawerLayout == null) {
    return;
  }
  final int chooserTargetRows=mChooserRowAdapter.getServiceTargetRowCount();
  int offset=0;
  for (int i=0; i < chooserTargetRows; i++) {
    final int pos=mChooserRowAdapter.getCallerTargetRowCount() + i;
    final int vt=mChooserRowAdapter.getItemViewType(pos);
    if (vt != mCachedViewType) {
      mCachedView=null;
    }
    final View v=mChooserRowAdapter.getView(pos,mCachedView,mListView);
    int height=((RowViewHolder)(v.getTag())).measuredRowHeight;
    offset+=(int)(height * mChooserRowAdapter.getRowScale(pos));
    if (vt >= 0) {
      mCachedViewType=vt;
      mCachedView=v;
    }
 else {
      mCachedViewType=-1;
    }
  }
  mResolverDrawerLayout.setCollapsibleHeightReserved(offset);
}
Program: 193520
Project: 193520
Buggy source:
@Override public boolean onLongClick(View v){
  showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndex,true));
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndices[column],true));
  return true;
}
Program: 193521
Project: 193521
Buggy source:
@Override public void onClick(View v){
  startSelected(holder.itemIndex,false,true);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  startSelected(holder.itemIndices[column],false,true);
}
Program: 193522
Project: 193522
Buggy source:
RowViewHolder createViewHolder(ViewGroup parent){
  final ViewGroup row=(ViewGroup)mLayoutInflater.inflate(R.layout.chooser_row,parent,false);
  final RowViewHolder holder=new RowViewHolder(row,mColumnCount);
  final int spec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  for (int i=0; i < mColumnCount; i++) {
    final View v=mChooserListAdapter.createView(row);
    v.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startSelected(holder.itemIndex,false,true);
      }
    }
);
    v.setOnLongClickListener(new OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndex,true));
        return true;
      }
    }
);
    row.addView(v);
    holder.cells[i]=v;
    LayoutParams lp=v.getLayoutParams();
    v.measure(spec,spec);
    if (lp == null) {
      lp=new LayoutParams(LayoutParams.MATCH_PARENT,v.getMeasuredHeight());
      row.setLayoutParams(lp);
    }
 else {
      lp.height=v.getMeasuredHeight();
    }
  }
  holder.measure();
  LayoutParams lp=row.getLayoutParams();
  if (lp == null) {
    lp=new LayoutParams(LayoutParams.MATCH_PARENT,holder.measuredRowHeight);
    row.setLayoutParams(lp);
  }
 else {
    lp.height=holder.measuredRowHeight;
  }
  row.setTag(holder);
  return holder;
}

Fixed version (ground truth):
RowViewHolder createViewHolder(ViewGroup parent){
  final ViewGroup row=(ViewGroup)mLayoutInflater.inflate(R.layout.chooser_row,parent,false);
  final RowViewHolder holder=new RowViewHolder(row,mColumnCount);
  final int spec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  for (int i=0; i < mColumnCount; i++) {
    final View v=mChooserListAdapter.createView(row);
    final int column=i;
    v.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startSelected(holder.itemIndices[column],false,true);
      }
    }
);
    v.setOnLongClickListener(new OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndices[column],true));
        return true;
      }
    }
);
    row.addView(v);
    holder.cells[i]=v;
    LayoutParams lp=v.getLayoutParams();
    v.measure(spec,spec);
    if (lp == null) {
      lp=new LayoutParams(LayoutParams.MATCH_PARENT,v.getMeasuredHeight());
      row.setLayoutParams(lp);
    }
 else {
      lp.height=v.getMeasuredHeight();
    }
  }
  holder.measure();
  LayoutParams lp=row.getLayoutParams();
  if (lp == null) {
    lp=new LayoutParams(LayoutParams.MATCH_PARENT,holder.measuredRowHeight);
    row.setLayoutParams(lp);
  }
 else {
    lp.height=holder.measuredRowHeight;
  }
  row.setTag(holder);
  return holder;
}
Program: 193523
Project: 193523
Buggy source:
public RowViewHolder(ViewGroup row,int cellCount){
  this.row=row;
  this.cells=new View[cellCount];
}

Fixed version (ground truth):
public RowViewHolder(ViewGroup row,int cellCount){
  this.row=row;
  this.cells=new View[cellCount];
  this.itemIndices=new int[cellCount];
}
Program: 193524
Project: 193524
Buggy source:
public ChooserRowAdapter(ChooserListAdapter wrappedAdapter){
  mChooserListAdapter=wrappedAdapter;
  mLayoutInflater=LayoutInflater.from(ChooserActivity.this);
  mInterpolator=AnimationUtils.loadInterpolator(ChooserActivity.this,android.R.interpolator.decelerate_quint);
  wrappedAdapter.registerDataSetObserver(new DataSetObserver(){
    @Override public void onChanged(){
      super.onChanged();
      final int rcount=getServiceTargetRowCount();
      if (mServiceTargetScale == null || mServiceTargetScale.length != rcount) {
        RowScale[] old=mServiceTargetScale;
        int oldRCount=old != null ? old.length : 0;
        mServiceTargetScale=new RowScale[rcount];
        if (old != null && rcount > 0) {
          System.arraycopy(old,0,mServiceTargetScale,0,Math.min(old.length,rcount));
        }
        for (int i=rcount; i < oldRCount; i++) {
          old[i].cancelAnimation();
        }
        for (int i=oldRCount; i < rcount; i++) {
          final RowScale rs=new RowScale(ChooserRowAdapter.this,0.f,1.f).setInterpolator(mInterpolator);
          mServiceTargetScale[i]=rs;
          rs.startAnimation();
        }
      }
      notifyDataSetChanged();
    }
    @Override public void onInvalidated(){
      super.onInvalidated();
      notifyDataSetInvalidated();
      if (mServiceTargetScale != null) {
        for (        RowScale rs : mServiceTargetScale) {
          rs.cancelAnimation();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public ChooserRowAdapter(ChooserListAdapter wrappedAdapter){
  mChooserListAdapter=wrappedAdapter;
  mLayoutInflater=LayoutInflater.from(ChooserActivity.this);
  mInterpolator=AnimationUtils.loadInterpolator(ChooserActivity.this,android.R.interpolator.decelerate_quint);
  wrappedAdapter.registerDataSetObserver(new DataSetObserver(){
    @Override public void onChanged(){
      super.onChanged();
      final int rcount=getServiceTargetRowCount();
      if (mServiceTargetScale == null || mServiceTargetScale.length != rcount) {
        RowScale[] old=mServiceTargetScale;
        int oldRCount=old != null ? old.length : 0;
        mServiceTargetScale=new RowScale[rcount];
        if (old != null && rcount > 0) {
          System.arraycopy(old,0,mServiceTargetScale,0,Math.min(old.length,rcount));
        }
        for (int i=rcount; i < oldRCount; i++) {
          old[i].cancelAnimation();
        }
        for (int i=oldRCount; i < rcount; i++) {
          final RowScale rs=new RowScale(ChooserRowAdapter.this,0.f,1.f).setInterpolator(mInterpolator);
          mServiceTargetScale[i]=rs;
        }
        for (int i=oldRCount; i < rcount; i++) {
          mServiceTargetScale[i].startAnimation();
        }
      }
      notifyDataSetChanged();
    }
    @Override public void onInvalidated(){
      super.onInvalidated();
      notifyDataSetInvalidated();
      if (mServiceTargetScale != null) {
        for (        RowScale rs : mServiceTargetScale) {
          rs.cancelAnimation();
        }
      }
    }
  }
);
}
Program: 193525
Project: 193525
Buggy source:
void bindViewHolder(int rowPosition,RowViewHolder holder){
  final int start=getFirstRowPosition(rowPosition);
  final int startType=mChooserListAdapter.getPositionTargetType(start);
  int end=start + mColumnCount - 1;
  while (mChooserListAdapter.getPositionTargetType(end) != startType && end >= start) {
    end--;
  }
  if (startType == ChooserListAdapter.TARGET_SERVICE) {
    holder.row.setBackgroundColor(getColor(R.color.chooser_service_row_background_color));
  }
 else {
    holder.row.setBackgroundColor(Color.TRANSPARENT);
  }
  final int oldHeight=holder.row.getLayoutParams().height;
  holder.row.getLayoutParams().height=Math.max(1,(int)(holder.measuredRowHeight * getRowScale(rowPosition)));
  if (holder.row.getLayoutParams().height != oldHeight) {
    holder.row.requestLayout();
  }
  for (int i=0; i < mColumnCount; i++) {
    final View v=holder.cells[i];
    if (start + i <= end) {
      v.setVisibility(View.VISIBLE);
      holder.itemIndex=start + i;
      mChooserListAdapter.bindView(holder.itemIndex,v);
    }
 else {
      v.setVisibility(View.GONE);
    }
  }
}

Fixed version (ground truth):
void bindViewHolder(int rowPosition,RowViewHolder holder){
  final int start=getFirstRowPosition(rowPosition);
  final int startType=mChooserListAdapter.getPositionTargetType(start);
  int end=start + mColumnCount - 1;
  while (mChooserListAdapter.getPositionTargetType(end) != startType && end >= start) {
    end--;
  }
  if (startType == ChooserListAdapter.TARGET_SERVICE) {
    holder.row.setBackgroundColor(getColor(R.color.chooser_service_row_background_color));
  }
 else {
    holder.row.setBackgroundColor(Color.TRANSPARENT);
  }
  final int oldHeight=holder.row.getLayoutParams().height;
  holder.row.getLayoutParams().height=Math.max(1,(int)(holder.measuredRowHeight * getRowScale(rowPosition)));
  if (holder.row.getLayoutParams().height != oldHeight) {
    holder.row.requestLayout();
  }
  for (int i=0; i < mColumnCount; i++) {
    final View v=holder.cells[i];
    if (start + i <= end) {
      v.setVisibility(View.VISIBLE);
      holder.itemIndices[i]=start + i;
      mChooserListAdapter.bindView(holder.itemIndices[i],v);
    }
 else {
      v.setVisibility(View.GONE);
    }
  }
}
Program: 193526
Project: 193526
Buggy source:
@Override public void onChanged(){
  if (mResolverDrawerLayout == null) {
    return;
  }
  final int chooserTargetRows=mChooserRowAdapter.getServiceTargetRowCount();
  int offset=0;
  for (int i=0; i < chooserTargetRows; i++) {
    final int pos=mChooserRowAdapter.getCallerTargetRowCount() + i;
    final int vt=mChooserRowAdapter.getItemViewType(pos);
    if (vt != mCachedViewType) {
      mCachedView=null;
    }
    final View v=mChooserRowAdapter.getView(pos,mCachedView,mListView);
    int height=((RowViewHolder)(v.getTag())).measuredRowHeight;
    offset+=(int)(height * mChooserRowAdapter.getRowScale(pos) * chooserTargetRows);
    if (vt >= 0) {
      mCachedViewType=vt;
      mCachedView=v;
    }
 else {
      mCachedViewType=-1;
    }
  }
  mResolverDrawerLayout.setCollapsibleHeightReserved(offset);
}

Fixed version (ground truth):
@Override public void onChanged(){
  if (mResolverDrawerLayout == null) {
    return;
  }
  final int chooserTargetRows=mChooserRowAdapter.getServiceTargetRowCount();
  int offset=0;
  for (int i=0; i < chooserTargetRows; i++) {
    final int pos=mChooserRowAdapter.getCallerTargetRowCount() + i;
    final int vt=mChooserRowAdapter.getItemViewType(pos);
    if (vt != mCachedViewType) {
      mCachedView=null;
    }
    final View v=mChooserRowAdapter.getView(pos,mCachedView,mListView);
    int height=((RowViewHolder)(v.getTag())).measuredRowHeight;
    offset+=(int)(height * mChooserRowAdapter.getRowScale(pos));
    if (vt >= 0) {
      mCachedViewType=vt;
      mCachedView=v;
    }
 else {
      mCachedViewType=-1;
    }
  }
  mResolverDrawerLayout.setCollapsibleHeightReserved(offset);
}
Program: 193527
Project: 193527
Buggy source:
@Override public boolean onLongClick(View v){
  showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndex,true));
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  showAppDetails(mChooserListAdapter.resolveInfoForPosition(holder.itemIndices[column],true));
  return true;
}
Program: 193528
Project: 193528
Buggy source:
@Override protected void onFinishInflate(){
  mContent=findViewById(R.id.task_view_content);
  mHeaderView=(TaskViewHeader)findViewById(R.id.task_view_bar);
  mThumbnailView=(TaskViewThumbnail)findViewById(R.id.task_view_thumbnail);
  mThumbnailView.updateClipToTaskBar(mHeaderView);
  mActionButtonView=findViewById(R.id.lock_to_app_fab);
  mActionButtonView.setOutlineProvider(new ViewOutlineProvider(){
    @Override public void getOutline(    View view,    Outline outline){
      outline.setOval(0,0,mActionButtonView.getWidth(),mActionButtonView.getHeight());
    }
  }
);
  mActionButtonTranslationZ=mActionButtonView.getTranslationZ();
}

Fixed version (ground truth):
@Override protected void onFinishInflate(){
  mContent=findViewById(R.id.task_view_content);
  mHeaderView=(TaskViewHeader)findViewById(R.id.task_view_bar);
  mThumbnailView=(TaskViewThumbnail)findViewById(R.id.task_view_thumbnail);
  mActionButtonView=findViewById(R.id.lock_to_app_fab);
  mActionButtonView.setOutlineProvider(new ViewOutlineProvider(){
    @Override public void getOutline(    View view,    Outline outline){
      outline.setOval(0,0,mActionButtonView.getWidth(),mActionButtonView.getHeight());
    }
  }
);
  mActionButtonTranslationZ=mActionButtonView.getTranslationZ();
}
Program: 193529
Project: 193529
Buggy source:
@Override public void getOutline(View view,Outline outline){
  outline.setOval(0,0,mActionButtonView.getWidth(),mActionButtonView.getHeight());
}

Fixed version (ground truth):
@Override public void getOutline(View view,Outline outline){
  outline.setRect(0,0,width,height);
}
Program: 193530
Project: 193530
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int widthWithoutPadding=width - mPaddingLeft - mPaddingRight;
  int heightWithoutPadding=height - mPaddingTop - mPaddingBottom;
  int taskBarHeight=getResources().getDimensionPixelSize(R.dimen.recents_task_bar_height);
  mContent.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY));
  mHeaderView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(taskBarHeight,MeasureSpec.EXACTLY));
  mActionButtonView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.AT_MOST),MeasureSpec.makeMeasureSpec(heightWithoutPadding,MeasureSpec.AT_MOST));
  mThumbnailView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY));
  setMeasuredDimension(width,height);
  invalidateOutline();
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int width=MeasureSpec.getSize(widthMeasureSpec);
  int height=MeasureSpec.getSize(heightMeasureSpec);
  int widthWithoutPadding=width - mPaddingLeft - mPaddingRight;
  int heightWithoutPadding=height - mPaddingTop - mPaddingBottom;
  int taskBarHeight=getResources().getDimensionPixelSize(R.dimen.recents_task_bar_height);
  mContent.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY));
  mHeaderView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(taskBarHeight,MeasureSpec.EXACTLY));
  mActionButtonView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.AT_MOST),MeasureSpec.makeMeasureSpec(heightWithoutPadding,MeasureSpec.AT_MOST));
  mThumbnailView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(widthWithoutPadding,MeasureSpec.EXACTLY));
  mThumbnailView.updateClipToTaskBar(mHeaderView);
  setMeasuredDimension(width,height);
  invalidateOutline();
}
Program: 193531
Project: 193531
Buggy source:
/** 
 * View.OnLongClickListener Implementation 
 */
@Override public boolean onLongClick(View v){
  if (v == this) {
    setClipViewInStack(false);
    int width=(int)(getScaleX() * getWidth());
    int height=(int)(getScaleY() * getHeight());
    Bitmap dragBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(dragBitmap);
    c.scale(getScaleX(),getScaleY());
    mThumbnailView.draw(c);
    mHeaderView.draw(c);
    c.setBitmap(null);
    final DragView dragView=new DragView(getContext(),dragBitmap,mDownTouchPos);
    dragView.setOutlineProvider(mViewBounds);
    dragView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener(){
      @Override public void onViewAttachedToWindow(      View v){
        setVisibility(View.INVISIBLE);
        dragView.setElevation(getElevation());
        dragView.setTranslationZ(getTranslationZ());
        dragView.animate().scaleX(1.05f).scaleY(1.05f).setDuration(175).setInterpolator(mFastOutSlowInInterpolator).start();
      }
      @Override public void onViewDetachedFromWindow(      View v){
      }
    }
);
    EventBus.getDefault().register(this,RecentsActivity.EVENT_BUS_PRIORITY + 1);
    EventBus.getDefault().send(new DragStartEvent(mTask,this,dragView));
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * View.OnLongClickListener Implementation 
 */
@Override public boolean onLongClick(View v){
  if (v == this) {
    setClipViewInStack(false);
    final int width=(int)(getScaleX() * getWidth());
    final int height=(int)(getScaleY() * getHeight());
    Bitmap dragBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
    Canvas c=new Canvas(dragBitmap);
    c.scale(getScaleX(),getScaleY());
    mThumbnailView.draw(c);
    mHeaderView.draw(c);
    c.setBitmap(null);
    final DragView dragView=new DragView(getContext(),dragBitmap,mDownTouchPos);
    dragView.setOutlineProvider(new ViewOutlineProvider(){
      @Override public void getOutline(      View view,      Outline outline){
        outline.setRect(0,0,width,height);
      }
    }
);
    dragView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener(){
      @Override public void onViewAttachedToWindow(      View v){
        setVisibility(View.INVISIBLE);
        dragView.setElevation(getElevation());
        dragView.setTranslationZ(getTranslationZ());
        dragView.animate().scaleX(1.05f).scaleY(1.05f).setDuration(175).setInterpolator(mFastOutSlowInInterpolator).start();
      }
      @Override public void onViewDetachedFromWindow(      View v){
      }
    }
);
    EventBus.getDefault().register(this,RecentsActivity.EVENT_BUS_PRIORITY + 1);
    EventBus.getDefault().send(new DragStartEvent(mTask,this,dragView));
    return true;
  }
  return false;
}
Program: 193532
Project: 193532
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING,false)) {
      Uri data=intent.getData();
      String ssp;
      if (data != null && (ssp=data.getSchemeSpecificPart()) != null) {
        removePowerSaveWhitelistAppInternal(ssp);
      }
    }
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}
Program: 193534
Project: 193534
Buggy source:
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,0);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}

Fixed version (ground truth):
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}
Program: 193536
Project: 193536
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING,false)) {
      Uri data=intent.getData();
      String ssp;
      if (data != null && (ssp=data.getSchemeSpecificPart()) != null) {
        removePowerSaveWhitelistAppInternal(ssp);
      }
    }
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}
Program: 193538
Project: 193538
Buggy source:
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,0);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}

Fixed version (ground truth):
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}
Program: 193540
Project: 193540
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING,false)) {
      Uri data=intent.getData();
      String ssp;
      if (data != null && (ssp=data.getSchemeSpecificPart()) != null) {
        removePowerSaveWhitelistAppInternal(ssp);
      }
    }
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}
Program: 193542
Project: 193542
Buggy source:
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,0);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}

Fixed version (ground truth):
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}
Program: 193544
Project: 193544
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    int plugged=intent.getIntExtra("String_Node_Str",0);
    updateChargingLocked(plugged != 0);
  }
 else   if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING,false)) {
      Uri data=intent.getData();
      String ssp;
      if (data != null && (ssp=data.getSchemeSpecificPart()) != null) {
        removePowerSaveWhitelistAppInternal(ssp);
      }
    }
  }
 else   if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) {
synchronized (DeviceIdleController.this) {
      stepIdleStateLocked();
    }
  }
}
Program: 193546
Project: 193546
Buggy source:
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,0);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}

Fixed version (ground truth):
public boolean addPowerSaveWhitelistAppInternal(String name){
synchronized (this) {
    try {
      ApplicationInfo ai=getContext().getPackageManager().getApplicationInfo(name,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
      if (mPowerSaveWhitelistUserApps.put(name,UserHandle.getAppId(ai.uid)) == null) {
        reportPowerSaveWhitelistChangedLocked();
        updateWhitelistAppIdsLocked();
        writeConfigFileLocked();
      }
      return true;
    }
 catch (    PackageManager.NameNotFoundException e) {
      return false;
    }
  }
}