nus-yam/ex-repair huggingface dataset:
Program: 191564
Project: 191564
Buggy source:
/** 
 * An optimization to preload the raw list of tasks. The raw tasks are saved in least-recent to most-recent order.
 */
public synchronized void preloadRawTasks(boolean isHomeStackVisible){
  int currentUserId=UserHandle.USER_CURRENT;
  updateCurrentQuietProfilesCache(currentUserId);
  SystemServicesProxy ssp=Recents.getSystemServices();
  mRawTasks=ssp.getRecentTasks(ActivityManager.getMaxRecentTasksStatic(),currentUserId,isHomeStackVisible,mCurrentQuietProfiles);
  Collections.reverse(mRawTasks);
}

Fixed version (ground truth):
/** 
 * An optimization to preload the raw list of tasks. The raw tasks are saved in least-recent to most-recent order.
 */
public synchronized void preloadRawTasks(boolean includeFrontMostExcludedTask){
  int currentUserId=UserHandle.USER_CURRENT;
  updateCurrentQuietProfilesCache(currentUserId);
  SystemServicesProxy ssp=Recents.getSystemServices();
  mRawTasks=ssp.getRecentTasks(ActivityManager.getMaxRecentTasksStatic(),currentUserId,includeFrontMostExcludedTask,mCurrentQuietProfiles);
  Collections.reverse(mRawTasks);
}
Program: 191565
Project: 191565
Buggy source:
/** 
 * Preloads recents tasks using the specified plan to store the output. 
 */
public void preloadTasks(RecentsTaskLoadPlan plan,int runningTaskId,boolean isHomeStackVisible){
  plan.preloadPlan(this,runningTaskId,isHomeStackVisible);
}

Fixed version (ground truth):
/** 
 * Preloads recents tasks using the specified plan to store the output. 
 */
public void preloadTasks(RecentsTaskLoadPlan plan,int runningTaskId,boolean includeFrontMostExcludedTask){
  plan.preloadPlan(this,runningTaskId,includeFrontMostExcludedTask);
}
Program: 191566
Project: 191566
Buggy source:
private void updateRecentsTasks(){
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=RecentsImpl.consumeInstanceLoadPlan();
  if (plan == null) {
    plan=loader.createLoadPlan(this);
  }
  RecentsConfiguration config=Recents.getConfiguration();
  RecentsActivityLaunchState launchState=config.getLaunchState();
  if (!plan.hasTasks()) {
    loader.preloadTasks(plan,-1,launchState.launchedFromHome);
  }
  mLaunchedFromHome=launchState.launchedFromHome;
  TaskStack stack=plan.getTaskStack();
  RecentsTaskLoadPlan.Options loadOpts=new RecentsTaskLoadPlan.Options();
  loadOpts.runningTaskId=launchState.launchedToTaskId;
  loadOpts.numVisibleTasks=stack.getStackTaskCount();
  loadOpts.numVisibleTaskThumbnails=stack.getStackTaskCount();
  loader.loadTasks(this,plan,loadOpts);
  mRecentsView.setTaskStack(stack);
  List stackTasks=stack.getStackTasks();
  Collections.reverse(stackTasks);
  if (mTaskStackViewAdapter == null) {
    mTaskStackViewAdapter=new TaskStackHorizontalViewAdapter(stackTasks);
    mTaskStackHorizontalGridView=mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
  }
 else {
    mTaskStackViewAdapter.setNewStackTasks(stackTasks);
  }
  if (launchState.launchedToTaskId != -1) {
    ArrayList<Task> tasks=stack.getStackTasks();
    int taskCount=tasks.size();
    for (int i=0; i < taskCount; i++) {
      Task t=tasks.get(i);
      if (t.key.id == launchState.launchedToTaskId) {
        t.isLaunchTarget=true;
        break;
      }
    }
  }
}

Fixed version (ground truth):
private void updateRecentsTasks(){
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=RecentsImpl.consumeInstanceLoadPlan();
  if (plan == null) {
    plan=loader.createLoadPlan(this);
  }
  RecentsConfiguration config=Recents.getConfiguration();
  RecentsActivityLaunchState launchState=config.getLaunchState();
  if (!plan.hasTasks()) {
    loader.preloadTasks(plan,-1,!launchState.launchedFromHome);
  }
  mLaunchedFromHome=launchState.launchedFromHome;
  TaskStack stack=plan.getTaskStack();
  RecentsTaskLoadPlan.Options loadOpts=new RecentsTaskLoadPlan.Options();
  loadOpts.runningTaskId=launchState.launchedToTaskId;
  loadOpts.numVisibleTasks=stack.getStackTaskCount();
  loadOpts.numVisibleTaskThumbnails=stack.getStackTaskCount();
  loader.loadTasks(this,plan,loadOpts);
  mRecentsView.setTaskStack(stack);
  List stackTasks=stack.getStackTasks();
  Collections.reverse(stackTasks);
  if (mTaskStackViewAdapter == null) {
    mTaskStackViewAdapter=new TaskStackHorizontalViewAdapter(stackTasks);
    mTaskStackHorizontalGridView=mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
  }
 else {
    mTaskStackViewAdapter.setNewStackTasks(stackTasks);
  }
  if (launchState.launchedToTaskId != -1) {
    ArrayList<Task> tasks=stack.getStackTasks();
    int taskCount=tasks.size();
    for (int i=0; i < taskCount; i++) {
      Task t=tasks.get(i);
      if (t.key.id == launchState.launchedToTaskId) {
        t.isLaunchTarget=true;
        break;
      }
    }
  }
}
Program: 191570
Project: 191570
Buggy source:
public void preloadRecents(){
  SystemServicesProxy ssp=Recents.getSystemServices();
  MutableBoolean isHomeStackVisible=new MutableBoolean(true);
  if (!ssp.isRecentsActivityVisible(isHomeStackVisible)) {
    ActivityManager.RunningTaskInfo runningTask=ssp.getRunningTask();
    RecentsTaskLoader loader=Recents.getTaskLoader();
    sInstanceLoadPlan=loader.createLoadPlan(mContext);
    sInstanceLoadPlan.preloadRawTasks(isHomeStackVisible.value);
    loader.preloadTasks(sInstanceLoadPlan,runningTask.id,isHomeStackVisible.value);
    TaskStack stack=sInstanceLoadPlan.getTaskStack();
    if (stack.getTaskCount() > 0) {
      preloadIcon(runningTask);
      updateHeaderBarLayout(stack,null);
    }
  }
}

