nus-yam/ex-repair huggingface dataset:
Program: 193109
Project: 193109
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(final boolean awakenFromDreams,final boolean respectKeyguard){
  if (respectKeyguard) {
    if (isKeyguardShowingAndNotOccluded()) {
      return;
    }
    if (!mHideLockScreen && mKeyguardDelegate.isInputRestricted()) {
      mKeyguardDelegate.verifyUnlock(new OnKeyguardExitResult(){
        @Override public void onKeyguardExitResult(        boolean success){
          if (success) {
            try {
              ActivityManagerNative.getDefault().stopAppSwitches();
            }
 catch (            RemoteException e) {
            }
            sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
            startDockOrHome(true,awakenFromDreams);
          }
        }
      }
);
      return;
    }
  }
  try {
    ActivityManagerNative.getDefault().stopAppSwitches();
  }
 catch (  RemoteException e) {
  }
  if (mRecentsVisible) {
    if (awakenFromDreams) {
      awakenDreams();
    }
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
    hideRecentApps(false,true);
  }
 else {
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
    startDockOrHome(true,awakenFromDreams);
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(final boolean awakenFromDreams,final boolean respectKeyguard){
  if (respectKeyguard) {
    if (isKeyguardShowingAndNotOccluded()) {
      return;
    }
    if (!mHideLockScreen && mKeyguardDelegate.isInputRestricted()) {
      mKeyguardDelegate.verifyUnlock(new OnKeyguardExitResult(){
        @Override public void onKeyguardExitResult(        boolean success){
          if (success) {
            try {
              ActivityManagerNative.getDefault().stopAppSwitches();
            }
 catch (            RemoteException e) {
            }
            sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
            startDockOrHome(true,awakenFromDreams);
          }
        }
      }
);
      return;
    }
  }
  try {
    ActivityManagerNative.getDefault().stopAppSwitches();
  }
 catch (  RemoteException e) {
  }
  if (mRecentsVisible) {
    if (awakenFromDreams) {
      awakenDreams();
    }
    hideRecentApps(false,true);
  }
 else {
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
    startDockOrHome(true,awakenFromDreams);
  }
}
Program: 193110
Project: 193110
Buggy source:
/** 
 * Dismisses Recents directly to Home without checking whether it is currently visible.
 */
void dismissRecentsToHome(boolean animated){
  if (animated) {
    ReferenceCountedTrigger exitTrigger=new ReferenceCountedTrigger(null,mFinishLaunchHomeRunnable,null);
    mRecentsView.startExitToHomeAnimation(new ViewAnimation.TaskViewExitContext(exitTrigger));
  }
 else {
    mFinishLaunchHomeRunnable.run();
  }
}

Fixed version (ground truth):
/** 
 * Dismisses Recents directly to Home without checking whether it is currently visible.
 */
void dismissRecentsToHome(boolean animated){
  if (animated) {
    ReferenceCountedTrigger exitTrigger=new ReferenceCountedTrigger();
    exitTrigger.increment();
    exitTrigger.addLastDecrementRunnable(mFinishLaunchHomeRunnable);
    exitTrigger.addLastDecrementRunnable(new Runnable(){
      @Override public void run(){
        Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
      }
    }
);
    mRecentsView.startExitToHomeAnimation(new ViewAnimation.TaskViewExitContext(exitTrigger));
    exitTrigger.decrement();
  }
 else {
    mFinishLaunchHomeRunnable.run();
    Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
  }
}
Program: 193112
Project: 193112
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
  if (mFinishedOnStartup) {
    return;
  }
  unregisterReceiver(mSystemBroadcastReceiver);
  mPackageMonitor.unregister();
  if (!RecentsDebugFlags.Static.DisableSearchBar) {
    mAppWidgetHost.stopListening();
  }
  EventBus.getDefault().unregister(this);
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
  if (mFinishedOnStartup) {
    return;
  }
  unregisterReceiver(mSystemBroadcastReceiver);
  mPackageMonitor.unregister();
  if (RecentsDebugFlags.Static.EnableSearchBar) {
    mAppWidgetHost.stopListening();
  }
  EventBus.getDefault().unregister(this);
}
Program: 193113
Project: 193113
Buggy source:
@Override public void toggleRecents(){
  if (mFastAltTabTrigger.isDozing()) {
    return;
  }
  mDraggingInRecents=false;
  mTriggeredFromAltTab=false;
  try {
    SystemServicesProxy ssp=Recents.getSystemServices();
    ActivityManager.RunningTaskInfo topTask=ssp.getTopMostTask();
    MutableBoolean isTopTaskHome=new MutableBoolean(true);
    if (topTask != null && ssp.isRecentsTopMost(topTask,isTopTaskHome)) {
      RecentsConfiguration config=Recents.getConfiguration();
      RecentsActivityLaunchState launchState=config.getLaunchState();
      RecentsDebugFlags flags=Recents.getDebugFlags();
      if (!launchState.launchedWithAltTab) {
        EventBus.getDefault().post(new IterateRecentsEvent());
      }
 else {
        if ((SystemClock.elapsedRealtime() - mLastToggleTime) < MIN_TOGGLE_DELAY_MS) {
          return;
        }
        EventBus.getDefault().post(new ToggleRecentsEvent());
        mLastToggleTime=SystemClock.elapsedRealtime();
      }
      return;
    }
 else {
      if ((SystemClock.elapsedRealtime() - mLastToggleTime) < MIN_TOGGLE_DELAY_MS) {
        return;
      }
      startRecentsActivity(topTask,isTopTaskHome.value,true);
      mLastToggleTime=SystemClock.elapsedRealtime();
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void toggleRecents(){
  if (mFastAltTabTrigger.isDozing()) {
    return;
  }
  mDraggingInRecents=false;
  mTriggeredFromAltTab=false;
  try {
    SystemServicesProxy ssp=Recents.getSystemServices();
    ActivityManager.RunningTaskInfo topTask=ssp.getTopMostTask();
    MutableBoolean isTopTaskHome=new MutableBoolean(true);
    if (topTask != null && ssp.isRecentsTopMost(topTask,isTopTaskHome)) {
      RecentsConfiguration config=Recents.getConfiguration();
      RecentsActivityLaunchState launchState=config.getLaunchState();
      RecentsDebugFlags flags=Recents.getDebugFlags();
      if (!launchState.launchedWithAltTab) {
        EventBus.getDefault().post(new IterateRecentsEvent());
      }
 else {
        if ((SystemClock.elapsedRealtime() - mLastToggleTime) < MIN_TOGGLE_DELAY_MS) {
          return;
        }
        EventBus.getDefault().post(new ToggleRecentsEvent());
        mLastToggleTime=SystemClock.elapsedRealtime();
      }
      return;
    }
 else {
      if ((SystemClock.elapsedRealtime() - mLastToggleTime) < MIN_TOGGLE_DELAY_MS) {
        return;
      }
      startRecentsActivity(topTask,isTopTaskHome.value,true);
      ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
      mLastToggleTime=SystemClock.elapsedRealtime();
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 193115
Project: 193115
Buggy source:
/** 
 * Returns the package name of the home activity. 
 */
public String getHomeActivityPackageName(){
  if (mPm == null)   return null;
  if (RecentsDebugFlags.Static.EnableSystemServicesProxy)   return null;
  ArrayList<ResolveInfo> homeActivities=new ArrayList<ResolveInfo>();
  ComponentName defaultHomeActivity=mPm.getHomeActivities(homeActivities);
  if (defaultHomeActivity != null) {
    return defaultHomeActivity.getPackageName();
  }
 else   if (homeActivities.size() == 1) {
    ResolveInfo info=homeActivities.get(0);
    if (info.activityInfo != null) {
      return info.activityInfo.packageName;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the package name of the home activity. 
 */
public String getHomeActivityPackageName(){
  if (mPm == null)   return null;
  if (RecentsDebugFlags.Static.EnableSystemServicesProxy)   return null;
  ArrayList<ResolveInfo> homeActivities=new ArrayList<>();
  ComponentName defaultHomeActivity=mPm.getHomeActivities(homeActivities);
  if (defaultHomeActivity != null) {
    return defaultHomeActivity.getPackageName();
  }
 else   if (homeActivities.size() == 1) {
    ResolveInfo info=homeActivities.get(0);
    if (info.activityInfo != null) {
      return info.activityInfo.packageName;
    }
  }
  return null;
}
Program: 193116
Project: 193116
Buggy source:
/** 
 * Returns the first Recents widget from the same package as the global assist activity.
 */
private AppWidgetProviderInfo resolveSearchAppWidget(){
  if (mAssistComponent == null)   return null;
  List<AppWidgetProviderInfo> widgets=mAwm.getInstalledProviders(AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX);
  for (  AppWidgetProviderInfo info : widgets) {
    if (info.provider.getPackageName().equals(mAssistComponent.getPackageName())) {
      return info;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the first Recents widget from the same package as the global assist activity.
 */
public AppWidgetProviderInfo resolveSearchAppWidget(){
  if (mAssistComponent == null)   return null;
  List<AppWidgetProviderInfo> widgets=mAwm.getInstalledProviders(AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX);
  for (  AppWidgetProviderInfo info : widgets) {
    if (info.provider.getPackageName().equals(mAssistComponent.getPackageName())) {
      return info;
    }
  }
  return null;
}
Program: 193117
Project: 193117
Buggy source:
/** 
 * Shows the task stack and hides the empty view.
 */
public void hideEmptyView(){
  mEmptyView.setVisibility(View.INVISIBLE);
  mTaskStackView.setVisibility(View.VISIBLE);
  if (!RecentsDebugFlags.Static.DisableSearchBar && (mSearchBar != null)) {
    mSearchBar.setVisibility(View.VISIBLE);
  }
  mTaskStackView.bringToFront();
  if (mSearchBar != null) {
    mSearchBar.bringToFront();
  }
  mHistoryButton.bringToFront();
}

Fixed version (ground truth):
/** 
 * Shows the task stack and hides the empty view.
 */
public void hideEmptyView(){
  mEmptyView.setVisibility(View.INVISIBLE);
  mTaskStackView.setVisibility(View.VISIBLE);
  if (RecentsDebugFlags.Static.EnableSearchBar && (mSearchBar != null)) {
    mSearchBar.setVisibility(View.VISIBLE);
  }
  mTaskStackView.bringToFront();
  if (mSearchBar != null) {
    mSearchBar.bringToFront();
  }
  mHistoryButton.bringToFront();
}
Program: 193118
Project: 193118
Buggy source:
/** 
 * Hides the task stack and shows the empty view.
 */
public void showEmptyView(){
  if (!RecentsDebugFlags.Static.DisableSearchBar && (mSearchBar != null)) {
    mSearchBar.setVisibility(View.INVISIBLE);
  }
  mTaskStackView.setVisibility(View.INVISIBLE);
  mEmptyView.setVisibility(View.VISIBLE);
  mEmptyView.bringToFront();
  mHistoryButton.bringToFront();
}

Fixed version (ground truth):
/** 
 * Hides the task stack and shows the empty view.
 */
public void showEmptyView(){
  if (RecentsDebugFlags.Static.EnableSearchBar && (mSearchBar != null)) {
    mSearchBar.setVisibility(View.INVISIBLE);
  }
  mTaskStackView.setVisibility(View.INVISIBLE);
  mEmptyView.setVisibility(View.VISIBLE);
  mEmptyView.bringToFront();
  mHistoryButton.bringToFront();
}
Program: 193120
Project: 193120
Buggy source:
protected void toggleRecents(){
  if (mRecents != null) {
    sendCloseSystemWindows(mContext,SYSTEM_DIALOG_REASON_RECENT_APPS);
    mRecents.toggleRecents(mDisplay,mLayoutDirection,getStatusBarView());
  }
}

Fixed version (ground truth):
protected void toggleRecents(){
  if (mRecents != null) {
    mRecents.toggleRecents(mDisplay,mLayoutDirection,getStatusBarView());
  }
}
Program: 193121
Project: 193121
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(final boolean awakenFromDreams,final boolean respectKeyguard){
  if (respectKeyguard) {
    if (isKeyguardShowingAndNotOccluded()) {
      return;
    }
    if (!mHideLockScreen && mKeyguardDelegate.isInputRestricted()) {
      mKeyguardDelegate.verifyUnlock(new OnKeyguardExitResult(){
        @Override public void onKeyguardExitResult(        boolean success){
          if (success) {
            try {
              ActivityManagerNative.getDefault().stopAppSwitches();
            }
 catch (            RemoteException e) {
            }
            sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
            startDockOrHome(true,awakenFromDreams);
          }
        }
      }
);
      return;
    }
  }
  try {
    ActivityManagerNative.getDefault().stopAppSwitches();
  }
 catch (  RemoteException e) {
  }
  if (mRecentsVisible) {
    if (awakenFromDreams) {
      awakenDreams();
    }
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
    hideRecentApps(false,true);
  }
 else {
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
    startDockOrHome(true,awakenFromDreams);
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(final boolean awakenFromDreams,final boolean respectKeyguard){
  if (respectKeyguard) {
    if (isKeyguardShowingAndNotOccluded()) {
      return;
    }
    if (!mHideLockScreen && mKeyguardDelegate.isInputRestricted()) {
      mKeyguardDelegate.verifyUnlock(new OnKeyguardExitResult(){
        @Override public void onKeyguardExitResult(        boolean success){
          if (success) {
            try {
              ActivityManagerNative.getDefault().stopAppSwitches();
            }
 catch (            RemoteException e) {
            }
            sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
            startDockOrHome(true,awakenFromDreams);
          }
        }
      }
);
      return;
    }
  }
  try {
    ActivityManagerNative.getDefault().stopAppSwitches();
  }
 catch (  RemoteException e) {
  }
  if (mRecentsVisible) {
    if (awakenFromDreams) {
      awakenDreams();
    }
    hideRecentApps(false,true);
  }
 else {
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
    startDockOrHome(true,awakenFromDreams);
  }
}
Program: 193123
Project: 193123
Buggy source:
@Override public boolean hasOverlappingRendering(){
  return super.hasOverlappingRendering() && !mMeasuredTooHigh;
}

Fixed version (ground truth):
@Override public boolean hasOverlappingRendering(){
  return super.hasOverlappingRendering() && getActualHeight() <= getHeight();
}
Program: 193125
Project: 193125
Buggy source:
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (mIsExpanded) {
    return;
  }
  if (mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY + mNotificationsTopPadding);
  }
 else   if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(0,0,mStatusBarWindowView.getWidth(),mStatusBarHeight);
  }
}

Fixed version (ground truth):
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (mIsExpanded) {
    return;
  }
  if (mHasPinnedNotification) {
    int minX=0;
    int maxX=0;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=mTmpTwoArray[0];
        maxX=mTmpTwoArray[0] + row.getWidth();
        maxY=row.getHeadsUpHeight();
        break;
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,0,maxX,maxY + mNotificationsTopPadding);
  }
 else   if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(0,0,mStatusBarWindowView.getWidth(),mStatusBarHeight);
  }
}
Program: 193126
Project: 193126
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int ownMaxHeight=mMaxNotificationHeight;
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  boolean hasFixedHeight=heightMode == MeasureSpec.EXACTLY;
  boolean isHeightLimited=heightMode == MeasureSpec.AT_MOST;
  if (hasFixedHeight || isHeightLimited) {
    int size=MeasureSpec.getSize(heightMeasureSpec);
    ownMaxHeight=Math.min(ownMaxHeight,size);
  }
  int newHeightSpec=MeasureSpec.makeMeasureSpec(ownMaxHeight,MeasureSpec.AT_MOST);
  int dividerHeightSpec=MeasureSpec.makeMeasureSpec(mDividerHeight,MeasureSpec.EXACTLY);
  int height=mNotificationHeaderHeight + mNotificatonTopPadding;
  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.measure(widthMeasureSpec,newHeightSpec);
    height+=child.getMeasuredHeight();
    View divider=mDividers.get(i);
    divider.measure(widthMeasureSpec,dividerHeightSpec);
    height+=mDividerHeight;
  }
  int width=MeasureSpec.getSize(widthMeasureSpec);
  if (mGroupOverflowContainer != null) {
    mGroupOverflowContainer.measure(widthMeasureSpec,newHeightSpec);
  }
  setMeasuredDimension(width,height);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int ownMaxHeight=mMaxNotificationHeight;
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  boolean hasFixedHeight=heightMode == MeasureSpec.EXACTLY;
  boolean isHeightLimited=heightMode == MeasureSpec.AT_MOST;
  int size=MeasureSpec.getSize(heightMeasureSpec);
  if (hasFixedHeight || isHeightLimited) {
    ownMaxHeight=Math.min(ownMaxHeight,size);
  }
  int newHeightSpec=MeasureSpec.makeMeasureSpec(ownMaxHeight,MeasureSpec.AT_MOST);
  int dividerHeightSpec=MeasureSpec.makeMeasureSpec(mDividerHeight,MeasureSpec.EXACTLY);
  int height=mNotificationHeaderHeight + mNotificatonTopPadding;
  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.measure(widthMeasureSpec,newHeightSpec);
    height+=child.getMeasuredHeight();
    View divider=mDividers.get(i);
    divider.measure(widthMeasureSpec,dividerHeightSpec);
    height+=mDividerHeight;
  }
  int width=MeasureSpec.getSize(widthMeasureSpec);
  if (mGroupOverflowContainer != null) {
    mGroupOverflowContainer.measure(widthMeasureSpec,newHeightSpec);
  }
  mRealHeight=height;
  if (heightMode != MeasureSpec.UNSPECIFIED) {
    height=Math.min(height,size);
  }
  setMeasuredDimension(width,height);
}
Program: 193130
Project: 193130
Buggy source:
void moveActivityToStackLocked(ActivityRecord r,int stackId,String reason,Rect bounds){
  final TaskRecord task=r.task;
  if (task.mActivities.size() == 1) {
    moveTaskToStackLocked(task.taskId,stackId,ON_TOP,FORCE_FOCUS,reason,true);
  }
 else {
    final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,ON_TOP);
    stack.moveActivityToStack(r);
  }
  if (bounds != null) {
    resizeStackLocked(PINNED_STACK_ID,bounds,!PRESERVE_WINDOWS,true);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}

Fixed version (ground truth):
void moveActivityToStackLocked(ActivityRecord r,int stackId,String reason,Rect bounds){
  final TaskRecord task=r.task;
  if (task.mActivities.size() == 1) {
    moveTaskToStackLocked(task.taskId,stackId,ON_TOP,FORCE_FOCUS,reason,true);
  }
 else {
    final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,ON_TOP);
    stack.moveActivityToStack(r);
  }
  if (bounds != null) {
    resizeStackLocked(stackId,bounds,!PRESERVE_WINDOWS,true);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}
Program: 193131
Project: 193131
Buggy source:
ActivityRecord findTaskLocked(ActivityRecord r){
  if (DEBUG_TASKS)   Slog.d(TAG_TASKS,"String_Node_Str" + r);
  for (int displayNdx=mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
    final ArrayList<ActivityStack> stacks=mActivityDisplays.valueAt(displayNdx).mStacks;
    for (int stackNdx=stacks.size() - 1; stackNdx >= 0; --stackNdx) {
      final ActivityStack stack=stacks.get(stackNdx);
      if (!r.isApplicationActivity() && !stack.isHomeStack()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      if (!stack.mActivityContainer.isEligibleForNewTasks()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      final ActivityRecord ar=stack.findTaskLocked(r);
      if (ar != null) {
        return ar;
      }
    }
  }
  if (DEBUG_TASKS)   Slog.d(TAG_TASKS,"String_Node_Str");
  return null;
}

Fixed version (ground truth):
ActivityRecord findTaskLocked(ActivityRecord r){
  mTmpFindTaskResult.r=null;
  mTmpFindTaskResult.matchedByRootAffinity=false;
  if (DEBUG_TASKS)   Slog.d(TAG_TASKS,"String_Node_Str" + r);
  for (int displayNdx=mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
    final ArrayList<ActivityStack> stacks=mActivityDisplays.valueAt(displayNdx).mStacks;
    for (int stackNdx=stacks.size() - 1; stackNdx >= 0; --stackNdx) {
      final ActivityStack stack=stacks.get(stackNdx);
      if (!r.isApplicationActivity() && !stack.isHomeStack()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      if (!stack.mActivityContainer.isEligibleForNewTasks()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      stack.findTaskLocked(r,mTmpFindTaskResult);
      if (mTmpFindTaskResult.r != null && !mTmpFindTaskResult.matchedByRootAffinity) {
        return mTmpFindTaskResult.r;
      }
    }
  }
  if (DEBUG_TASKS && mTmpFindTaskResult.r == null)   Slog.d(TAG_TASKS,"String_Node_Str");
  return mTmpFindTaskResult.r;
}
Program: 193133
Project: 193133
Buggy source:
void moveActivityToStackLocked(ActivityRecord r,int stackId,String reason,Rect bounds){
  final TaskRecord task=r.task;
  if (task.mActivities.size() == 1) {
    moveTaskToStackLocked(task.taskId,stackId,ON_TOP,FORCE_FOCUS,reason,true);
  }
 else {
    final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,ON_TOP);
    stack.moveActivityToStack(r);
  }
  if (bounds != null) {
    resizeStackLocked(PINNED_STACK_ID,bounds,!PRESERVE_WINDOWS,true);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}

Fixed version (ground truth):
void moveActivityToStackLocked(ActivityRecord r,int stackId,String reason,Rect bounds){
  final TaskRecord task=r.task;
  if (task.mActivities.size() == 1) {
    moveTaskToStackLocked(task.taskId,stackId,ON_TOP,FORCE_FOCUS,reason,true);
  }
 else {
    final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,ON_TOP);
    stack.moveActivityToStack(r);
  }
  if (bounds != null) {
    resizeStackLocked(stackId,bounds,!PRESERVE_WINDOWS,true);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}
Program: 193134
Project: 193134
Buggy source:
ActivityRecord findTaskLocked(ActivityRecord r){
  if (DEBUG_TASKS)   Slog.d(TAG_TASKS,"String_Node_Str" + r);
  for (int displayNdx=mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
    final ArrayList<ActivityStack> stacks=mActivityDisplays.valueAt(displayNdx).mStacks;
    for (int stackNdx=stacks.size() - 1; stackNdx >= 0; --stackNdx) {
      final ActivityStack stack=stacks.get(stackNdx);
      if (!r.isApplicationActivity() && !stack.isHomeStack()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      if (!stack.mActivityContainer.isEligibleForNewTasks()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      final ActivityRecord ar=stack.findTaskLocked(r);
      if (ar != null) {
        return ar;
      }
    }
  }
  if (DEBUG_TASKS)   Slog.d(TAG_TASKS,"String_Node_Str");
  return null;
}

Fixed version (ground truth):
ActivityRecord findTaskLocked(ActivityRecord r){
  mTmpFindTaskResult.r=null;
  mTmpFindTaskResult.matchedByRootAffinity=false;
  if (DEBUG_TASKS)   Slog.d(TAG_TASKS,"String_Node_Str" + r);
  for (int displayNdx=mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
    final ArrayList<ActivityStack> stacks=mActivityDisplays.valueAt(displayNdx).mStacks;
    for (int stackNdx=stacks.size() - 1; stackNdx >= 0; --stackNdx) {
      final ActivityStack stack=stacks.get(stackNdx);
      if (!r.isApplicationActivity() && !stack.isHomeStack()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      if (!stack.mActivityContainer.isEligibleForNewTasks()) {
        if (DEBUG_TASKS)         Slog.d(TAG_TASKS,"String_Node_Str" + stack);
        continue;
      }
      stack.findTaskLocked(r,mTmpFindTaskResult);
      if (mTmpFindTaskResult.r != null && !mTmpFindTaskResult.matchedByRootAffinity) {
        return mTmpFindTaskResult.r;
      }
    }
  }
  if (DEBUG_TASKS && mTmpFindTaskResult.r == null)   Slog.d(TAG_TASKS,"String_Node_Str");
  return mTmpFindTaskResult.r;
}
Program: 193135
Project: 193135
Buggy source:
private void writeBundleToXml(PersistableBundle extras,XmlSerializer out) throws IOException, XmlPullParserException {
  out.startTag(null,XML_TAG_EXTRAS);
  extras.saveToXml(out);
  out.endTag(null,XML_TAG_EXTRAS);
}

Fixed version (ground truth):
private void writeBundleToXml(PersistableBundle extras,XmlSerializer out) throws IOException, XmlPullParserException {
  out.startTag(null,XML_TAG_EXTRAS);
  PersistableBundle extrasCopy=deepCopyBundle(extras,10);
  extrasCopy.saveToXml(out);
  out.endTag(null,XML_TAG_EXTRAS);
}
Program: 193136
Project: 193136
Buggy source:
/** 
 * Set the grouping 
 */
public void setGroup(TaskGrouping group){
  if (group != null && this.group != null) {
    throw new RuntimeException("String_Node_Str");
  }
  this.group=group;
}

Fixed version (ground truth):
/** 
 * Set the grouping 
 */
public void setGroup(TaskGrouping group){
  this.group=group;
}
Program: 193138
Project: 193138
Buggy source:
/** 
 * Sets the thumbnail to a given bitmap. 
 */
void setThumbnail(Bitmap bm){
  if (bm != null) {
    mBitmapShader=new BitmapShader(bm,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP);
    mDrawPaint.setShader(mBitmapShader);
  }
 else {
    mBitmapShader=null;
    mDrawPaint.setShader(null);
  }
}

Fixed version (ground truth):
/** 
 * Sets the thumbnail to a given bitmap. 
 */
void setThumbnail(Bitmap bm){
  if (bm != null) {
    mBitmapShader=new BitmapShader(bm,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP);
    mDrawPaint.setShader(mBitmapShader);
  }
 else {
    mBitmapShader=null;
    mDrawPaint.setShader(null);
  }
  invalidate();
}
Program: 193139
Project: 193139
Buggy source:
/** 
 * Set the grouping 
 */
public void setGroup(TaskGrouping group){
  if (group != null && this.group != null) {
    throw new RuntimeException("String_Node_Str");
  }
  this.group=group;
}

Fixed version (ground truth):
/** 
 * Set the grouping 
 */
public void setGroup(TaskGrouping group){
  this.group=group;
}
Program: 193141
Project: 193141
Buggy source:
/** 
 * Sets the thumbnail to a given bitmap. 
 */
void setThumbnail(Bitmap bm){
  if (bm != null) {
    mBitmapShader=new BitmapShader(bm,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP);
    mDrawPaint.setShader(mBitmapShader);
  }
 else {
    mBitmapShader=null;
    mDrawPaint.setShader(null);
  }
}

Fixed version (ground truth):
/** 
 * Sets the thumbnail to a given bitmap. 
 */
void setThumbnail(Bitmap bm){
  if (bm != null) {
    mBitmapShader=new BitmapShader(bm,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP);
    mDrawPaint.setShader(mBitmapShader);
  }
 else {
    mBitmapShader=null;
    mDrawPaint.setShader(null);
  }
  invalidate();
}
Program: 193142
Project: 193142
Buggy source:
private void writeBundleToXml(PersistableBundle extras,XmlSerializer out) throws IOException, XmlPullParserException {
  out.startTag(null,XML_TAG_EXTRAS);
  extras.saveToXml(out);
  out.endTag(null,XML_TAG_EXTRAS);
}

Fixed version (ground truth):
private void writeBundleToXml(PersistableBundle extras,XmlSerializer out) throws IOException, XmlPullParserException {
  out.startTag(null,XML_TAG_EXTRAS);
  PersistableBundle extrasCopy=deepCopyBundle(extras,10);
  extrasCopy.saveToXml(out);
  out.endTag(null,XML_TAG_EXTRAS);
}
Program: 193143
Project: 193143
Buggy source:
/** 
 * Called by the system when the activity changes from fullscreen mode to multi-window mode and visa-versa.
 * @see android.R.attr#resizeableActivity
 * @param multiWindowMode True if the activity is in multi-window mode.
 */
public void onMultiWindowModeChanged(boolean multiWindowMode){
  if (DEBUG_LIFECYCLE)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ multiWindowMode);
}

Fixed version (ground truth):
/** 
 * Called by the system when the activity changes from fullscreen mode to multi-window mode and visa-versa.
 * @see android.R.attr#resizeableActivity
 * @param multiWindowMode True if the activity is in multi-window mode.
 */
@CallSuper public void onMultiWindowModeChanged(boolean multiWindowMode){
  if (DEBUG_LIFECYCLE)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ multiWindowMode);
  if (mWindow != null) {
    mWindow.onMultiWindowModeChanged();
  }
}
Program: 193144
Project: 193144
Buggy source:
private void updateElevation(){
  float elevation=0;
  final boolean wasAdjustedForStack=mElevationAdjustedForStack;
  if (ActivityManager.StackId.hasWindowShadow(mStackId) && !isResizing()) {
    elevation=hasWindowFocus() ? DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP;
    if (!mAllowUpdateElevation) {
      elevation=DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP;
    }
    elevation=dipToPx(elevation);
    mElevationAdjustedForStack=true;
  }
 else {
    mElevationAdjustedForStack=false;
  }
  if ((wasAdjustedForStack || mElevationAdjustedForStack) && getElevation() != elevation) {
    mWindow.setElevation(elevation);
  }
}

Fixed version (ground truth):
private void updateElevation(){
  float elevation=0;
  final boolean wasAdjustedForStack=mElevationAdjustedForStack;
  if (StackId.hasWindowShadow(mStackId) && !isResizing()) {
    elevation=hasWindowFocus() ? DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP;
    if (!mAllowUpdateElevation) {
      elevation=DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP;
    }
    elevation=dipToPx(elevation);
    mElevationAdjustedForStack=true;
  }
 else {
    mElevationAdjustedForStack=false;
  }
  if ((wasAdjustedForStack || mElevationAdjustedForStack) && getElevation() != elevation) {
    mWindow.setElevation(elevation);
  }
}
Program: 193145
Project: 193145
Buggy source:
private DecorCaptionView createDecorCaptionView(LayoutInflater inflater){
  DecorCaptionView decorCaptionView=null;
  for (int i=getChildCount() - 1; i >= 0 && decorCaptionView == null; i--) {
    View view=getChildAt(i);
    if (view instanceof DecorCaptionView) {
      decorCaptionView=(DecorCaptionView)view;
      removeViewAt(i);
    }
  }
  final WindowManager.LayoutParams attrs=mWindow.getAttributes();
  final boolean isApplication=attrs.type == TYPE_BASE_APPLICATION || attrs.type == TYPE_APPLICATION;
  if (!mWindow.isFloating() && isApplication && ActivityManager.StackId.hasWindowDecor(mStackId)) {
    if (decorCaptionView == null) {
      decorCaptionView=inflateDecorCaptionView(inflater);
    }
    decorCaptionView.setPhoneWindow(mWindow,true);
  }
 else {
    decorCaptionView=null;
  }
  enableCaption(decorCaptionView != null);
  return decorCaptionView;
}

Fixed version (ground truth):
private DecorCaptionView createDecorCaptionView(LayoutInflater inflater){
  DecorCaptionView decorCaptionView=null;
  for (int i=getChildCount() - 1; i >= 0 && decorCaptionView == null; i--) {
    View view=getChildAt(i);
    if (view instanceof DecorCaptionView) {
      decorCaptionView=(DecorCaptionView)view;
      removeViewAt(i);
    }
  }
  final WindowManager.LayoutParams attrs=mWindow.getAttributes();
  final boolean isApplication=attrs.type == TYPE_BASE_APPLICATION || attrs.type == TYPE_APPLICATION;
  if (!mWindow.isFloating() && isApplication && StackId.hasWindowDecor(mStackId)) {
    if (decorCaptionView == null) {
      decorCaptionView=inflateDecorCaptionView(inflater);
    }
    decorCaptionView.setPhoneWindow(mWindow,true);
  }
 else {
    decorCaptionView=null;
  }
  enableCaption(decorCaptionView != null);
  return decorCaptionView;
}
Program: 193147
Project: 193147
Buggy source:
void onConfigurationChanged(){
  int workspaceId=getStackId();
  if (mDecorCaptionView != null) {
    if (mStackId != workspaceId) {
      mStackId=workspaceId;
      mDecorCaptionView.onConfigurationChanged(ActivityManager.StackId.hasWindowDecor(mStackId));
      enableCaption(ActivityManager.StackId.hasWindowDecor(workspaceId));
    }
  }
  initializeElevation();
}

Fixed version (ground truth):
void onConfigurationChanged(){
  int workspaceId=getStackId();
  if (mStackId != workspaceId) {
    mStackId=workspaceId;
    if (mDecorCaptionView == null && StackId.hasWindowDecor(mStackId)) {
      final LayoutInflater inflater=mWindow.getLayoutInflater();
      mDecorCaptionView=createDecorCaptionView(inflater);
      if (mDecorCaptionView != null) {
        if (mDecorCaptionView.getParent() == null) {
          addView(mDecorCaptionView,0,new ViewGroup.LayoutParams(MATCH_PARENT,MATCH_PARENT));
        }
        removeView(mContentRoot);
        mDecorCaptionView.addView(mContentRoot,new ViewGroup.MarginLayoutParams(MATCH_PARENT,MATCH_PARENT));
      }
    }
 else     if (mDecorCaptionView != null) {
      mDecorCaptionView.onConfigurationChanged(StackId.hasWindowDecor(mStackId));
      enableCaption(StackId.hasWindowDecor(workspaceId));
    }
  }
  initializeElevation();
}
Program: 193148
Project: 193148
Buggy source:
/** 
 * Called by the system when the activity changes from fullscreen mode to multi-window mode and visa-versa.
 * @see android.R.attr#resizeableActivity
 * @param multiWindowMode True if the activity is in multi-window mode.
 */
public void onMultiWindowModeChanged(boolean multiWindowMode){
  if (DEBUG_LIFECYCLE)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ multiWindowMode);
}

Fixed version (ground truth):
/** 
 * Called by the system when the activity changes from fullscreen mode to multi-window mode and visa-versa.
 * @see android.R.attr#resizeableActivity
 * @param multiWindowMode True if the activity is in multi-window mode.
 */
@CallSuper public void onMultiWindowModeChanged(boolean multiWindowMode){
  if (DEBUG_LIFECYCLE)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ multiWindowMode);
  if (mWindow != null) {
    mWindow.onMultiWindowModeChanged();
  }
}
Program: 193149
Project: 193149
Buggy source:
private void updateElevation(){
  float elevation=0;
  final boolean wasAdjustedForStack=mElevationAdjustedForStack;
  if (ActivityManager.StackId.hasWindowShadow(mStackId) && !isResizing()) {
    elevation=hasWindowFocus() ? DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP;
    if (!mAllowUpdateElevation) {
      elevation=DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP;
    }
    elevation=dipToPx(elevation);
    mElevationAdjustedForStack=true;
  }
 else {
    mElevationAdjustedForStack=false;
  }
  if ((wasAdjustedForStack || mElevationAdjustedForStack) && getElevation() != elevation) {
    mWindow.setElevation(elevation);
  }
}

Fixed version (ground truth):
private void updateElevation(){
  float elevation=0;
  final boolean wasAdjustedForStack=mElevationAdjustedForStack;
  if (StackId.hasWindowShadow(mStackId) && !isResizing()) {
    elevation=hasWindowFocus() ? DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP;
    if (!mAllowUpdateElevation) {
      elevation=DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP;
    }
    elevation=dipToPx(elevation);
    mElevationAdjustedForStack=true;
  }
 else {
    mElevationAdjustedForStack=false;
  }
  if ((wasAdjustedForStack || mElevationAdjustedForStack) && getElevation() != elevation) {
    mWindow.setElevation(elevation);
  }
}
Program: 193150
Project: 193150
Buggy source:
private DecorCaptionView createDecorCaptionView(LayoutInflater inflater){
  DecorCaptionView decorCaptionView=null;
  for (int i=getChildCount() - 1; i >= 0 && decorCaptionView == null; i--) {
    View view=getChildAt(i);
    if (view instanceof DecorCaptionView) {
      decorCaptionView=(DecorCaptionView)view;
      removeViewAt(i);
    }
  }
  final WindowManager.LayoutParams attrs=mWindow.getAttributes();
  final boolean isApplication=attrs.type == TYPE_BASE_APPLICATION || attrs.type == TYPE_APPLICATION;
  if (!mWindow.isFloating() && isApplication && ActivityManager.StackId.hasWindowDecor(mStackId)) {
    if (decorCaptionView == null) {
      decorCaptionView=inflateDecorCaptionView(inflater);
    }
    decorCaptionView.setPhoneWindow(mWindow,true);
  }
 else {
    decorCaptionView=null;
  }
  enableCaption(decorCaptionView != null);
  return decorCaptionView;
}

Fixed version (ground truth):
private DecorCaptionView createDecorCaptionView(LayoutInflater inflater){
  DecorCaptionView decorCaptionView=null;
  for (int i=getChildCount() - 1; i >= 0 && decorCaptionView == null; i--) {
    View view=getChildAt(i);
    if (view instanceof DecorCaptionView) {
      decorCaptionView=(DecorCaptionView)view;
      removeViewAt(i);
    }
  }
  final WindowManager.LayoutParams attrs=mWindow.getAttributes();
  final boolean isApplication=attrs.type == TYPE_BASE_APPLICATION || attrs.type == TYPE_APPLICATION;
  if (!mWindow.isFloating() && isApplication && StackId.hasWindowDecor(mStackId)) {
    if (decorCaptionView == null) {
      decorCaptionView=inflateDecorCaptionView(inflater);
    }
    decorCaptionView.setPhoneWindow(mWindow,true);
  }
 else {
    decorCaptionView=null;
  }
  enableCaption(decorCaptionView != null);
  return decorCaptionView;
}
Program: 193152
Project: 193152
Buggy source:
void onConfigurationChanged(){
  int workspaceId=getStackId();
  if (mDecorCaptionView != null) {
    if (mStackId != workspaceId) {
      mStackId=workspaceId;
      mDecorCaptionView.onConfigurationChanged(ActivityManager.StackId.hasWindowDecor(mStackId));
      enableCaption(ActivityManager.StackId.hasWindowDecor(workspaceId));
    }
  }
  initializeElevation();
}

Fixed version (ground truth):
void onConfigurationChanged(){
  int workspaceId=getStackId();
  if (mStackId != workspaceId) {
    mStackId=workspaceId;
    if (mDecorCaptionView == null && StackId.hasWindowDecor(mStackId)) {
      final LayoutInflater inflater=mWindow.getLayoutInflater();
      mDecorCaptionView=createDecorCaptionView(inflater);
      if (mDecorCaptionView != null) {
        if (mDecorCaptionView.getParent() == null) {
          addView(mDecorCaptionView,0,new ViewGroup.LayoutParams(MATCH_PARENT,MATCH_PARENT));
        }
        removeView(mContentRoot);
        mDecorCaptionView.addView(mContentRoot,new ViewGroup.MarginLayoutParams(MATCH_PARENT,MATCH_PARENT));
      }
    }
 else     if (mDecorCaptionView != null) {
      mDecorCaptionView.onConfigurationChanged(StackId.hasWindowDecor(mStackId));
      enableCaption(StackId.hasWindowDecor(workspaceId));
    }
  }
  initializeElevation();
}
Program: 193158
Project: 193158
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  int childCount=mChildren.size();
  for (int i=0; i < childCount; i++) {
    View child=mChildren.get(i);
    if (child.getVisibility() == View.GONE) {
      continue;
    }
    child.layout(0,0,getWidth(),child.getMeasuredHeight());
    mDividers.get(i).layout(0,0,getWidth(),mDividerHeight);
  }
  if (mGroupOverflowContainer != null) {
    mGroupOverflowContainer.layout(0,0,getWidth(),mGroupOverflowContainer.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);
    if (child.getVisibility() == View.GONE) {
      continue;
    }
    child.layout(0,0,getWidth(),child.getMeasuredHeight());
    mDividers.get(i).layout(0,0,getWidth(),mDividerHeight);
  }
  if (mGroupOverflowContainer != null) {
    mGroupOverflowContainer.layout(0,0,getWidth(),mGroupOverflowContainer.getMeasuredHeight());
  }
}
Program: 193159
Project: 193159
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int ownMaxHeight=mMaxNotificationHeight;
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  boolean hasFixedHeight=heightMode == MeasureSpec.EXACTLY;
  boolean isHeightLimited=heightMode == MeasureSpec.AT_MOST;
  if (hasFixedHeight || isHeightLimited) {
    int size=MeasureSpec.getSize(heightMeasureSpec);
    ownMaxHeight=Math.min(ownMaxHeight,size);
  }
  int newHeightSpec=MeasureSpec.makeMeasureSpec(ownMaxHeight,MeasureSpec.AT_MOST);
  int dividerHeightSpec=MeasureSpec.makeMeasureSpec(mDividerHeight,MeasureSpec.EXACTLY);
  int height=mNotificationHeaderHeight + mNotificatonTopPadding;
  int childCount=mChildren.size();
  for (int i=0; i < childCount; i++) {
    View child=mChildren.get(i);
    child.measure(widthMeasureSpec,newHeightSpec);
    height+=child.getMeasuredHeight();
    View divider=mDividers.get(i);
    divider.measure(widthMeasureSpec,dividerHeightSpec);
    height+=mDividerHeight;
  }
  int width=MeasureSpec.getSize(widthMeasureSpec);
  if (mGroupOverflowContainer != null) {
    mGroupOverflowContainer.measure(widthMeasureSpec,newHeightSpec);
  }
  setMeasuredDimension(width,height);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int ownMaxHeight=mMaxNotificationHeight;
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  boolean hasFixedHeight=heightMode == MeasureSpec.EXACTLY;
  boolean isHeightLimited=heightMode == MeasureSpec.AT_MOST;
  if (hasFixedHeight || isHeightLimited) {
    int size=MeasureSpec.getSize(heightMeasureSpec);
    ownMaxHeight=Math.min(ownMaxHeight,size);
  }
  int newHeightSpec=MeasureSpec.makeMeasureSpec(ownMaxHeight,MeasureSpec.AT_MOST);
  int dividerHeightSpec=MeasureSpec.makeMeasureSpec(mDividerHeight,MeasureSpec.EXACTLY);
  int height=mNotificationHeaderHeight + mNotificatonTopPadding;
  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.measure(widthMeasureSpec,newHeightSpec);
    height+=child.getMeasuredHeight();
    View divider=mDividers.get(i);
    divider.measure(widthMeasureSpec,dividerHeightSpec);
    height+=mDividerHeight;
  }
  int width=MeasureSpec.getSize(widthMeasureSpec);
  if (mGroupOverflowContainer != null) {
    mGroupOverflowContainer.measure(widthMeasureSpec,newHeightSpec);
  }
  setMeasuredDimension(width,height);
}
Program: 193160
Project: 193160
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  requestPanelHeightUpdate();
  mHasLayoutedSinceDown=true;
  if (mUpdateFlingOnLayout) {
    abortAnimations();
    fling(mUpdateFlingVelocity,true);
    mUpdateFlingOnLayout=false;
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (mLayoutHeight != getHeight()) {
    mLayoutHeight=getHeight();
    mStatusBar.onPanelHeightChanged();
  }
  requestPanelHeightUpdate();
  mHasLayoutedSinceDown=true;
  if (mUpdateFlingOnLayout) {
    abortAnimations();
    fling(mUpdateFlingVelocity,true);
    mUpdateFlingOnLayout=false;
  }
}
Program: 193161
Project: 193161
Buggy source:
public void expand(final boolean animate){
  if (!isFullyCollapsed() && !isCollapsing()) {
    return;
  }
  mInstantExpanding=true;
  mUpdateFlingOnLayout=false;
  abortAnimations();
  cancelPeek();
  if (mTracking) {
    onTrackingStopped(true);
  }
  if (mExpanding) {
    notifyExpandingFinished();
  }
  notifyBarPanelExpansionChanged();
  getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      if (mStatusBar.getStatusBarWindow().getHeight() != mStatusBar.getStatusBarHeight()) {
        getViewTreeObserver().removeOnGlobalLayoutListener(this);
        mStatusBar.onPanelExpandedAndLayouted();
        if (animate) {
          mBar.startOpeningPanel(PanelView.this);
          notifyExpandingStarted();
          fling(0,true);
        }
 else {
          setExpandedFraction(1f);
        }
        mInstantExpanding=false;
      }
    }
  }
);
  requestLayout();
}

Fixed version (ground truth):
public void expand(final boolean animate){
  if (!isFullyCollapsed() && !isCollapsing()) {
    return;
  }
  mInstantExpanding=true;
  mUpdateFlingOnLayout=false;
  abortAnimations();
  cancelPeek();
  if (mTracking) {
    onTrackingStopped(true);
  }
  if (mExpanding) {
    notifyExpandingFinished();
  }
  notifyBarPanelExpansionChanged();
  getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      if (mStatusBar.getStatusBarWindow().getHeight() != mStatusBar.getStatusBarHeight()) {
        getViewTreeObserver().removeOnGlobalLayoutListener(this);
        if (animate) {
          mBar.startOpeningPanel(PanelView.this);
          notifyExpandingStarted();
          fling(0,true);
        }
 else {
          setExpandedFraction(1f);
        }
        mInstantExpanding=false;
      }
    }
  }
);
  requestLayout();
}
Program: 193162
Project: 193162
Buggy source:
@Override public void onGlobalLayout(){
  if (mStatusBar.getStatusBarWindow().getHeight() != mStatusBar.getStatusBarHeight()) {
    getViewTreeObserver().removeOnGlobalLayoutListener(this);
    mStatusBar.onPanelExpandedAndLayouted();
    if (animate) {
      mBar.startOpeningPanel(PanelView.this);
      notifyExpandingStarted();
      fling(0,true);
    }
 else {
      setExpandedFraction(1f);
    }
    mInstantExpanding=false;
  }
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  if (mStatusBar.getStatusBarWindow().getHeight() != mStatusBar.getStatusBarHeight()) {
    getViewTreeObserver().removeOnGlobalLayoutListener(this);
    if (animate) {
      mBar.startOpeningPanel(PanelView.this);
      notifyExpandingStarted();
      fling(0,true);
    }
 else {
      setExpandedFraction(1f);
    }
    mInstantExpanding=false;
  }
}