nus-yam/ex-repair huggingface dataset:
Program: 198974
Project: 198974
Buggy source:
/** 
 * {@inheritDoc}
 */
public boolean onPreDraw(){
  if (mLayout == null) {
    assumeLayout();
  }
  if (mMovement != null) {
    int curs=getSelectionEnd();
    if (mEditor != null && mEditor.mSelectionModifierCursorController != null && mEditor.mSelectionModifierCursorController.isSelectionStartDragged()) {
      curs=getSelectionStart();
    }
    if (curs < 0 && (mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
      curs=mText.length();
    }
    if (curs >= 0) {
      bringPointIntoView(curs);
    }
  }
 else {
    bringTextIntoView();
  }
  if (mEditor != null && mEditor.mCreatedWithASelection) {
    mEditor.startSelectionActionMode();
    mEditor.mCreatedWithASelection=false;
  }
  if (this instanceof ExtractEditText && hasSelection() && mEditor != null) {
    mEditor.startSelectionActionMode();
  }
  getViewTreeObserver().removeOnPreDrawListener(this);
  mPreDrawRegistered=false;
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public boolean onPreDraw(){
  if (mLayout == null) {
    assumeLayout();
  }
  if (mMovement != null) {
    int curs=getSelectionEnd();
    if (mEditor != null && mEditor.mSelectionModifierCursorController != null && mEditor.mSelectionModifierCursorController.isSelectionStartDragged()) {
      curs=getSelectionStart();
    }
    if (curs < 0 && (mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
      curs=mText.length();
    }
    if (curs >= 0) {
      bringPointIntoView(curs);
    }
  }
 else {
    bringTextIntoView();
  }
  if (mEditor != null && mEditor.mCreatedWithASelection) {
    mEditor.startSelectionActionMode();
    mEditor.mCreatedWithASelection=false;
  }
  if (this instanceof ExtractEditText && hasSelection() && mEditor != null) {
    mEditor.startSelectionActionMode();
  }
  unregisterForPreDraw();
  return true;
}
Program: 198975
Project: 198975
Buggy source:
/** 
 * @hide 
 */
@Override protected void onDetachedFromWindowInternal(){
  if (mPreDrawRegistered) {
    getViewTreeObserver().removeOnPreDrawListener(this);
    mPreDrawRegistered=false;
  }
  resetResolvedDrawables();
  if (mEditor != null)   mEditor.onDetachedFromWindow();
  super.onDetachedFromWindowInternal();
}

Fixed version (ground truth):
/** 
 * @hide 
 */
@Override protected void onDetachedFromWindowInternal(){
  if (mPreDrawRegistered) {
    getViewTreeObserver().removeOnPreDrawListener(this);
    mPreDrawListenerDetached=true;
  }
  resetResolvedDrawables();
  if (mEditor != null)   mEditor.onDetachedFromWindow();
  super.onDetachedFromWindowInternal();
}
Program: 198976
Project: 198976
Buggy source:
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
}

Fixed version (ground truth):
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
  resetDisplayList();
}
Program: 198977
Project: 198977
Buggy source:
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      sendKeyDown(keycode);
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyDown(keycode);
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      sendKeyDown(keycode);
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyUp();
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}
Program: 198978
Project: 198978
Buggy source:
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyDown(keycode);
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      sendKeyDown(keycode);
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      sendKeyDown(keycode);
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyDown(keycode);
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}
Program: 198979
Project: 198979
Buggy source:
private ResolveInfo checkTargetCanHandle(CrossProfileIntentFilter filter,Intent intent,String resolvedType,int flags,int sourceUserId){
  List<ResolveInfo> resultTargetUser=mActivities.queryIntent(intent,resolvedType,flags,filter.getTargetUserId());
  if (resultTargetUser != null) {
    return createForwardingResolveInfo(filter,sourceUserId,filter.getTargetUserId());
  }
  return null;
}

Fixed version (ground truth):
private ResolveInfo checkTargetCanHandle(CrossProfileIntentFilter filter,Intent intent,String resolvedType,int flags,int sourceUserId){
  List<ResolveInfo> resultTargetUser=mActivities.queryIntent(intent,resolvedType,flags,filter.getTargetUserId());
  if (resultTargetUser != null && !resultTargetUser.isEmpty()) {
    return createForwardingResolveInfo(filter,sourceUserId,filter.getTargetUserId());
  }
  return null;
}
Program: 198980
Project: 198980
Buggy source:
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      sendKeyDown(keycode);
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyDown(keycode);
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      sendKeyDown(keycode);
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyUp();
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}
Program: 198981
Project: 198981
Buggy source:
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyUp();
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      sendKeyDown(keycode);
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyDown(keycode);
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      sendKeyDown(keycode);
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}
Program: 198982
Project: 198982
Buggy source:
private ResolveInfo checkTargetCanHandle(CrossProfileIntentFilter filter,Intent intent,String resolvedType,int flags,int sourceUserId){
  List<ResolveInfo> resultTargetUser=mActivities.queryIntent(intent,resolvedType,flags,filter.getTargetUserId());
  if (resultTargetUser != null) {
    return createForwardingResolveInfo(filter,sourceUserId,filter.getTargetUserId());
  }
  return null;
}