Fixed version (ground truth):
public void preloadRecents(){
  SystemServicesProxy ssp=Recents.getSystemServices();
  MutableBoolean isHomeStackVisible=new MutableBoolean(true);
  if (!ssp.isRecentsActivityVisible(isHomeStackVisible)) {
    ActivityManager.RunningTaskInfo runningTask=ssp.getRunningTask();
    RecentsTaskLoader loader=Recents.getTaskLoader();
    sInstanceLoadPlan=loader.createLoadPlan(mContext);
    sInstanceLoadPlan.preloadRawTasks(!isHomeStackVisible.value);
    loader.preloadTasks(sInstanceLoadPlan,runningTask.id,!isHomeStackVisible.value);
    TaskStack stack=sInstanceLoadPlan.getTaskStack();
    if (stack.getTaskCount() > 0) {
      preloadIcon(runningTask);
      updateHeaderBarLayout(stack,null);
    }
  }
}
Program: 191571
Project: 191571
Buggy source:
public RecentsImpl(Context context){
  mContext=context;
  mHandler=new Handler();
  ForegroundThread.get();
  mTaskStackListener=new TaskStackListenerImpl();
  SystemServicesProxy ssp=Recents.getSystemServices();
  ssp.registerTaskStackListener(mTaskStackListener);
  LayoutInflater inflater=LayoutInflater.from(mContext);
  mDummyStackView=new TaskStackView(mContext);
  mHeaderBar=(TaskViewHeader)inflater.inflate(R.layout.recents_task_view_header,null,false);
  reloadResources();
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=loader.createLoadPlan(mContext);
  loader.preloadTasks(plan,-1,true);
  RecentsTaskLoadPlan.Options launchOpts=new RecentsTaskLoadPlan.Options();
  launchOpts.numVisibleTasks=loader.getIconCacheSize();
  launchOpts.numVisibleTaskThumbnails=loader.getThumbnailCacheSize();
  launchOpts.onlyLoadForCache=true;
  loader.loadTasks(mContext,plan,launchOpts);
}

Fixed version (ground truth):
public RecentsImpl(Context context){
  mContext=context;
  mHandler=new Handler();
  ForegroundThread.get();
  mTaskStackListener=new TaskStackListenerImpl();
  SystemServicesProxy ssp=Recents.getSystemServices();
  ssp.registerTaskStackListener(mTaskStackListener);
  LayoutInflater inflater=LayoutInflater.from(mContext);
  mDummyStackView=new TaskStackView(mContext);
  mHeaderBar=(TaskViewHeader)inflater.inflate(R.layout.recents_task_view_header,null,false);
  reloadResources();
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=loader.createLoadPlan(mContext);
  loader.preloadTasks(plan,-1,false);
  RecentsTaskLoadPlan.Options launchOpts=new RecentsTaskLoadPlan.Options();
  launchOpts.numVisibleTasks=loader.getIconCacheSize();
  launchOpts.numVisibleTaskThumbnails=loader.getThumbnailCacheSize();
  launchOpts.onlyLoadForCache=true;
  loader.loadTasks(mContext,plan,launchOpts);
}
Program: 191573
Project: 191573
Buggy source:
@Override public void onTaskStackChanged(){
  RecentsConfiguration config=Recents.getConfiguration();
  if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) {
    RecentsTaskLoader loader=Recents.getTaskLoader();
    SystemServicesProxy ssp=Recents.getSystemServices();
    ActivityManager.RunningTaskInfo runningTaskInfo=ssp.getRunningTask();
    RecentsTaskLoadPlan plan=loader.createLoadPlan(mContext);
    loader.preloadTasks(plan,-1,true);
    RecentsTaskLoadPlan.Options launchOpts=new RecentsTaskLoadPlan.Options();
    if (runningTaskInfo != null) {
      launchOpts.runningTaskId=runningTaskInfo.id;
    }
    launchOpts.numVisibleTasks=2;
    launchOpts.numVisibleTaskThumbnails=2;
    launchOpts.onlyLoadForCache=true;
    launchOpts.onlyLoadPausedActivities=true;
    loader.loadTasks(mContext,plan,launchOpts);
  }
}

Fixed version (ground truth):
@Override public void onTaskStackChanged(){
  RecentsConfiguration config=Recents.getConfiguration();
  if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) {
    RecentsTaskLoader loader=Recents.getTaskLoader();
    SystemServicesProxy ssp=Recents.getSystemServices();
    ActivityManager.RunningTaskInfo runningTaskInfo=ssp.getRunningTask();
    RecentsTaskLoadPlan plan=loader.createLoadPlan(mContext);
    loader.preloadTasks(plan,-1,false);
    RecentsTaskLoadPlan.Options launchOpts=new RecentsTaskLoadPlan.Options();
    if (runningTaskInfo != null) {
      launchOpts.runningTaskId=runningTaskInfo.id;
    }
    launchOpts.numVisibleTasks=2;
    launchOpts.numVisibleTaskThumbnails=2;
    launchOpts.onlyLoadForCache=true;
    launchOpts.onlyLoadPausedActivities=true;
    loader.loadTasks(mContext,plan,launchOpts);
  }
}
Program: 191576
Project: 191576
Buggy source:
/** 
 * An optimization to preload the raw list of tasks. The raw tasks are saved in least-recent to most-recent order.
 */
public synchronized void preloadRawTasks(boolean isHomeStackVisible){
  int currentUserId=UserHandle.USER_CURRENT;
  updateCurrentQuietProfilesCache(currentUserId);
  SystemServicesProxy ssp=Recents.getSystemServices();
  mRawTasks=ssp.getRecentTasks(ActivityManager.getMaxRecentTasksStatic(),currentUserId,isHomeStackVisible,mCurrentQuietProfiles);
  Collections.reverse(mRawTasks);
}

Fixed version (ground truth):
/** 
 * An optimization to preload the raw list of tasks. The raw tasks are saved in least-recent to most-recent order.
 */
public synchronized void preloadRawTasks(boolean includeFrontMostExcludedTask){
  int currentUserId=UserHandle.USER_CURRENT;
  updateCurrentQuietProfilesCache(currentUserId);
  SystemServicesProxy ssp=Recents.getSystemServices();
  mRawTasks=ssp.getRecentTasks(ActivityManager.getMaxRecentTasksStatic(),currentUserId,includeFrontMostExcludedTask,mCurrentQuietProfiles);
  Collections.reverse(mRawTasks);
}
Program: 191577
Project: 191577
Buggy source:
/** 
 * Preloads recents tasks using the specified plan to store the output. 
 */
public void preloadTasks(RecentsTaskLoadPlan plan,int runningTaskId,boolean isHomeStackVisible){
  plan.preloadPlan(this,runningTaskId,isHomeStackVisible);
}

Fixed version (ground truth):
/** 
 * Preloads recents tasks using the specified plan to store the output. 
 */
public void preloadTasks(RecentsTaskLoadPlan plan,int runningTaskId,boolean includeFrontMostExcludedTask){
  plan.preloadPlan(this,runningTaskId,includeFrontMostExcludedTask);
}
Program: 191578
Project: 191578
Buggy source:
private void updateRecentsTasks(){
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=RecentsImpl.consumeInstanceLoadPlan();
  if (plan == null) {
    plan=loader.createLoadPlan(this);
  }
  RecentsConfiguration config=Recents.getConfiguration();
  RecentsActivityLaunchState launchState=config.getLaunchState();
  if (!plan.hasTasks()) {
    loader.preloadTasks(plan,-1,launchState.launchedFromHome);
  }
  mLaunchedFromHome=launchState.launchedFromHome;
  TaskStack stack=plan.getTaskStack();
  RecentsTaskLoadPlan.Options loadOpts=new RecentsTaskLoadPlan.Options();
  loadOpts.runningTaskId=launchState.launchedToTaskId;
  loadOpts.numVisibleTasks=stack.getStackTaskCount();
  loadOpts.numVisibleTaskThumbnails=stack.getStackTaskCount();
  loader.loadTasks(this,plan,loadOpts);
  mRecentsView.setTaskStack(stack);
  List stackTasks=stack.getStackTasks();
  Collections.reverse(stackTasks);
  if (mTaskStackViewAdapter == null) {
    mTaskStackViewAdapter=new TaskStackHorizontalViewAdapter(stackTasks);
    mTaskStackHorizontalGridView=mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
  }
 else {
    mTaskStackViewAdapter.setNewStackTasks(stackTasks);
  }
  if (launchState.launchedToTaskId != -1) {
    ArrayList<Task> tasks=stack.getStackTasks();
    int taskCount=tasks.size();
    for (int i=0; i < taskCount; i++) {
      Task t=tasks.get(i);
      if (t.key.id == launchState.launchedToTaskId) {
        t.isLaunchTarget=true;
        break;
      }
    }
  }
}

Fixed version (ground truth):
private void updateRecentsTasks(){
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=RecentsImpl.consumeInstanceLoadPlan();
  if (plan == null) {
    plan=loader.createLoadPlan(this);
  }
  RecentsConfiguration config=Recents.getConfiguration();
  RecentsActivityLaunchState launchState=config.getLaunchState();
  if (!plan.hasTasks()) {
    loader.preloadTasks(plan,-1,!launchState.launchedFromHome);
  }
  mLaunchedFromHome=launchState.launchedFromHome;
  TaskStack stack=plan.getTaskStack();
  RecentsTaskLoadPlan.Options loadOpts=new RecentsTaskLoadPlan.Options();
  loadOpts.runningTaskId=launchState.launchedToTaskId;
  loadOpts.numVisibleTasks=stack.getStackTaskCount();
  loadOpts.numVisibleTaskThumbnails=stack.getStackTaskCount();
  loader.loadTasks(this,plan,loadOpts);
  mRecentsView.setTaskStack(stack);
  List stackTasks=stack.getStackTasks();
  Collections.reverse(stackTasks);
  if (mTaskStackViewAdapter == null) {
    mTaskStackViewAdapter=new TaskStackHorizontalViewAdapter(stackTasks);
    mTaskStackHorizontalGridView=mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
  }
 else {
    mTaskStackViewAdapter.setNewStackTasks(stackTasks);
  }
  if (launchState.launchedToTaskId != -1) {
    ArrayList<Task> tasks=stack.getStackTasks();
    int taskCount=tasks.size();
    for (int i=0; i < taskCount; i++) {
      Task t=tasks.get(i);
      if (t.key.id == launchState.launchedToTaskId) {
        t.isLaunchTarget=true;
        break;
      }
    }
  }
}
Program: 191591
Project: 191591
Buggy source:
@Override public void flingTopOverscroll(float velocity,boolean open){
  mLastOverscroll=0f;
  setQsExpansion(mQsExpansionHeight);
  flingSettings(!mQsExpansionEnabled && open ? 0f : velocity,open && mQsExpansionEnabled,new Runnable(){
    @Override public void run(){
      mStackScrollerOverscrolling=false;
      setOverScrolling(false);
      updateQsState();
    }
  }
,false);
}

Fixed version (ground truth):
@Override public void flingTopOverscroll(float velocity,boolean open){
  mLastOverscroll=0f;
  mQsExpansionFromOverscroll=false;
  setQsExpansion(mQsExpansionHeight);
  flingSettings(!mQsExpansionEnabled && open ? 0f : velocity,open && mQsExpansionEnabled,new Runnable(){
    @Override public void run(){
      mStackScrollerOverscrolling=false;
      setOverScrolling(false);
      updateQsState();
    }
  }
,false);
}
Program: 191592
Project: 191592
Buggy source:
@Override public void flingTopOverscroll(float velocity,boolean open){
  mLastOverscroll=0f;
  setQsExpansion(mQsExpansionHeight);
  flingSettings(!mQsExpansionEnabled && open ? 0f : velocity,open && mQsExpansionEnabled,new Runnable(){
    @Override public void run(){
      mStackScrollerOverscrolling=false;
      setOverScrolling(false);
      updateQsState();
    }
  }
,false);
}

Fixed version (ground truth):
@Override public void flingTopOverscroll(float velocity,boolean open){
  mLastOverscroll=0f;
  mQsExpansionFromOverscroll=false;
  setQsExpansion(mQsExpansionHeight);
  flingSettings(!mQsExpansionEnabled && open ? 0f : velocity,open && mQsExpansionEnabled,new Runnable(){
    @Override public void run(){
      mStackScrollerOverscrolling=false;
      setOverScrolling(false);
      updateQsState();
    }
  }
,false);
}
Program: 191599
Project: 191599
Buggy source:
@Override public void flingTopOverscroll(float velocity,boolean open){
  mLastOverscroll=0f;
  setQsExpansion(mQsExpansionHeight);
  flingSettings(!mQsExpansionEnabled && open ? 0f : velocity,open && mQsExpansionEnabled,new Runnable(){
    @Override public void run(){
      mStackScrollerOverscrolling=false;
      setOverScrolling(false);
      updateQsState();
    }
  }
,false);
}