Fixed version (ground truth):
private ResolveInfo checkTargetCanHandle(CrossProfileIntentFilter filter,Intent intent,String resolvedType,int flags,int sourceUserId){
  List<ResolveInfo> resultTargetUser=mActivities.queryIntent(intent,resolvedType,flags,filter.getTargetUserId());
  if (resultTargetUser != null && !resultTargetUser.isEmpty()) {
    return createForwardingResolveInfo(filter,sourceUserId,filter.getTargetUserId());
  }
  return null;
}
Program: 198983
Project: 198983
Buggy source:
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyUp();
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      sendKeyDown(keycode);
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when a key event should be handled for the action.
 * @param keycode key code of {@link KeyEvent} object
 * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
 */
void processKeyEvent(int keycode,boolean isPressed){
  if (mState != STATE_PROCESSING_KEYCODE) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (isPressed) {
    if (keycode != mLastKeycode) {
      if (!HdmiCecKeycode.isRepeatableKey(keycode)) {
        sendKeyDown(keycode);
        finish();
        return;
      }
      mActionTimer.clearTimerMessage();
      sendKeyDown(keycode);
      addTimer(mState,IRT_MS);
      mLastKeycode=keycode;
    }
  }
 else {
    if (keycode == mLastKeycode) {
      sendKeyUp();
      finish();
    }
  }
}
Program: 198984
Project: 198984
Buggy source:
private void setIsExpanded(boolean isExpanded){
  mIsExpanded=isExpanded;
  mStackScrollAlgorithm.setIsExpanded(isExpanded);
  if (!isExpanded) {
    mOwnScrollY=0;
  }
}

Fixed version (ground truth):
private void setIsExpanded(boolean isExpanded){
  mIsExpanded=isExpanded;
  mStackScrollAlgorithm.setIsExpanded(isExpanded);
}
Program: 198985
Project: 198985
Buggy source:
public void onExpansionStopped(){
  mIsExpansionChanging=false;
  mStackScrollAlgorithm.onExpansionStopped();
}

Fixed version (ground truth):
public void onExpansionStopped(){
  mIsExpansionChanging=false;
  mStackScrollAlgorithm.onExpansionStopped();
  if (!mIsExpanded) {
    mOwnScrollY=0;
  }
}
Program: 198987
Project: 198987
Buggy source:
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(View removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int childHeight=removedChild.getHeight() + mPaddingBetweenElements;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    mOwnScrollY-=childHeight;
  }
 else   if (startingPosition < mOwnScrollY) {
    mOwnScrollY=startingPosition;
  }
}

Fixed version (ground truth):
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(View removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int childHeight=getIntrinsicHeight(removedChild) + mPaddingBetweenElements;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    mOwnScrollY-=childHeight;
  }
 else   if (startingPosition < mOwnScrollY) {
    mOwnScrollY=startingPosition;
  }
}
Program: 198988
Project: 198988
Buggy source:
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(View removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int childHeight=removedChild.getHeight() + mPaddingBetweenElements;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    mOwnScrollY-=childHeight;
  }
 else   if (startingPosition < mOwnScrollY) {
    mOwnScrollY=startingPosition;
  }
}

Fixed version (ground truth):
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(View removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int childHeight=getIntrinsicHeight(removedChild) + mPaddingBetweenElements;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    mOwnScrollY-=childHeight;
  }
 else   if (startingPosition < mOwnScrollY) {
    mOwnScrollY=startingPosition;
  }
}
Program: 198989
Project: 198989
Buggy source:
@Override protected void onStop(){
  if (Console.Enabled) {
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str","String_Node_Str",Console.AnsiRed);
  }
  super.onStop();
  unregisterReceiver(mServiceBroadcastReceiver);
  if (mConfig.searchBarAppWidgetId >= 0) {
    mAppWidgetHost.stopListening();
  }
  mVisible=false;
  mTaskLaunched=false;
}

Fixed version (ground truth):
@Override protected void onStop(){
  if (Console.Enabled) {
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str","String_Node_Str",Console.AnsiRed);
  }
  super.onStop();
  unregisterReceiver(mServiceBroadcastReceiver);
  if (mConfig.searchBarAppWidgetId >= 0) {
    mAppWidgetHost.stopListening();
  }
  mVisible=false;
}
Program: 198991
Project: 198991
Buggy source:
/** 
 * Updates the set of recent tasks 
 */