Fixed version (ground truth):
@Override public void flingTopOverscroll(float velocity,boolean open){
  mLastOverscroll=0f;
  mQsExpansionFromOverscroll=false;
  setQsExpansion(mQsExpansionHeight);
  flingSettings(!mQsExpansionEnabled && open ? 0f : velocity,open && mQsExpansionEnabled,new Runnable(){
    @Override public void run(){
      mStackScrollerOverscrolling=false;
      setOverScrolling(false);
      updateQsState();
    }
  }
,false);
}
Program: 191601
Project: 191601
Buggy source:
private boolean shouldShowOnKeyguard(StatusBarNotification sbn){
  return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey());
}

Fixed version (ground truth):
public boolean shouldShowOnKeyguard(StatusBarNotification sbn){
  return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey());
}
Program: 191602
Project: 191602
Buggy source:
/** 
 * @param maximum the maximum to return at most
 * @return the maximum keyguard notifications that can fit on the screen
 */
public int computeMaxKeyguardNotifications(int maximum){
  float minPadding=mClockPositionAlgorithm.getMinStackScrollerPadding(getHeight(),mKeyguardStatusView.getHeight());
  int notificationPadding=Math.max(1,getResources().getDimensionPixelSize(R.dimen.notification_divider_height));
  final int overflowheight=getResources().getDimensionPixelSize(R.dimen.notification_summary_height);
  float bottomStackSize=mNotificationStackScroller.getKeyguardBottomStackSize();
  float availableSpace=mNotificationStackScroller.getHeight() - minPadding - overflowheight- bottomStackSize;
  int count=0;
  for (int i=0; i < mNotificationStackScroller.getChildCount(); i++) {
    ExpandableView child=(ExpandableView)mNotificationStackScroller.getChildAt(i);
    if (!(child instanceof ExpandableNotificationRow)) {
      continue;
    }
    boolean suppressedSummary=mGroupManager.isSummaryOfSuppressedGroup(((ExpandableNotificationRow)child).getStatusBarNotification());
    if (suppressedSummary) {
      continue;
    }
    availableSpace-=child.getMinHeight() + notificationPadding;
    if (availableSpace >= 0 && count < maximum) {
      count++;
    }
 else {
      return count;
    }
  }
  return count;
}

Fixed version (ground truth):
/** 
 * @param maximum the maximum to return at most
 * @return the maximum keyguard notifications that can fit on the screen
 */
public int computeMaxKeyguardNotifications(int maximum){
  float minPadding=mClockPositionAlgorithm.getMinStackScrollerPadding(getHeight(),mKeyguardStatusView.getHeight());
  int notificationPadding=Math.max(1,getResources().getDimensionPixelSize(R.dimen.notification_divider_height));
  final int overflowheight=getResources().getDimensionPixelSize(R.dimen.notification_summary_height);
  float bottomStackSize=mNotificationStackScroller.getKeyguardBottomStackSize();
  float availableSpace=mNotificationStackScroller.getHeight() - minPadding - overflowheight- bottomStackSize;
  int count=0;
  for (int i=0; i < mNotificationStackScroller.getChildCount(); i++) {
    ExpandableView child=(ExpandableView)mNotificationStackScroller.getChildAt(i);
    if (!(child instanceof ExpandableNotificationRow)) {
      continue;
    }
    ExpandableNotificationRow row=(ExpandableNotificationRow)child;
    boolean suppressedSummary=mGroupManager.isSummaryOfSuppressedGroup(row.getStatusBarNotification());
    if (suppressedSummary) {
      continue;
    }
    if (!mStatusBar.shouldShowOnKeyguard(row.getStatusBarNotification())) {
      continue;
    }
    if (row.isRemoved()) {
      continue;
    }
    availableSpace-=child.getMinHeight() + notificationPadding;
    if (availableSpace >= 0 && count < maximum) {
      count++;
    }
 else {
      return count;
    }
  }
  return count;
}
Program: 191603
Project: 191603
Buggy source:
/** 
 * Ensures that the group children are cancelled immediately when the group summary is cancelled instead of waiting for the notification manager to send all cancels. Otherwise this could lead to flickers. This also ensures that the animation looks nice and only consists of a single disappear animation instead of multiple.
 * @param key the key of the notification was removed
 * @param ranking the current ranking
 */
private void handleGroupSummaryRemoved(String key,RankingMap ranking){
  Entry entry=mNotificationData.get(key);
  if (entry != null && entry.row != null && entry.row.isSummaryWithChildren()) {
    if (entry.notification.getOverrideGroupKey() != null && !entry.row.isDismissed()) {
      return;
    }
    entry.row.setRemoved(true);
    List<ExpandableNotificationRow> notificationChildren=entry.row.getNotificationChildren();
    ArrayList<ExpandableNotificationRow> toRemove=new ArrayList<>(notificationChildren);
    for (int i=0; i < toRemove.size(); i++) {
      toRemove.get(i).setKeepInParent(true);
    }
    for (int i=0; i < toRemove.size(); i++) {
      removeNotification(toRemove.get(i).getStatusBarNotification().getKey(),ranking);
      mStackScroller.removeViewStateForView(toRemove.get(i));
    }
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the group children are cancelled immediately when the group summary is cancelled instead of waiting for the notification manager to send all cancels. Otherwise this could lead to flickers. This also ensures that the animation looks nice and only consists of a single disappear animation instead of multiple.
 * @param key the key of the notification was removed
 * @param ranking the current ranking
 */
private void handleGroupSummaryRemoved(String key,RankingMap ranking){
  Entry entry=mNotificationData.get(key);
  if (entry != null && entry.row != null && entry.row.isSummaryWithChildren()) {
    if (entry.notification.getOverrideGroupKey() != null && !entry.row.isDismissed()) {
      return;
    }
    entry.row.setRemoved(true);
    List<ExpandableNotificationRow> notificationChildren=entry.row.getNotificationChildren();
    ArrayList<ExpandableNotificationRow> toRemove=new ArrayList<>(notificationChildren);
    for (int i=0; i < toRemove.size(); i++) {
      toRemove.get(i).setKeepInParent(true);
      toRemove.get(i).setRemoved(true);
    }
    for (int i=0; i < toRemove.size(); i++) {
      removeNotification(toRemove.get(i).getStatusBarNotification().getKey(),ranking);
      mStackScroller.removeViewStateForView(toRemove.get(i));
    }
  }
}
Program: 191604
Project: 191604
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  int childCount=Math.min(mChildren.size(),NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED);
  for (int i=0; i < childCount; i++) {
    View child=mChildren.get(i);
    if (child.getVisibility() == View.GONE) {
      continue;
    }
    child.layout(0,0,child.getMeasuredWidth(),child.getMeasuredHeight());
    mDividers.get(i).layout(0,0,getWidth(),mDividerHeight);
  }
  if (mOverflowNumber != null) {
    mOverflowNumber.layout(getWidth() - mOverflowNumber.getMeasuredWidth(),0,getWidth(),mOverflowNumber.getMeasuredHeight());
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  int childCount=Math.min(mChildren.size(),NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED);
  for (int i=0; i < childCount; i++) {
    View child=mChildren.get(i);
    child.layout(0,0,child.getMeasuredWidth(),child.getMeasuredHeight());
    mDividers.get(i).layout(0,0,getWidth(),mDividerHeight);
  }
  if (mOverflowNumber != null) {
    mOverflowNumber.layout(getWidth() - mOverflowNumber.getMeasuredWidth(),0,getWidth(),mOverflowNumber.getMeasuredHeight());
  }
}
Program: 191606
Project: 191606
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  float centerX=getWidth() / 2.0f;
  for (int i=0; i < getChildCount(); i++) {
    View child=getChildAt(i);
    if (child.getVisibility() == GONE) {
      continue;
    }
    float width=child.getMeasuredWidth();
    float height=child.getMeasuredHeight();
    child.layout((int)(centerX - width / 2.0f),0,(int)(centerX + width / 2.0f),(int)height);
  }
  setMaxLayoutHeight(getHeight());
  updateContentHeight();
  clampScrollPosition();
  if (mRequestViewResizeAnimationOnLayout) {
    requestAnimationOnViewResize(null);
    mRequestViewResizeAnimationOnLayout=false;
  }
  requestChildrenUpdate();
  updateFirstAndLastBackgroundViews();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  float centerX=getWidth() / 2.0f;
  for (int i=0; i < getChildCount(); i++) {
    View child=getChildAt(i);
    float width=child.getMeasuredWidth();
    float height=child.getMeasuredHeight();
    child.layout((int)(centerX - width / 2.0f),0,(int)(centerX + width / 2.0f),(int)height);
  }
  setMaxLayoutHeight(getHeight());
  updateContentHeight();
  clampScrollPosition();
  if (mRequestViewResizeAnimationOnLayout) {
    requestAnimationOnViewResize(null);
    mRequestViewResizeAnimationOnLayout=false;
  }
  requestChildrenUpdate();
  updateFirstAndLastBackgroundViews();
}
Program: 191607
Project: 191607
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  measureChildren(widthMeasureSpec,heightMeasureSpec);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  final int size=getChildCount();
  for (int i=0; i < size; i++) {
    measureChild(getChildAt(i),widthMeasureSpec,heightMeasureSpec);
  }
}
Program: 191608
Project: 191608
Buggy source:
private int getVisualTypeForHeight(float viewHeight){
  boolean noExpandedChild=mExpandedChild == null;
  if (!noExpandedChild && viewHeight == mExpandedChild.getHeight()) {
    return VISIBLE_TYPE_EXPANDED;
  }
  if (!mUserExpanding && mIsChildInGroup && !isGroupExpanded()) {
    return VISIBLE_TYPE_SINGLELINE;
  }
  if (mIsHeadsUp && mHeadsUpChild != null) {
    if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
      return VISIBLE_TYPE_HEADSUP;
    }
 else {
      return VISIBLE_TYPE_EXPANDED;
    }
  }
 else {
    if (noExpandedChild || (viewHeight <= mContractedChild.getHeight() && (!mIsChildInGroup || !mContainingNotification.isExpanded(true)))) {
      return VISIBLE_TYPE_CONTRACTED;
    }
 else {
      return VISIBLE_TYPE_EXPANDED;
    }
  }
}

Fixed version (ground truth):
private int getVisualTypeForHeight(float viewHeight){
  boolean noExpandedChild=mExpandedChild == null;
  if (!noExpandedChild && viewHeight == mExpandedChild.getHeight()) {
    return VISIBLE_TYPE_EXPANDED;
  }
  if (!mUserExpanding && mIsChildInGroup && !isGroupExpanded()) {
    return VISIBLE_TYPE_SINGLELINE;
  }
  if (mIsHeadsUp && mHeadsUpChild != null) {
    if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
      return VISIBLE_TYPE_HEADSUP;
    }
 else {
      return VISIBLE_TYPE_EXPANDED;
    }
  }
 else {
    if (noExpandedChild || (viewHeight <= mContractedChild.getHeight() && (!mIsChildInGroup || isGroupExpanded() || !mContainingNotification.isExpanded(true)))) {
      return VISIBLE_TYPE_CONTRACTED;
    }
 else {
      return VISIBLE_TYPE_EXPANDED;
    }
  }
}
Program: 191609
Project: 191609
Buggy source:
/** 
 * Sets the intent of a shortcut.  This is a mandatory field.  The extras must only contain persistable information.  (See   {@link PersistableBundle}).
 */