void updateRecentsTasks(Intent launchIntent){
  RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
  SpaceNode root=loader.reload(this,Constants.Values.RecentsTaskLoader.PreloadFirstTasksCount);
  ArrayList<TaskStack> stacks=root.getStacks();
  if (!stacks.isEmpty()) {
    mRecentsView.setBSP(root);
  }
  mConfig.launchedFromHome=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_HOME,false);
  mConfig.launchedFromAppWithThumbnail=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_THUMBNAIL,false);
  mConfig.launchedFromAppWithScreenshot=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_FULL_SCREENSHOT,false);
  mConfig.launchedWithAltTab=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB,false);
  mConfig.launchedWithNoRecentTasks=!root.hasTasks();
  mScrimViews.prepareEnterRecentsAnimation();
  if (mEmptyView == null) {
    mEmptyView=mEmptyViewStub.inflate();
  }
  if (mConfig.launchedWithNoRecentTasks) {
    mEmptyView.setVisibility(View.VISIBLE);
  }
 else {
    mEmptyView.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
/** 
 * Updates the set of recent tasks 
 */
void updateRecentsTasks(Intent launchIntent){
  RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
  SpaceNode root=loader.reload(this,Constants.Values.RecentsTaskLoader.PreloadFirstTasksCount);
  ArrayList<TaskStack> stacks=root.getStacks();
  if (!stacks.isEmpty()) {
    mRecentsView.setBSP(root);
  }
  mConfig.launchedFromHome=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_HOME,false);
  mConfig.launchedFromAppWithThumbnail=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_THUMBNAIL,false);
  mConfig.launchedFromAppWithScreenshot=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_FULL_SCREENSHOT,false);
  mConfig.launchedWithAltTab=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB,false);
  mConfig.launchedWithNoRecentTasks=!root.hasTasks();
  if (mEmptyView == null) {
    mEmptyView=mEmptyViewStub.inflate();
  }
  if (mConfig.launchedWithNoRecentTasks) {
    mEmptyView.setVisibility(View.VISIBLE);
  }
 else {
    mEmptyView.setVisibility(View.GONE);
  }
  mScrimViews.prepareEnterRecentsAnimation();
}
Program: 198992
Project: 198992
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  if (Console.Enabled) {
    Console.logDivider(Constants.Log.App.SystemUIHandshake);
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
    Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,Constants.Log.App.TimeRecentsStartupKey,"String_Node_Str");
  }
  RecentsTaskLoader.initialize(this);
  mConfig=RecentsConfiguration.reinitialize(this);
  updateRecentsTasks(intent);
  if (Constants.DebugFlags.App.EnableScreenshotAppTransition) {
    mFullScreenOverlayView.prepareAnimateOnEnterRecents(AlternateRecentsComponent.getLastScreenshot());
  }
  addSearchBarAppWidgetView();
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Console.Enabled) {
    Console.logDivider(Constants.Log.App.SystemUIHandshake);
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
    Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,Constants.Log.App.TimeRecentsStartupKey,"String_Node_Str");
  }
  RecentsTaskLoader.initialize(this);
  mConfig=RecentsConfiguration.reinitialize(this);
  updateRecentsTasks(intent);
  if (Constants.DebugFlags.App.EnableScreenshotAppTransition) {
    mFullScreenOverlayView.prepareAnimateOnEnterRecents(AlternateRecentsComponent.getLastScreenshot());
  }
}
Program: 198997
Project: 198997
Buggy source:
public TaskStack(Context context){
  mContext=context;
}

Fixed version (ground truth):
public TaskStack(){
}
Program: 198999
Project: 198999
Buggy source:
@Override protected void onStop(){
  if (Console.Enabled) {
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str","String_Node_Str",Console.AnsiRed);
  }
  super.onStop();
  unregisterReceiver(mServiceBroadcastReceiver);
  if (mConfig.searchBarAppWidgetId >= 0) {
    mAppWidgetHost.stopListening();
  }
  mVisible=false;
  mTaskLaunched=false;
}

Fixed version (ground truth):
@Override protected void onStop(){
  if (Console.Enabled) {
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str","String_Node_Str",Console.AnsiRed);
  }
  super.onStop();
  unregisterReceiver(mServiceBroadcastReceiver);
  if (mConfig.searchBarAppWidgetId >= 0) {
    mAppWidgetHost.stopListening();
  }
  mVisible=false;
}
Program: 199001
Project: 199001
Buggy source:
/** 
 * Updates the set of recent tasks 
 */