@NonNull public Builder setIntent(@NonNull Intent intent){
  mIntent=Preconditions.checkNotNull(intent,"String_Node_Str");
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the intent of a shortcut.  This is a mandatory field.  The extras must only contain persistable information.  (See   {@link PersistableBundle}).
 */
@NonNull public Builder setIntent(@NonNull Intent intent){
  mIntent=Preconditions.checkNotNull(intent,"String_Node_Str");
  Preconditions.checkNotNull(mIntent.getAction(),"String_Node_Str");
  return this;
}
Program: 191610
Project: 191610
Buggy source:
/** 
 * Publish a single dynamic shortcut.  If there's already dynamic or pinned shortcuts with the same ID, they will all be updated. <p>This API will be rate-limited.
 * @return {@code true} if the call has succeeded. {@code false} if the call is rate-limited.
 * @throws IllegalArgumentException if the caller application has already published themax number of dynamic shortcuts.
 */
public boolean addDynamicShortcuts(@NonNull List<ShortcutInfo> shortcutInfoList){
  try {
    return mService.addDynamicShortcuts(mContext.getPackageName(),new ParceledListSlice(shortcutInfoList),injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}

Fixed version (ground truth):
/** 
 * Publish list of dynamic shortcuts.  If there's already dynamic or pinned shortcuts with the same IDs, they will all be updated. <p>This API will be rate-limited.
 * @return {@code true} if the call has succeeded. {@code false} if the call is rate-limited.
 * @throws IllegalArgumentException if the caller application has already published themax number of dynamic shortcuts.
 */
public boolean addDynamicShortcuts(@NonNull List<ShortcutInfo> shortcutInfoList){
  try {
    return mService.addDynamicShortcuts(mContext.getPackageName(),new ParceledListSlice(shortcutInfoList),injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}
Program: 191611
Project: 191611
Buggy source:
/** 
 * Delete a single dynamic shortcut by ID.
 */
public void removeDynamicShortcuts(@NonNull List<String> shortcutIds){
  try {
    mService.removeDynamicShortcuts(mContext.getPackageName(),shortcutIds,injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}

Fixed version (ground truth):
/** 
 * Delete dynamic shortcuts by ID.
 */
public void removeDynamicShortcuts(@NonNull List<String> shortcutIds){
  try {
    mService.removeDynamicShortcuts(mContext.getPackageName(),shortcutIds,injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}
Program: 191612
Project: 191612
Buggy source:
public void pinShortcuts(@NonNull ShortcutService s,@UserIdInt int packageUserId,@NonNull String packageName,@NonNull List<String> ids){
  final ShortcutPackage packageShortcuts=s.getPackageShortcutsLocked(packageName,packageUserId);
  final PackageWithUser pu=PackageWithUser.of(packageUserId,packageName);
  final int idSize=ids.size();
  if (idSize == 0) {
    mPinnedShortcuts.remove(pu);
  }
 else {
    final ArraySet<String> prevSet=mPinnedShortcuts.get(pu);
    final ArraySet<String> newSet=new ArraySet<>();
    for (int i=0; i < idSize; i++) {
      final String id=ids.get(i);
      final ShortcutInfo si=packageShortcuts.findShortcutById(id);
      if (si == null) {
        continue;
      }
      if (si.isDynamic() || (prevSet != null && prevSet.contains(id))) {
        newSet.add(id);
      }
    }
    mPinnedShortcuts.put(pu,newSet);
  }
  packageShortcuts.refreshPinnedFlags(s);
}

Fixed version (ground truth):
public void pinShortcuts(@UserIdInt int packageUserId,@NonNull String packageName,@NonNull List<String> ids){
  final ShortcutPackage packageShortcuts=mShortcutUser.getPackageShortcutsIfExists(packageName);
  if (packageShortcuts == null) {
    return;
  }
  final PackageWithUser pu=PackageWithUser.of(packageUserId,packageName);
  final int idSize=ids.size();
  if (idSize == 0) {
    mPinnedShortcuts.remove(pu);
  }
 else {
    final ArraySet<String> prevSet=mPinnedShortcuts.get(pu);
    final ArraySet<String> newSet=new ArraySet<>();
    for (int i=0; i < idSize; i++) {
      final String id=ids.get(i);
      final ShortcutInfo si=packageShortcuts.findShortcutById(id);
      if (si == null) {
        continue;
      }
      if (si.isDynamic() || (prevSet != null && prevSet.contains(id))) {
        newSet.add(id);
      }
    }
    mPinnedShortcuts.put(pu,newSet);
  }
  packageShortcuts.refreshPinnedFlags();
}
Program: 191613
Project: 191613
Buggy source:
/** 
 * Called when the new package can't receive the backup, due to signature or version mismatch.
 */
@Override protected void onRestoreBlocked(ShortcutService s){
  final ArrayList<PackageWithUser> pinnedPackages=new ArrayList<>(mPinnedShortcuts.keySet());
  mPinnedShortcuts.clear();
  for (int i=pinnedPackages.size() - 1; i >= 0; i--) {
    final PackageWithUser pu=pinnedPackages.get(i);
    s.getPackageShortcutsLocked(pu.packageName,pu.userId).refreshPinnedFlags(s);
  }
}

Fixed version (ground truth):
/** 
 * Called when the new package can't receive the backup, due to signature or version mismatch.
 */
@Override protected void onRestoreBlocked(){
  final ArrayList<PackageWithUser> pinnedPackages=new ArrayList<>(mPinnedShortcuts.keySet());
  mPinnedShortcuts.clear();
  for (int i=pinnedPackages.size() - 1; i >= 0; i--) {
    final PackageWithUser pu=pinnedPackages.get(i);
    final ShortcutPackage p=mShortcutUser.getPackageShortcutsIfExists(pu.packageName);
    if (p != null) {
      p.refreshPinnedFlags();
    }
  }
}
Program: 191614
Project: 191614
Buggy source:
public void dump(@NonNull ShortcutService s,@NonNull PrintWriter pw,@NonNull String prefix){
  pw.println();
  pw.print(prefix);
  pw.print("String_Node_Str");
  pw.print(getPackageName());
  pw.print("String_Node_Str");
  pw.print(getPackageUserId());
  pw.print("String_Node_Str");
  pw.print(getOwnerUserId());
  pw.println();
  getPackageInfo().dump(s,pw,prefix + "String_Node_Str");
  pw.println();
  final int size=mPinnedShortcuts.size();
  for (int i=0; i < size; i++) {
    pw.println();
    final PackageWithUser pu=mPinnedShortcuts.keyAt(i);
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print("String_Node_Str");
    pw.print(pu.packageName);
    pw.print("String_Node_Str");
    pw.println(pu.userId);
    final ArraySet<String> ids=mPinnedShortcuts.valueAt(i);
    final int idSize=ids.size();
    for (int j=0; j < idSize; j++) {
      pw.print(prefix);
      pw.print("String_Node_Str");
      pw.print(ids.valueAt(j));
      pw.println();
    }
  }
}

Fixed version (ground truth):
public void dump(@NonNull PrintWriter pw,@NonNull String prefix){
  pw.println();
  pw.print(prefix);
  pw.print("String_Node_Str");
  pw.print(getPackageName());
  pw.print("String_Node_Str");
  pw.print(getPackageUserId());
  pw.print("String_Node_Str");
  pw.print(getOwnerUserId());
  pw.println();
  getPackageInfo().dump(pw,prefix + "String_Node_Str");
  pw.println();
  final int size=mPinnedShortcuts.size();
  for (int i=0; i < size; i++) {
    pw.println();
    final PackageWithUser pu=mPinnedShortcuts.keyAt(i);
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print("String_Node_Str");
    pw.print(pu.packageName);
    pw.print("String_Node_Str");
    pw.println(pu.userId);
    final ArraySet<String> ids=mPinnedShortcuts.valueAt(i);
    final int idSize=ids.size();
    for (int j=0; j < idSize; j++) {
      pw.print(prefix);
      pw.print("String_Node_Str");
      pw.print(ids.valueAt(j));
      pw.println();
    }
  }
}
Program: 191615
Project: 191615
Buggy source:
@Override protected void onRestored(ShortcutService s){
}

Fixed version (ground truth):
@Override protected void onRestored(){
}
Program: 191617
Project: 191617
Buggy source:
private boolean shouldShowOnKeyguard(StatusBarNotification sbn){
  return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey());
}

Fixed version (ground truth):
public boolean shouldShowOnKeyguard(StatusBarNotification sbn){
  return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey());
}
Program: 191618
Project: 191618
Buggy source:
/** 
 * @param maximum the maximum to return at most
 * @return the maximum keyguard notifications that can fit on the screen
 */
public int computeMaxKeyguardNotifications(int maximum){
  float minPadding=mClockPositionAlgorithm.getMinStackScrollerPadding(getHeight(),mKeyguardStatusView.getHeight());
  int notificationPadding=Math.max(1,getResources().getDimensionPixelSize(R.dimen.notification_divider_height));
  final int overflowheight=getResources().getDimensionPixelSize(R.dimen.notification_summary_height);
  float bottomStackSize=mNotificationStackScroller.getKeyguardBottomStackSize();
  float availableSpace=mNotificationStackScroller.getHeight() - minPadding - overflowheight- bottomStackSize;
  int count=0;
  for (int i=0; i < mNotificationStackScroller.getChildCount(); i++) {
    ExpandableView child=(ExpandableView)mNotificationStackScroller.getChildAt(i);
    if (!(child instanceof ExpandableNotificationRow)) {
      continue;
    }
    boolean suppressedSummary=mGroupManager.isSummaryOfSuppressedGroup(((ExpandableNotificationRow)child).getStatusBarNotification());
    if (suppressedSummary) {
      continue;
    }
    availableSpace-=child.getMinHeight() + notificationPadding;
    if (availableSpace >= 0 && count < maximum) {
      count++;
    }
 else {
      return count;
    }
  }
  return count;
}

Fixed version (ground truth):
/** 
 * @param maximum the maximum to return at most
 * @return the maximum keyguard notifications that can fit on the screen
 */
public int computeMaxKeyguardNotifications(int maximum){
  float minPadding=mClockPositionAlgorithm.getMinStackScrollerPadding(getHeight(),mKeyguardStatusView.getHeight());
  int notificationPadding=Math.max(1,getResources().getDimensionPixelSize(R.dimen.notification_divider_height));
  final int overflowheight=getResources().getDimensionPixelSize(R.dimen.notification_summary_height);
  float bottomStackSize=mNotificationStackScroller.getKeyguardBottomStackSize();
  float availableSpace=mNotificationStackScroller.getHeight() - minPadding - overflowheight- bottomStackSize;
  int count=0;
  for (int i=0; i < mNotificationStackScroller.getChildCount(); i++) {
    ExpandableView child=(ExpandableView)mNotificationStackScroller.getChildAt(i);
    if (!(child instanceof ExpandableNotificationRow)) {
      continue;
    }
    ExpandableNotificationRow row=(ExpandableNotificationRow)child;
    boolean suppressedSummary=mGroupManager.isSummaryOfSuppressedGroup(row.getStatusBarNotification());
    if (suppressedSummary) {
      continue;
    }
    if (!mStatusBar.shouldShowOnKeyguard(row.getStatusBarNotification())) {
      continue;
    }
    if (row.isRemoved()) {
      continue;
    }
    availableSpace-=child.getMinHeight() + notificationPadding;
    if (availableSpace >= 0 && count < maximum) {
      count++;
    }
 else {
      return count;
    }
  }
  return count;
}
Program: 191619
Project: 191619
Buggy source:
/** 
 * Ensures that the group children are cancelled immediately when the group summary is cancelled instead of waiting for the notification manager to send all cancels. Otherwise this could lead to flickers. This also ensures that the animation looks nice and only consists of a single disappear animation instead of multiple.
 * @param key the key of the notification was removed
 * @param ranking the current ranking
 */
private void handleGroupSummaryRemoved(String key,RankingMap ranking){
  Entry entry=mNotificationData.get(key);
  if (entry != null && entry.row != null && entry.row.isSummaryWithChildren()) {
    if (entry.notification.getOverrideGroupKey() != null && !entry.row.isDismissed()) {
      return;
    }
    entry.row.setRemoved(true);
    List<ExpandableNotificationRow> notificationChildren=entry.row.getNotificationChildren();
    ArrayList<ExpandableNotificationRow> toRemove=new ArrayList<>(notificationChildren);
    for (int i=0; i < toRemove.size(); i++) {
      toRemove.get(i).setKeepInParent(true);
    }
    for (int i=0; i < toRemove.size(); i++) {
      removeNotification(toRemove.get(i).getStatusBarNotification().getKey(),ranking);
      mStackScroller.removeViewStateForView(toRemove.get(i));
    }
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the group children are cancelled immediately when the group summary is cancelled instead of waiting for the notification manager to send all cancels. Otherwise this could lead to flickers. This also ensures that the animation looks nice and only consists of a single disappear animation instead of multiple.
 * @param key the key of the notification was removed
 * @param ranking the current ranking
 */
private void handleGroupSummaryRemoved(String key,RankingMap ranking){
  Entry entry=mNotificationData.get(key);
  if (entry != null && entry.row != null && entry.row.isSummaryWithChildren()) {
    if (entry.notification.getOverrideGroupKey() != null && !entry.row.isDismissed()) {
      return;
    }
    entry.row.setRemoved(true);
    List<ExpandableNotificationRow> notificationChildren=entry.row.getNotificationChildren();
    ArrayList<ExpandableNotificationRow> toRemove=new ArrayList<>(notificationChildren);
    for (int i=0; i < toRemove.size(); i++) {
      toRemove.get(i).setKeepInParent(true);
      toRemove.get(i).setRemoved(true);
    }
    for (int i=0; i < toRemove.size(); i++) {
      removeNotification(toRemove.get(i).getStatusBarNotification().getKey(),ranking);
      mStackScroller.removeViewStateForView(toRemove.get(i));
    }
  }
}
Program: 191620
Project: 191620
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  int childCount=Math.min(mChildren.size(),NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED);
  for (int i=0; i < childCount; i++) {
    View child=mChildren.get(i);
    if (child.getVisibility() == View.GONE) {
      continue;
    }
    child.layout(0,0,child.getMeasuredWidth(),child.getMeasuredHeight());
    mDividers.get(i).layout(0,0,getWidth(),mDividerHeight);
  }
  if (mOverflowNumber != null) {
    mOverflowNumber.layout(getWidth() - mOverflowNumber.getMeasuredWidth(),0,getWidth(),mOverflowNumber.getMeasuredHeight());
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  int childCount=Math.min(mChildren.size(),NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED);
  for (int i=0; i < childCount; i++) {
    View child=mChildren.get(i);
    child.layout(0,0,child.getMeasuredWidth(),child.getMeasuredHeight());
    mDividers.get(i).layout(0,0,getWidth(),mDividerHeight);
  }
  if (mOverflowNumber != null) {
    mOverflowNumber.layout(getWidth() - mOverflowNumber.getMeasuredWidth(),0,getWidth(),mOverflowNumber.getMeasuredHeight());
  }
}
Program: 191622
Project: 191622
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  float centerX=getWidth() / 2.0f;
  for (int i=0; i < getChildCount(); i++) {
    View child=getChildAt(i);
    if (child.getVisibility() == GONE) {
      continue;
    }
    float width=child.getMeasuredWidth();
    float height=child.getMeasuredHeight();
    child.layout((int)(centerX - width / 2.0f),0,(int)(centerX + width / 2.0f),(int)height);
  }
  setMaxLayoutHeight(getHeight());
  updateContentHeight();
  clampScrollPosition();
  if (mRequestViewResizeAnimationOnLayout) {
    requestAnimationOnViewResize(null);
    mRequestViewResizeAnimationOnLayout=false;
  }
  requestChildrenUpdate();
  updateFirstAndLastBackgroundViews();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  float centerX=getWidth() / 2.0f;
  for (int i=0; i < getChildCount(); i++) {
    View child=getChildAt(i);
    float width=child.getMeasuredWidth();
    float height=child.getMeasuredHeight();
    child.layout((int)(centerX - width / 2.0f),0,(int)(centerX + width / 2.0f),(int)height);
  }
  setMaxLayoutHeight(getHeight());
  updateContentHeight();
  clampScrollPosition();
  if (mRequestViewResizeAnimationOnLayout) {
    requestAnimationOnViewResize(null);
    mRequestViewResizeAnimationOnLayout=false;
  }
  requestChildrenUpdate();
  updateFirstAndLastBackgroundViews();
}
Program: 191623
Project: 191623
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  measureChildren(widthMeasureSpec,heightMeasureSpec);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  final int size=getChildCount();
  for (int i=0; i < size; i++) {
    measureChild(getChildAt(i),widthMeasureSpec,heightMeasureSpec);
  }
}
Program: 191624
Project: 191624
Buggy source:
/** 
 * Sets the intent of a shortcut.  This is a mandatory field.  The extras must only contain persistable information.  (See   {@link PersistableBundle}).
 */
@NonNull public Builder setIntent(@NonNull Intent intent){
  mIntent=Preconditions.checkNotNull(intent,"String_Node_Str");
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the intent of a shortcut.  This is a mandatory field.  The extras must only contain persistable information.  (See   {@link PersistableBundle}).
 */
@NonNull public Builder setIntent(@NonNull Intent intent){
  mIntent=Preconditions.checkNotNull(intent,"String_Node_Str");
  Preconditions.checkNotNull(mIntent.getAction(),"String_Node_Str");
  return this;
}
Program: 191625
Project: 191625
Buggy source:
/** 
 * Publish a single dynamic shortcut.  If there's already dynamic or pinned shortcuts with the same ID, they will all be updated. <p>This API will be rate-limited.
 * @return {@code true} if the call has succeeded. {@code false} if the call is rate-limited.
 * @throws IllegalArgumentException if the caller application has already published themax number of dynamic shortcuts.
 */
public boolean addDynamicShortcuts(@NonNull List<ShortcutInfo> shortcutInfoList){
  try {
    return mService.addDynamicShortcuts(mContext.getPackageName(),new ParceledListSlice(shortcutInfoList),injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}

Fixed version (ground truth):
/** 
 * Publish list of dynamic shortcuts.  If there's already dynamic or pinned shortcuts with the same IDs, they will all be updated. <p>This API will be rate-limited.
 * @return {@code true} if the call has succeeded. {@code false} if the call is rate-limited.
 * @throws IllegalArgumentException if the caller application has already published themax number of dynamic shortcuts.
 */
public boolean addDynamicShortcuts(@NonNull List<ShortcutInfo> shortcutInfoList){
  try {
    return mService.addDynamicShortcuts(mContext.getPackageName(),new ParceledListSlice(shortcutInfoList),injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}
Program: 191626
Project: 191626
Buggy source:
/** 
 * Delete a single dynamic shortcut by ID.
 */
public void removeDynamicShortcuts(@NonNull List<String> shortcutIds){
  try {
    mService.removeDynamicShortcuts(mContext.getPackageName(),shortcutIds,injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}

Fixed version (ground truth):
/** 
 * Delete dynamic shortcuts by ID.
 */
public void removeDynamicShortcuts(@NonNull List<String> shortcutIds){
  try {
    mService.removeDynamicShortcuts(mContext.getPackageName(),shortcutIds,injectMyUserId());
  }
 catch (  RemoteException e) {
    throw e.rethrowFromSystemServer();
  }
}