void updateRecentsTasks(Intent launchIntent){
  RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
  SpaceNode root=loader.reload(this,Constants.Values.RecentsTaskLoader.PreloadFirstTasksCount);
  ArrayList<TaskStack> stacks=root.getStacks();
  if (!stacks.isEmpty()) {
    mRecentsView.setBSP(root);
  }
  mConfig.launchedFromHome=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_HOME,false);
  mConfig.launchedFromAppWithThumbnail=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_THUMBNAIL,false);
  mConfig.launchedFromAppWithScreenshot=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_FULL_SCREENSHOT,false);
  mConfig.launchedWithAltTab=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB,false);
  mConfig.launchedWithNoRecentTasks=!root.hasTasks();
  mScrimViews.prepareEnterRecentsAnimation();
  if (mEmptyView == null) {
    mEmptyView=mEmptyViewStub.inflate();
  }
  if (mConfig.launchedWithNoRecentTasks) {
    mEmptyView.setVisibility(View.VISIBLE);
  }
 else {
    mEmptyView.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
/** 
 * Updates the set of recent tasks 
 */
void updateRecentsTasks(Intent launchIntent){
  RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
  SpaceNode root=loader.reload(this,Constants.Values.RecentsTaskLoader.PreloadFirstTasksCount);
  ArrayList<TaskStack> stacks=root.getStacks();
  if (!stacks.isEmpty()) {
    mRecentsView.setBSP(root);
  }
  mConfig.launchedFromHome=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_HOME,false);
  mConfig.launchedFromAppWithThumbnail=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_THUMBNAIL,false);
  mConfig.launchedFromAppWithScreenshot=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_FROM_APP_FULL_SCREENSHOT,false);
  mConfig.launchedWithAltTab=launchIntent.getBooleanExtra(AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB,false);
  mConfig.launchedWithNoRecentTasks=!root.hasTasks();
  if (mEmptyView == null) {
    mEmptyView=mEmptyViewStub.inflate();
  }
  if (mConfig.launchedWithNoRecentTasks) {
    mEmptyView.setVisibility(View.VISIBLE);
  }
 else {
    mEmptyView.setVisibility(View.GONE);
  }
  mScrimViews.prepareEnterRecentsAnimation();
}
Program: 199002
Project: 199002
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  mTaskLaunched=false;
  if (Console.Enabled) {
    Console.logDivider(Constants.Log.App.SystemUIHandshake);
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
    Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,Constants.Log.App.TimeRecentsStartupKey,"String_Node_Str");
  }
  RecentsTaskLoader.initialize(this);
  mConfig=RecentsConfiguration.reinitialize(this);
  updateRecentsTasks(intent);
  if (Constants.DebugFlags.App.EnableScreenshotAppTransition) {
    mFullScreenOverlayView.prepareAnimateOnEnterRecents(AlternateRecentsComponent.getLastScreenshot());
  }
  addSearchBarAppWidgetView();
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Console.Enabled) {
    Console.logDivider(Constants.Log.App.SystemUIHandshake);
    Console.log(Constants.Log.App.SystemUIHandshake,"String_Node_Str",intent.getAction() + "String_Node_Str" + mVisible,Console.AnsiRed);
    Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,Constants.Log.App.TimeRecentsStartupKey,"String_Node_Str");
  }
  RecentsTaskLoader.initialize(this);
  mConfig=RecentsConfiguration.reinitialize(this);
  updateRecentsTasks(intent);
  if (Constants.DebugFlags.App.EnableScreenshotAppTransition) {
    mFullScreenOverlayView.prepareAnimateOnEnterRecents(AlternateRecentsComponent.getLastScreenshot());
  }
}
Program: 199007
Project: 199007
Buggy source:
public TaskStack(Context context){
  mContext=context;
}

Fixed version (ground truth):
public TaskStack(){
}
Program: 199009
Project: 199009
Buggy source:
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_TAB) {
    final boolean backward=event.isShiftPressed();
    mRecentsView.focusNextTask(!backward);
    return true;
  }
  mDebugTrigger.onKeyEvent(keyCode);
  return super.onKeyDown(keyCode,event);
}

Fixed version (ground truth):
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_TAB) {
    final boolean backward=event.isShiftPressed();
    mRecentsView.focusNextTask(!backward);
    return true;
  }
 else   if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
    mRecentsView.focusNextTask(true);
    return true;
  }
 else   if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
    mRecentsView.focusNextTask(false);
    return true;
  }
  mDebugTrigger.onKeyEvent(keyCode);
  return super.onKeyDown(keyCode,event);
}
Program: 199010
Project: 199010
Buggy source:
void onConfigurationChange(){
  mRecentsView.startEnterRecentsAnimation(new ViewAnimation.TaskViewEnterContext(mFullScreenOverlayView));
  onEnterAnimationTriggered();
}

Fixed version (ground truth):
void onConfigurationChange(){
  ReferenceCountedTrigger t=new ReferenceCountedTrigger(this,null,null,null);
  mRecentsView.startEnterRecentsAnimation(new ViewAnimation.TaskViewEnterContext(mFullScreenOverlayView,t));
  onEnterAnimationTriggered();
}
Program: 199011
Project: 199011
Buggy source:
/** 
 * Requests all task stacks to start their enter-recents animation 
 */
public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx){
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    View child=getChildAt(i);
    if (child instanceof TaskStackView) {
      TaskStackView stackView=(TaskStackView)child;
      stackView.startEnterRecentsAnimation(ctx);
    }
  }
}

Fixed version (ground truth):
/** 
 * Requests all task stacks to start their enter-recents animation 
 */
public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx){
  ctx.postAnimationTrigger.increment();
  int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    View child=getChildAt(i);
    if (child instanceof TaskStackView) {
      TaskStackView stackView=(TaskStackView)child;
      stackView.startEnterRecentsAnimation(ctx);
    }
  }
  ctx.postAnimationTrigger.decrement();
}
Program: 199013
Project: 199013
Buggy source:
/** 
 * Requests this task stacks to start it's enter-recents animation 
 */
public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx){
  if (mAwaitingFirstLayout) {
    mStartEnterAnimationRequestedAfterLayout=true;
    mStartEnterAnimationContext=ctx;
    return;
  }
  TaskViewTransform transform=mStackAlgorithm.getStackTransform(mStack.getTaskCount() - 1,getInitialStackScroll());
  ctx.taskRect=transform.rect;
  ctx.stackRectSansPeek=mStackAlgorithm.mStackRectSansPeek;
  int childCount=getChildCount();
  for (int i=childCount - 1; i >= 0; i--) {
    TaskView tv=(TaskView)getChildAt(i);
    ctx.stackViewIndex=i;
    ctx.stackViewCount=childCount;
    ctx.isFrontMost=(i == (getChildCount() - 1));
    ctx.transform=mStackAlgorithm.getStackTransform(mStack.indexOfTask(tv.getTask()),getStackScroll());
    tv.startEnterRecentsAnimation(ctx);
  }
}

Fixed version (ground truth):
/** 
 * Requests this task stacks to start it's enter-recents animation 
 */
public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx){
  if (mAwaitingFirstLayout) {
    mStartEnterAnimationRequestedAfterLayout=true;
    mStartEnterAnimationContext=ctx;
    return;
  }
  TaskViewTransform transform=mStackAlgorithm.getStackTransform(mStack.getTaskCount() - 1,getInitialStackScroll());
  ctx.taskRect=transform.rect;
  ctx.stackRectSansPeek=mStackAlgorithm.mStackRectSansPeek;
  int childCount=getChildCount();
  for (int i=childCount - 1; i >= 0; i--) {
    TaskView tv=(TaskView)getChildAt(i);
    ctx.stackViewIndex=i;
    ctx.stackViewCount=childCount;
    ctx.isFrontMost=(i == (getChildCount() - 1));
    ctx.transform=mStackAlgorithm.getStackTransform(mStack.indexOfTask(tv.getTask()),getStackScroll());
    tv.startEnterRecentsAnimation(ctx);
  }
  ctx.postAnimationTrigger.addLastDecrementRunnable(new Runnable(){
    @Override public void run(){
      mUIDozeTrigger.startDozing();
    }
  }
);
}
Program: 199014
Project: 199014
Buggy source:
/** 
 * Sets the focused task explicitly. We need a separate flag because requestFocus() won't happen if the view is not currently visible, or we are in touch state (where we still want to keep track of focus).
 */
public void setFocusedTask(){
  mIsFocused=true;
  requestFocus();
  invalidate();
  mCb.onTaskFocused(this);
}

Fixed version (ground truth):
/** 
 * Sets the focused task explicitly. We need a separate flag because requestFocus() won't happen if the view is not currently visible, or we are in touch state (where we still want to keep track of focus).
 */
public void setFocusedTask(){
  mIsFocused=true;
  setFocusableInTouchMode(true);
  requestFocus();
  setFocusableInTouchMode(false);
  invalidate();
  mCb.onTaskFocused(this);
}
Program: 199016
Project: 199016
Buggy source:
public TaskViewEnterContext(FullscreenTransitionOverlayView fss){
  fullScreenshot=fss;
}

Fixed version (ground truth):
public TaskViewEnterContext(FullscreenTransitionOverlayView fss,ReferenceCountedTrigger t){
  fullScreenshot=fss;
  postAnimationTrigger=t;
}
Program: 199018
Project: 199018
Buggy source:
@Override public void setMode(int code,int uid,String packageName,int mode){
  verifyIncomingUid(uid);
  verifyIncomingOp(code);
  ArrayList<Callback> repCbs=null;
  code=AppOpsManager.opToSwitch(code);
synchronized (this) {
    Op op=getOpLocked(code,uid,packageName,true);
    if (op != null) {
      if (op.mode != mode) {
        op.mode=mode;
        ArrayList<Callback> cbs=mOpModeWatchers.get(code);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        cbs=mPackageModeWatchers.get(packageName);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        if (mode == AppOpsManager.opToDefaultMode(op.op)) {
          pruneOp(op,uid,packageName);
        }
        scheduleWriteNowLocked();
      }
    }
  }
  if (repCbs != null) {
    for (int i=0; i < repCbs.size(); i++) {
      try {
        repCbs.get(i).mCallback.opChanged(code,packageName);
      }
 catch (      RemoteException e) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public void setMode(int code,int uid,String packageName,int mode){
  if (Binder.getCallingPid() == Process.myPid()) {
    return;
  }
  mContext.enforcePermission(android.Manifest.permission.UPDATE_APP_OPS_STATS,Binder.getCallingPid(),Binder.getCallingUid(),null);
  verifyIncomingOp(code);
  ArrayList<Callback> repCbs=null;
  code=AppOpsManager.opToSwitch(code);
synchronized (this) {
    Op op=getOpLocked(code,uid,packageName,true);
    if (op != null) {
      if (op.mode != mode) {
        op.mode=mode;
        ArrayList<Callback> cbs=mOpModeWatchers.get(code);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        cbs=mPackageModeWatchers.get(packageName);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        if (mode == AppOpsManager.opToDefaultMode(op.op)) {
          pruneOp(op,uid,packageName);
        }
        scheduleWriteNowLocked();
      }
    }
  }
  if (repCbs != null) {
    for (int i=0; i < repCbs.size(); i++) {
      try {
        repCbs.get(i).mCallback.opChanged(code,packageName);
      }
 catch (      RemoteException e) {
      }
    }
  }
}
Program: 199019
Project: 199019
Buggy source:
@Override public void setMode(int code,int uid,String packageName,int mode){
  verifyIncomingUid(uid);
  verifyIncomingOp(code);
  ArrayList<Callback> repCbs=null;
  code=AppOpsManager.opToSwitch(code);
synchronized (this) {
    Op op=getOpLocked(code,uid,packageName,true);
    if (op != null) {
      if (op.mode != mode) {
        op.mode=mode;
        ArrayList<Callback> cbs=mOpModeWatchers.get(code);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        cbs=mPackageModeWatchers.get(packageName);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        if (mode == AppOpsManager.opToDefaultMode(op.op)) {
          pruneOp(op,uid,packageName);
        }
        scheduleWriteNowLocked();
      }
    }
  }
  if (repCbs != null) {
    for (int i=0; i < repCbs.size(); i++) {
      try {
        repCbs.get(i).mCallback.opChanged(code,packageName);
      }
 catch (      RemoteException e) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public void setMode(int code,int uid,String packageName,int mode){
  if (Binder.getCallingPid() == Process.myPid()) {
    return;
  }
  mContext.enforcePermission(android.Manifest.permission.UPDATE_APP_OPS_STATS,Binder.getCallingPid(),Binder.getCallingUid(),null);
  verifyIncomingOp(code);
  ArrayList<Callback> repCbs=null;
  code=AppOpsManager.opToSwitch(code);
synchronized (this) {
    Op op=getOpLocked(code,uid,packageName,true);
    if (op != null) {
      if (op.mode != mode) {
        op.mode=mode;
        ArrayList<Callback> cbs=mOpModeWatchers.get(code);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        cbs=mPackageModeWatchers.get(packageName);
        if (cbs != null) {
          if (repCbs == null) {
            repCbs=new ArrayList<Callback>();
          }
          repCbs.addAll(cbs);
        }
        if (mode == AppOpsManager.opToDefaultMode(op.op)) {
          pruneOp(op,uid,packageName);
        }
        scheduleWriteNowLocked();
      }
    }
  }
  if (repCbs != null) {
    for (int i=0; i < repCbs.size(); i++) {
      try {
        repCbs.get(i).mCallback.opChanged(code,packageName);
      }
 catch (      RemoteException e) {
      }
    }
  }
}
Program: 199020
Project: 199020
Buggy source:
@Override protected float getPeekHeight(){
  if (mNotificationStackScroller.getNotGoneChildCount() > 0) {
    return mNotificationStackScroller.getPeekHeight();
  }
 else {
    return mQsMinExpansionHeight;
  }
}

Fixed version (ground truth):
@Override protected float getPeekHeight(){
  if (mNotificationStackScroller.getNotGoneChildCount() > 0) {
    return mNotificationStackScroller.getPeekHeight();
  }
 else {
    return mQsMinExpansionHeight * HEADER_RUBBERBAND_FACTOR;
  }
}
Program: 199021
Project: 199021
Buggy source:
public void panelExpansionChanged(PanelView panel,float frac){
  boolean fullyClosed=true;
  PanelView fullyOpenedPanel=null;
  if (DEBUG)   LOG("String_Node_Str",mState,panel.getName());
  mPanelExpandedFractionSum=0f;
  for (  PanelView pv : mPanels) {
    boolean visible=pv.getExpandedHeight() > 0;
    pv.setVisibility(visible ? View.VISIBLE : View.GONE);
    if (pv.getExpandedHeight() > 0f) {
      if (mState == STATE_CLOSED) {
        go(STATE_OPENING);
        onPanelPeeked();
      }
      fullyClosed=false;
      final float thisFrac=pv.getExpandedFraction();
      mPanelExpandedFractionSum+=(visible ? thisFrac : 0);
      if (DEBUG)       LOG("String_Node_Str",pv.getName(),thisFrac);
      if (panel == pv) {
        if (thisFrac == 1f)         fullyOpenedPanel=panel;
      }
    }
  }
  mPanelExpandedFractionSum/=mPanels.size();
  if (fullyOpenedPanel != null && !mTracking) {
    go(STATE_OPEN);
    onPanelFullyOpened(fullyOpenedPanel);
  }
 else   if (fullyClosed && !mTracking && mState != STATE_CLOSED) {
    go(STATE_CLOSED);
    onAllPanelsCollapsed();
  }
  if (DEBUG)   LOG("String_Node_Str",mState,(fullyOpenedPanel != null) ? "String_Node_Str" : "String_Node_Str",fullyClosed ? "String_Node_Str" : "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param panel the panel which changed its expansion state
 * @param frac the fraction from the expansion in [0, 1]
 * @param expanded whether the panel is currently expanded; this is independent from thefraction as the panel also might be expanded if the fraction is 0
 */
public void panelExpansionChanged(PanelView panel,float frac,boolean expanded){
  boolean fullyClosed=true;
  PanelView fullyOpenedPanel=null;
  if (DEBUG)   LOG("String_Node_Str",mState,panel.getName());
  mPanelExpandedFractionSum=0f;
  for (  PanelView pv : mPanels) {
    boolean visible=pv.getExpandedHeight() > 0;
    pv.setVisibility(visible ? View.VISIBLE : View.GONE);
    if (expanded) {
      if (mState == STATE_CLOSED) {
        go(STATE_OPENING);
        onPanelPeeked();
      }
      fullyClosed=false;
      final float thisFrac=pv.getExpandedFraction();
      mPanelExpandedFractionSum+=(visible ? thisFrac : 0);
      if (DEBUG)       LOG("String_Node_Str",pv.getName(),thisFrac);
      if (panel == pv) {
        if (thisFrac == 1f)         fullyOpenedPanel=panel;
      }
    }
  }
  mPanelExpandedFractionSum/=mPanels.size();
  if (fullyOpenedPanel != null && !mTracking) {
    go(STATE_OPEN);
    onPanelFullyOpened(fullyOpenedPanel);
  }
 else   if (fullyClosed && !mTracking && mState != STATE_CLOSED) {
    go(STATE_CLOSED);
    onAllPanelsCollapsed();
  }
  if (DEBUG)   LOG("String_Node_Str",mState,(fullyOpenedPanel != null) ? "String_Node_Str" : "String_Node_Str",fullyClosed ? "String_Node_Str" : "String_Node_Str");
}
Program: 199023
Project: 199023
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent event){
  if (mInstantExpanding) {
    return false;
  }
  int pointerIndex=event.findPointerIndex(mTrackingPointer);
  if (pointerIndex < 0) {
    pointerIndex=0;
    mTrackingPointer=event.getPointerId(pointerIndex);
  }
  final float x=event.getX(pointerIndex);
  final float y=event.getY(pointerIndex);
  boolean scrolledToBottom=isScrolledToBottom();
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
    if (mHeightAnimator != null && !mHintAnimationRunning) {
      mHeightAnimator.cancel();
      mTouchSlopExceeded=true;
      return true;
    }
  mInitialTouchY=y;
mInitialTouchX=x;
mTouchSlopExceeded=false;
initVelocityTracker();
trackMovement(event);
break;
case MotionEvent.ACTION_POINTER_UP:
final int upPointer=event.getPointerId(event.getActionIndex());
if (mTrackingPointer == upPointer) {
final int newIndex=event.getPointerId(0) != upPointer ? 0 : 1;
mTrackingPointer=event.getPointerId(newIndex);
mInitialTouchX=event.getX(newIndex);
mInitialTouchY=event.getY(newIndex);
}
break;
case MotionEvent.ACTION_MOVE:
final float h=y - mInitialTouchY;
trackMovement(event);
if (scrolledToBottom) {
if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) {
if (mHeightAnimator != null) {
mHeightAnimator.cancel();
}
mInitialOffsetOnTouch=mExpandedHeight;
mInitialTouchY=y;
mInitialTouchX=x;
mTracking=true;
mTouchSlopExceeded=true;
onTrackingStarted();
return true;
}
}
break;
}
return false;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent event){
  if (mInstantExpanding) {
    return false;
  }
  int pointerIndex=event.findPointerIndex(mTrackingPointer);
  if (pointerIndex < 0) {
    pointerIndex=0;
    mTrackingPointer=event.getPointerId(pointerIndex);
  }
  final float x=event.getX(pointerIndex);
  final float y=event.getY(pointerIndex);
  boolean scrolledToBottom=isScrolledToBottom();
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
    if (mHeightAnimator != null && !mHintAnimationRunning) {
      mHeightAnimator.cancel();
      mTouchSlopExceeded=true;
      return true;
    }
  mInitialTouchY=y;
mInitialTouchX=x;
mTouchSlopExceeded=false;
mJustPeeked=false;
initVelocityTracker();
trackMovement(event);
break;
case MotionEvent.ACTION_POINTER_UP:
final int upPointer=event.getPointerId(event.getActionIndex());
if (mTrackingPointer == upPointer) {
final int newIndex=event.getPointerId(0) != upPointer ? 0 : 1;
mTrackingPointer=event.getPointerId(newIndex);
mInitialTouchX=event.getX(newIndex);
mInitialTouchY=event.getY(newIndex);
}
break;
case MotionEvent.ACTION_MOVE:
final float h=y - mInitialTouchY;
trackMovement(event);
if (scrolledToBottom) {
if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) {
if (mHeightAnimator != null) {
mHeightAnimator.cancel();
}
mInitialOffsetOnTouch=mExpandedHeight;
mInitialTouchY=y;
mInitialTouchX=x;
mTracking=true;
mTouchSlopExceeded=true;
onTrackingStarted();
return true;
}
}
break;
}
return false;
}
Program: 199027
Project: 199027
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent event){
  if (mInstantExpanding) {
    return false;
  }
  int pointerIndex=event.findPointerIndex(mTrackingPointer);
  if (pointerIndex < 0) {
    pointerIndex=0;
    mTrackingPointer=event.getPointerId(pointerIndex);
  }
  final float x=event.getX(pointerIndex);
  final float y=event.getY(pointerIndex);
  boolean scrolledToBottom=isScrolledToBottom();
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
    if (mHeightAnimator != null && !mHintAnimationRunning) {
      mHeightAnimator.cancel();
      mTouchSlopExceeded=true;
      return true;
    }
  mInitialTouchY=y;
mInitialTouchX=x;
mTouchSlopExceeded=false;
initVelocityTracker();
trackMovement(event);
break;
case MotionEvent.ACTION_POINTER_UP:
final int upPointer=event.getPointerId(event.getActionIndex());
if (mTrackingPointer == upPointer) {
final int newIndex=event.getPointerId(0) != upPointer ? 0 : 1;
mTrackingPointer=event.getPointerId(newIndex);
mInitialTouchX=event.getX(newIndex);
mInitialTouchY=event.getY(newIndex);
}
break;
case MotionEvent.ACTION_MOVE:
final float h=y - mInitialTouchY;
trackMovement(event);
if (scrolledToBottom) {
if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) {
if (mHeightAnimator != null) {
mHeightAnimator.cancel();
}
mInitialOffsetOnTouch=mExpandedHeight;
mInitialTouchY=y;
mInitialTouchX=x;
mTracking=true;
mTouchSlopExceeded=true;
onTrackingStarted();
return true;
}
}
break;
}
return false;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent event){
  if (mInstantExpanding) {
    return false;
  }
  int pointerIndex=event.findPointerIndex(mTrackingPointer);
  if (pointerIndex < 0) {
    pointerIndex=0;
    mTrackingPointer=event.getPointerId(pointerIndex);
  }
  final float x=event.getX(pointerIndex);
  final float y=event.getY(pointerIndex);
  boolean scrolledToBottom=isScrolledToBottom();
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
    if (mHeightAnimator != null && !mHintAnimationRunning) {
      mHeightAnimator.cancel();
      mTouchSlopExceeded=true;
      return true;
    }
  mInitialTouchY=y;
mInitialTouchX=x;
mTouchSlopExceeded=false;
mJustPeeked=false;
initVelocityTracker();
trackMovement(event);
break;
case MotionEvent.ACTION_POINTER_UP:
final int upPointer=event.getPointerId(event.getActionIndex());
if (mTrackingPointer == upPointer) {
final int newIndex=event.getPointerId(0) != upPointer ? 0 : 1;
mTrackingPointer=event.getPointerId(newIndex);
mInitialTouchX=event.getX(newIndex);
mInitialTouchY=event.getY(newIndex);
}
break;
case MotionEvent.ACTION_MOVE:
final float h=y - mInitialTouchY;
trackMovement(event);
if (scrolledToBottom) {
if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) {
if (mHeightAnimator != null) {
mHeightAnimator.cancel();
}
mInitialOffsetOnTouch=mExpandedHeight;
mInitialTouchY=y;
mInitialTouchX=x;
mTracking=true;
mTouchSlopExceeded=true;
onTrackingStarted();
return true;
}
}
break;
}
return false;
}
Program: 199028
Project: 199028
Buggy source:
@Override protected float getPeekHeight(){
  if (mNotificationStackScroller.getNotGoneChildCount() > 0) {
    return mNotificationStackScroller.getPeekHeight();
  }
 else {
    return mQsMinExpansionHeight;
  }
}

Fixed version (ground truth):
@Override protected float getPeekHeight(){
  if (mNotificationStackScroller.getNotGoneChildCount() > 0) {
    return mNotificationStackScroller.getPeekHeight();
  }
 else {
    return mQsMinExpansionHeight * HEADER_RUBBERBAND_FACTOR;
  }
}