nus-yam/ex-repair huggingface dataset:
Program: 192279
Project: 192279
Buggy source:
private void updateStateForChildFullyInBottomStack(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,StackViewState childViewState,int minHeight,AmbientState ambientState,ExpandableView child){
  float currentYPosition;
  algorithmState.itemsInBottomStack+=1.0f;
  if (algorithmState.itemsInBottomStack < MAX_ITEMS_IN_BOTTOM_STACK) {
    currentYPosition=transitioningPositionStart + mBottomStackIndentationFunctor.getValue(algorithmState.itemsInBottomStack) - getPaddingAfterChild(algorithmState,child);
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_PEEKING;
  }
 else {
    if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 2) {
      childViewState.hidden=true;
      childViewState.shadowAlpha=0.0f;
    }
 else     if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 1) {
      childViewState.shadowAlpha=1.0f - algorithmState.partialInBottom;
    }
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_HIDDEN;
    currentYPosition=ambientState.getInnerHeight();
  }
  childViewState.height=minHeight;
  childViewState.yTranslation=currentYPosition - minHeight;
}

Fixed version (ground truth):
private void updateStateForChildFullyInBottomStack(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,StackViewState childViewState,int collapsedHeight,AmbientState ambientState,ExpandableView child){
  float currentYPosition;
  algorithmState.itemsInBottomStack+=1.0f;
  if (algorithmState.itemsInBottomStack < MAX_ITEMS_IN_BOTTOM_STACK) {
    currentYPosition=transitioningPositionStart + mBottomStackIndentationFunctor.getValue(algorithmState.itemsInBottomStack) - getPaddingAfterChild(algorithmState,child);
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_PEEKING;
  }
 else {
    if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 2) {
      childViewState.hidden=true;
      childViewState.shadowAlpha=0.0f;
    }
 else     if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 1) {
      childViewState.shadowAlpha=1.0f - algorithmState.partialInBottom;
    }
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_HIDDEN;
    currentYPosition=ambientState.getInnerHeight();
  }
  childViewState.height=collapsedHeight;
  childViewState.yTranslation=currentYPosition - collapsedHeight;
}
Program: 192284
Project: 192284
Buggy source:
/** 
 * This is called with the full size of the window since we are handling our own insets.
 */
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  if (mTaskStackView.getVisibility() != GONE) {
    mTaskStackView.layout(left,top,left + getMeasuredWidth(),top + getMeasuredHeight());
  }
  if (mEmptyView.getVisibility() != GONE) {
    int leftRightInsets=mSystemInsets.left + mSystemInsets.right;
    int topBottomInsets=mSystemInsets.top + mSystemInsets.bottom;
    int childWidth=mEmptyView.getMeasuredWidth();
    int childHeight=mEmptyView.getMeasuredHeight();
    int childLeft=left + Math.max(0,(right - left - leftRightInsets- childWidth)) / 2;
    int childTop=top + Math.max(0,(bottom - top - topBottomInsets- childHeight)) / 2;
    mEmptyView.layout(childLeft,childTop,childLeft + childWidth,childTop + childHeight);
  }
  if (RecentsDebugFlags.Static.EnableStackActionButton) {
    Rect buttonBounds=getStackActionButtonBoundsFromStackLayout();
    mStackActionButton.layout(buttonBounds.left,buttonBounds.top,buttonBounds.right,buttonBounds.bottom);
  }
  if (mAwaitingFirstLayout) {
    mAwaitingFirstLayout=false;
    RecentsActivityLaunchState launchState=Recents.getConfiguration().getLaunchState();
    if (launchState.launchedViaDragGesture) {
      setTranslationY(getMeasuredHeight());
    }
 else {
      setTranslationY(0f);
    }
  }
}

Fixed version (ground truth):
/** 
 * This is called with the full size of the window since we are handling our own insets.
 */
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  if (mTaskStackView.getVisibility() != GONE) {
    mTaskStackView.layout(left,top,left + getMeasuredWidth(),top + getMeasuredHeight());
  }
  if (mEmptyView.getVisibility() != GONE) {
    int leftRightInsets=mSystemInsets.left + mSystemInsets.right;
    int topBottomInsets=mSystemInsets.top + mSystemInsets.bottom;
    int childWidth=mEmptyView.getMeasuredWidth();
    int childHeight=mEmptyView.getMeasuredHeight();
    int childLeft=left + mSystemInsets.left + Math.max(0,(right - left - leftRightInsets- childWidth)) / 2;
    int childTop=top + mSystemInsets.top + Math.max(0,(bottom - top - topBottomInsets- childHeight)) / 2;
    mEmptyView.layout(childLeft,childTop,childLeft + childWidth,childTop + childHeight);
  }
  if (RecentsDebugFlags.Static.EnableStackActionButton) {
    Rect buttonBounds=getStackActionButtonBoundsFromStackLayout();
    mStackActionButton.layout(buttonBounds.left,buttonBounds.top,buttonBounds.right,buttonBounds.bottom);
  }
  if (mAwaitingFirstLayout) {
    mAwaitingFirstLayout=false;
    RecentsActivityLaunchState launchState=Recents.getConfiguration().getLaunchState();
    if (launchState.launchedViaDragGesture) {
      setTranslationY(getMeasuredHeight());
    }
 else {
      setTranslationY(0f);
    }
  }
}
Program: 192287
Project: 192287
Buggy source:
boolean matches(byte[] packet,int length){
  if (length != mPacket.limit())   return false;
  ByteBuffer a=ByteBuffer.wrap(packet);
  ByteBuffer b=mPacket;
  for (  Pair<Integer,Integer> nonLifetime : mNonLifetimes) {
    a.clear();
    b.clear();
    a.position(nonLifetime.first);
    b.position(nonLifetime.first);
    a.limit(nonLifetime.first + nonLifetime.second);
    b.limit(nonLifetime.first + nonLifetime.second);
    if (a.compareTo(b) != 0)     return false;
  }
  return true;
}

Fixed version (ground truth):
boolean matches(byte[] packet,int length){
  if (length != mPacket.capacity())   return false;
  byte[] referencePacket=mPacket.array();
  for (  Pair<Integer,Integer> nonLifetime : mNonLifetimes) {
    for (int i=nonLifetime.first; i < (nonLifetime.first + nonLifetime.second); i++) {
      if (packet[i] != referencePacket[i])       return false;
    }
  }
  return true;
}
Program: 192288
Project: 192288
Buggy source:
@GuardedBy("String_Node_Str") long generateFilterLocked(ApfGenerator gen) throws IllegalInstructionException {
  String nextFilterLabel="String_Node_Str" + getUniqueNumberLocked();
  gen.addLoadFromMemory(Register.R0,gen.PACKET_SIZE_MEMORY_SLOT);
  gen.addJumpIfR0NotEquals(mPacket.limit(),nextFilterLabel);
  int filterLifetime=(int)(currentLifetime() / FRACTION_OF_LIFETIME_TO_FILTER);
  gen.addLoadFromMemory(Register.R0,gen.FILTER_AGE_MEMORY_SLOT);
  gen.addJumpIfR0GreaterThan(filterLifetime,nextFilterLabel);
  for (int i=0; i < mNonLifetimes.size(); i++) {
    Pair<Integer,Integer> nonLifetime=mNonLifetimes.get(i);
    if (nonLifetime.second != 0) {
      gen.addLoadImmediate(Register.R0,nonLifetime.first);
      gen.addJumpIfBytesNotEqual(Register.R0,Arrays.copyOfRange(mPacket.array(),nonLifetime.first,nonLifetime.first + nonLifetime.second),nextFilterLabel);
    }
    if ((i + 1) < mNonLifetimes.size()) {
      Pair<Integer,Integer> nextNonLifetime=mNonLifetimes.get(i + 1);
      int offset=nonLifetime.first + nonLifetime.second;
      if (offset == ICMP6_RA_CHECKSUM_OFFSET) {
        continue;
      }
      int length=nextNonLifetime.first - offset;
switch (length) {
case 4:
        gen.addLoad32(Register.R0,offset);
      break;
case 2:
    gen.addLoad16(Register.R0,offset);
  break;
default :
throw new IllegalStateException("String_Node_Str" + length);
}
gen.addJumpIfR0LessThan(filterLifetime,nextFilterLabel);
}
}
gen.addJump(gen.DROP_LABEL);
gen.defineLabel(nextFilterLabel);
return filterLifetime;
}

Fixed version (ground truth):
@GuardedBy("String_Node_Str") long generateFilterLocked(ApfGenerator gen) throws IllegalInstructionException {
  String nextFilterLabel="String_Node_Str" + getUniqueNumberLocked();
  gen.addLoadFromMemory(Register.R0,gen.PACKET_SIZE_MEMORY_SLOT);
  gen.addJumpIfR0NotEquals(mPacket.capacity(),nextFilterLabel);
  int filterLifetime=(int)(currentLifetime() / FRACTION_OF_LIFETIME_TO_FILTER);
  gen.addLoadFromMemory(Register.R0,gen.FILTER_AGE_MEMORY_SLOT);
  gen.addJumpIfR0GreaterThan(filterLifetime,nextFilterLabel);
  for (int i=0; i < mNonLifetimes.size(); i++) {
    Pair<Integer,Integer> nonLifetime=mNonLifetimes.get(i);
    if (nonLifetime.second != 0) {
      gen.addLoadImmediate(Register.R0,nonLifetime.first);
      gen.addJumpIfBytesNotEqual(Register.R0,Arrays.copyOfRange(mPacket.array(),nonLifetime.first,nonLifetime.first + nonLifetime.second),nextFilterLabel);
    }
    if ((i + 1) < mNonLifetimes.size()) {
      Pair<Integer,Integer> nextNonLifetime=mNonLifetimes.get(i + 1);
      int offset=nonLifetime.first + nonLifetime.second;
      if (offset == ICMP6_RA_CHECKSUM_OFFSET) {
        continue;
      }
      int length=nextNonLifetime.first - offset;
switch (length) {
case 4:
        gen.addLoad32(Register.R0,offset);
      break;
case 2:
    gen.addLoad16(Register.R0,offset);
  break;
default :
throw new IllegalStateException("String_Node_Str" + length);
}
gen.addJumpIfR0LessThan(filterLifetime,nextFilterLabel);
}
}
gen.addJump(gen.DROP_LABEL);
gen.defineLabel(nextFilterLabel);
return filterLifetime;
}
Program: 192289
Project: 192289
Buggy source:
private void updateSoftKeyboardShowModeLocked(UserState userState){
  final int userId=userState.mUserId;
  if ((userId == mCurrentUserId) && (userState.mSoftKeyboardShowMode != 0)) {
    boolean serviceChangingSoftKeyboardModeIsEnabled=userState.mEnabledServices.contains(userState.mServiceChangingSoftKeyboardMode);
    if (!serviceChangingSoftKeyboardModeIsEnabled) {
      Settings.Secure.putIntForUser(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,0,userState.mUserId);
      userState.mSoftKeyboardShowMode=0;
      userState.mServiceChangingSoftKeyboardMode=null;
    }
    notifySoftKeyboardShowModeChangedLocked(userState.mSoftKeyboardShowMode);
  }
}

Fixed version (ground truth):
private void updateSoftKeyboardShowModeLocked(UserState userState){
  final int userId=userState.mUserId;
  if ((userId == mCurrentUserId) && (userState.mSoftKeyboardShowMode != 0)) {
    boolean serviceChangingSoftKeyboardModeIsEnabled=userState.mEnabledServices.contains(userState.mServiceChangingSoftKeyboardMode);
    if (!serviceChangingSoftKeyboardModeIsEnabled) {
      final long identity=Binder.clearCallingIdentity();
      try {
        Settings.Secure.putIntForUser(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,0,userState.mUserId);
      }
  finally {
        Binder.restoreCallingIdentity(identity);
      }
      userState.mSoftKeyboardShowMode=0;
      userState.mServiceChangingSoftKeyboardMode=null;
    }
    notifySoftKeyboardShowModeChangedLocked(userState.mSoftKeyboardShowMode);
  }
}
Program: 192290
Project: 192290
Buggy source:
void initViews(){
  mInitialized=false;
  mWindowCreated=false;
  mShowInputRequested=false;
  mShowInputForced=false;
  mThemeAttrs=obtainStyledAttributes(android.R.styleable.InputMethodService);
  mRootView=mInflater.inflate(com.android.internal.R.layout.input_method,null);
  mRootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  mWindow.setContentView(mRootView);
  mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(mInsetsComputer);
  mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer);
  if (Settings.Global.getInt(getContentResolver(),Settings.Global.FANCY_IME_ANIMATIONS,0) != 0) {
    mWindow.getWindow().setWindowAnimations(com.android.internal.R.style.Animation_InputMethodFancy);
  }
  mFullscreenArea=(ViewGroup)mRootView.findViewById(com.android.internal.R.id.fullscreenArea);
  mExtractViewHidden=false;
  mExtractFrame=(FrameLayout)mRootView.findViewById(android.R.id.extractArea);
  mExtractView=null;
  mExtractEditText=null;
  mExtractAccessories=null;
  mExtractAction=null;
  mFullscreenApplied=false;
  mCandidatesFrame=(FrameLayout)mRootView.findViewById(android.R.id.candidatesArea);
  mInputFrame=(FrameLayout)mRootView.findViewById(android.R.id.inputArea);
  mInputView=null;
  mIsInputViewShown=false;
  mExtractFrame.setVisibility(View.GONE);
  mCandidatesVisibility=getCandidatesHiddenVisibility();
  mCandidatesFrame.setVisibility(mCandidatesVisibility);
  mInputFrame.setVisibility(View.GONE);
}

Fixed version (ground truth):
void initViews(){
  mInitialized=false;
  mWindowCreated=false;
  mShowInputRequested=false;
  mShowInputFlags=0;
  mThemeAttrs=obtainStyledAttributes(android.R.styleable.InputMethodService);
  mRootView=mInflater.inflate(com.android.internal.R.layout.input_method,null);
  mRootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  mWindow.setContentView(mRootView);
  mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(mInsetsComputer);
  mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer);
  if (Settings.Global.getInt(getContentResolver(),Settings.Global.FANCY_IME_ANIMATIONS,0) != 0) {
    mWindow.getWindow().setWindowAnimations(com.android.internal.R.style.Animation_InputMethodFancy);
  }
  mFullscreenArea=(ViewGroup)mRootView.findViewById(com.android.internal.R.id.fullscreenArea);
  mExtractViewHidden=false;
  mExtractFrame=(FrameLayout)mRootView.findViewById(android.R.id.extractArea);
  mExtractView=null;
  mExtractEditText=null;
  mExtractAccessories=null;
  mExtractAction=null;
  mFullscreenApplied=false;
  mCandidatesFrame=(FrameLayout)mRootView.findViewById(android.R.id.candidatesArea);
  mInputFrame=(FrameLayout)mRootView.findViewById(android.R.id.inputArea);
  mInputView=null;
  mIsInputViewShown=false;
  mExtractFrame.setVisibility(View.GONE);
  mCandidatesVisibility=getCandidatesHiddenVisibility();
  mCandidatesFrame.setVisibility(mCandidatesVisibility);
  mInputFrame.setVisibility(View.GONE);
}
Program: 192291
Project: 192291
Buggy source:
/** 
 * Handle a request by the system to show the soft input area.
 */
public void showSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  mShowInputFlags=0;
  if (onShowInputRequested(flags,false)) {
    try {
      showWindow(true);
    }
 catch (    BadTokenException e) {
    }
  }
  clearInsetOfPreviousIme();
  boolean showing=isInputViewShown();
  mImm.setImeWindowStatus(mToken,IME_ACTIVE | (showing ? IME_VISIBLE : 0),mBackDisposition);
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_SHOWN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}

Fixed version (ground truth):
/** 
 * Handle a request by the system to show the soft input area.
 */
public void showSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  if (dispatchOnShowInputRequested(flags,false)) {
    try {
      showWindow(true);
    }
 catch (    BadTokenException e) {
    }
  }
  clearInsetOfPreviousIme();
  boolean showing=isInputViewShown();
  mImm.setImeWindowStatus(mToken,IME_ACTIVE | (showing ? IME_VISIBLE : 0),mBackDisposition);
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_SHOWN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}
Program: 192292
Project: 192292
Buggy source:
/** 
 * Handle a request by the system to hide the soft input area.
 */
public void hideSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  mShowInputFlags=0;
  mShowInputRequested=false;
  mShowInputForced=false;
  doHideWindow();
  clearInsetOfPreviousIme();
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_HIDDEN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}

Fixed version (ground truth):
/** 
 * Handle a request by the system to hide the soft input area.
 */
public void hideSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  mShowInputFlags=0;
  mShowInputRequested=false;
  doHideWindow();
  clearInsetOfPreviousIme();
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_HIDDEN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}
Program: 192293
Project: 192293
Buggy source:
/** 
 * The system has decided that it may be time to show your input method. This is called due to a corresponding call to your  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}method.  The default implementation uses  {@link #onEvaluateInputViewShown()},   {@link #onEvaluateFullscreenMode()}, and the current configuration to decide whether the input view should be shown at this point.
 * @param flags Provides additional information about the show request,as per  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}.
 * @param configChange This is true if we are re-showing due to aconfiguration change.
 * @return Returns true to indicate that the window should be shown.
 */
public boolean onShowInputRequested(int flags,boolean configChange){
  if (!onEvaluateInputViewShown()) {
    return false;
  }
  if ((flags & InputMethod.SHOW_EXPLICIT) == 0) {
    if (!configChange && onEvaluateFullscreenMode()) {
      return false;
    }
    Configuration config=getResources().getConfiguration();
    if (config.keyboard != Configuration.KEYBOARD_NOKEYS) {
      return false;
    }
  }
  if ((flags & InputMethod.SHOW_FORCED) != 0) {
    mShowInputForced=true;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * The system has decided that it may be time to show your input method. This is called due to a corresponding call to your  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}method.  The default implementation uses  {@link #onEvaluateInputViewShown()},   {@link #onEvaluateFullscreenMode()}, and the current configuration to decide whether the input view should be shown at this point.
 * @param flags Provides additional information about the show request,as per  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}.
 * @param configChange This is true if we are re-showing due to aconfiguration change.
 * @return Returns true to indicate that the window should be shown.
 */
public boolean onShowInputRequested(int flags,boolean configChange){
  if (!onEvaluateInputViewShown()) {
    return false;
  }
  if ((flags & InputMethod.SHOW_EXPLICIT) == 0) {
    if (!configChange && onEvaluateFullscreenMode()) {
      return false;
    }
    Configuration config=getResources().getConfiguration();
    if (config.keyboard != Configuration.KEYBOARD_NOKEYS) {
      return false;
    }
  }
  return true;
}
Program: 192294
Project: 192294
Buggy source:
public void showWindow(boolean showInput){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + showInput + "String_Node_Str"+ mShowInputRequested+ "String_Node_Str"+ mWindowAdded+ "String_Node_Str"+ mWindowCreated+ "String_Node_Str"+ mWindowVisible+ "String_Node_Str"+ mInputStarted);
  if (mInShowWindow) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  try {
    mWindowWasVisible=mWindowVisible;
    mInShowWindow=true;
    showWindowInner(showInput);
  }
 catch (  BadTokenException e) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str");
    mWindowVisible=false;
    mWindowAdded=false;
    throw e;
  }
 finally {
    mWindowWasVisible=true;
    mInShowWindow=false;
  }
}

Fixed version (ground truth):
public void showWindow(boolean showInput){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + showInput + "String_Node_Str"+ mShowInputRequested+ "String_Node_Str"+ mWindowAdded+ "String_Node_Str"+ mWindowCreated+ "String_Node_Str"+ mWindowVisible+ "String_Node_Str"+ mInputStarted+ "String_Node_Str"+ mShowInputFlags);
  if (mInShowWindow) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  try {
    mWindowWasVisible=mWindowVisible;
    mInShowWindow=true;
    showWindowInner(showInput);
  }
 catch (  BadTokenException e) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str");
    mWindowVisible=false;
    mWindowAdded=false;
    throw e;
  }
 finally {
    mWindowWasVisible=true;
    mInShowWindow=false;
  }
}
Program: 192297
Project: 192297
Buggy source:
private void updateSoftKeyboardShowModeLocked(UserState userState){
  final int userId=userState.mUserId;
  if ((userId == mCurrentUserId) && (userState.mSoftKeyboardShowMode != 0)) {
    boolean serviceChangingSoftKeyboardModeIsEnabled=userState.mEnabledServices.contains(userState.mServiceChangingSoftKeyboardMode);
    if (!serviceChangingSoftKeyboardModeIsEnabled) {
      Settings.Secure.putIntForUser(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,0,userState.mUserId);
      userState.mSoftKeyboardShowMode=0;
      userState.mServiceChangingSoftKeyboardMode=null;
    }
    notifySoftKeyboardShowModeChangedLocked(userState.mSoftKeyboardShowMode);
  }
}

Fixed version (ground truth):
private void updateSoftKeyboardShowModeLocked(UserState userState){
  final int userId=userState.mUserId;
  if ((userId == mCurrentUserId) && (userState.mSoftKeyboardShowMode != 0)) {
    boolean serviceChangingSoftKeyboardModeIsEnabled=userState.mEnabledServices.contains(userState.mServiceChangingSoftKeyboardMode);
    if (!serviceChangingSoftKeyboardModeIsEnabled) {
      final long identity=Binder.clearCallingIdentity();
      try {
        Settings.Secure.putIntForUser(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,0,userState.mUserId);
      }
  finally {
        Binder.restoreCallingIdentity(identity);
      }
      userState.mSoftKeyboardShowMode=0;
      userState.mServiceChangingSoftKeyboardMode=null;
    }
    notifySoftKeyboardShowModeChangedLocked(userState.mSoftKeyboardShowMode);
  }
}
Program: 192298
Project: 192298
Buggy source:
void initViews(){
  mInitialized=false;
  mWindowCreated=false;
  mShowInputRequested=false;
  mShowInputForced=false;
  mThemeAttrs=obtainStyledAttributes(android.R.styleable.InputMethodService);
  mRootView=mInflater.inflate(com.android.internal.R.layout.input_method,null);
  mRootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  mWindow.setContentView(mRootView);
  mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(mInsetsComputer);
  mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer);
  if (Settings.Global.getInt(getContentResolver(),Settings.Global.FANCY_IME_ANIMATIONS,0) != 0) {
    mWindow.getWindow().setWindowAnimations(com.android.internal.R.style.Animation_InputMethodFancy);
  }
  mFullscreenArea=(ViewGroup)mRootView.findViewById(com.android.internal.R.id.fullscreenArea);
  mExtractViewHidden=false;
  mExtractFrame=(FrameLayout)mRootView.findViewById(android.R.id.extractArea);
  mExtractView=null;
  mExtractEditText=null;
  mExtractAccessories=null;
  mExtractAction=null;
  mFullscreenApplied=false;
  mCandidatesFrame=(FrameLayout)mRootView.findViewById(android.R.id.candidatesArea);
  mInputFrame=(FrameLayout)mRootView.findViewById(android.R.id.inputArea);
  mInputView=null;
  mIsInputViewShown=false;
  mExtractFrame.setVisibility(View.GONE);
  mCandidatesVisibility=getCandidatesHiddenVisibility();
  mCandidatesFrame.setVisibility(mCandidatesVisibility);
  mInputFrame.setVisibility(View.GONE);
}

Fixed version (ground truth):
void initViews(){
  mInitialized=false;
  mWindowCreated=false;
  mShowInputRequested=false;
  mShowInputFlags=0;
  mThemeAttrs=obtainStyledAttributes(android.R.styleable.InputMethodService);
  mRootView=mInflater.inflate(com.android.internal.R.layout.input_method,null);
  mRootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  mWindow.setContentView(mRootView);
  mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(mInsetsComputer);
  mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer);
  if (Settings.Global.getInt(getContentResolver(),Settings.Global.FANCY_IME_ANIMATIONS,0) != 0) {
    mWindow.getWindow().setWindowAnimations(com.android.internal.R.style.Animation_InputMethodFancy);
  }
  mFullscreenArea=(ViewGroup)mRootView.findViewById(com.android.internal.R.id.fullscreenArea);
  mExtractViewHidden=false;
  mExtractFrame=(FrameLayout)mRootView.findViewById(android.R.id.extractArea);
  mExtractView=null;
  mExtractEditText=null;
  mExtractAccessories=null;
  mExtractAction=null;
  mFullscreenApplied=false;
  mCandidatesFrame=(FrameLayout)mRootView.findViewById(android.R.id.candidatesArea);
  mInputFrame=(FrameLayout)mRootView.findViewById(android.R.id.inputArea);
  mInputView=null;
  mIsInputViewShown=false;
  mExtractFrame.setVisibility(View.GONE);
  mCandidatesVisibility=getCandidatesHiddenVisibility();
  mCandidatesFrame.setVisibility(mCandidatesVisibility);
  mInputFrame.setVisibility(View.GONE);
}
Program: 192299
Project: 192299
Buggy source:
/** 
 * Handle a request by the system to show the soft input area.
 */
public void showSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  mShowInputFlags=0;
  if (onShowInputRequested(flags,false)) {
    try {
      showWindow(true);
    }
 catch (    BadTokenException e) {
    }
  }
  clearInsetOfPreviousIme();
  boolean showing=isInputViewShown();
  mImm.setImeWindowStatus(mToken,IME_ACTIVE | (showing ? IME_VISIBLE : 0),mBackDisposition);
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_SHOWN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}

Fixed version (ground truth):
/** 
 * Handle a request by the system to show the soft input area.
 */
public void showSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  if (dispatchOnShowInputRequested(flags,false)) {
    try {
      showWindow(true);
    }
 catch (    BadTokenException e) {
    }
  }
  clearInsetOfPreviousIme();
  boolean showing=isInputViewShown();
  mImm.setImeWindowStatus(mToken,IME_ACTIVE | (showing ? IME_VISIBLE : 0),mBackDisposition);
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_SHOWN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}
Program: 192300
Project: 192300
Buggy source:
/** 
 * Handle a request by the system to hide the soft input area.
 */
public void hideSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  mShowInputFlags=0;
  mShowInputRequested=false;
  mShowInputForced=false;
  doHideWindow();
  clearInsetOfPreviousIme();
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_HIDDEN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}

Fixed version (ground truth):
/** 
 * Handle a request by the system to hide the soft input area.
 */
public void hideSoftInput(int flags,ResultReceiver resultReceiver){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  boolean wasVis=isInputViewShown();
  mShowInputFlags=0;
  mShowInputRequested=false;
  doHideWindow();
  clearInsetOfPreviousIme();
  if (resultReceiver != null) {
    resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_HIDDEN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN),null);
  }
}
Program: 192301
Project: 192301
Buggy source:
/** 
 * The system has decided that it may be time to show your input method. This is called due to a corresponding call to your  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}method.  The default implementation uses  {@link #onEvaluateInputViewShown()},   {@link #onEvaluateFullscreenMode()}, and the current configuration to decide whether the input view should be shown at this point.
 * @param flags Provides additional information about the show request,as per  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}.
 * @param configChange This is true if we are re-showing due to aconfiguration change.
 * @return Returns true to indicate that the window should be shown.
 */
public boolean onShowInputRequested(int flags,boolean configChange){
  if (!onEvaluateInputViewShown()) {
    return false;
  }
  if ((flags & InputMethod.SHOW_EXPLICIT) == 0) {
    if (!configChange && onEvaluateFullscreenMode()) {
      return false;
    }
    Configuration config=getResources().getConfiguration();
    if (config.keyboard != Configuration.KEYBOARD_NOKEYS) {
      return false;
    }
  }
  if ((flags & InputMethod.SHOW_FORCED) != 0) {
    mShowInputForced=true;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * The system has decided that it may be time to show your input method. This is called due to a corresponding call to your  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}method.  The default implementation uses  {@link #onEvaluateInputViewShown()},   {@link #onEvaluateFullscreenMode()}, and the current configuration to decide whether the input view should be shown at this point.
 * @param flags Provides additional information about the show request,as per  {@link InputMethod#showSoftInput InputMethod.showSoftInput()}.
 * @param configChange This is true if we are re-showing due to aconfiguration change.
 * @return Returns true to indicate that the window should be shown.
 */
public boolean onShowInputRequested(int flags,boolean configChange){
  if (!onEvaluateInputViewShown()) {
    return false;
  }
  if ((flags & InputMethod.SHOW_EXPLICIT) == 0) {
    if (!configChange && onEvaluateFullscreenMode()) {
      return false;
    }
    Configuration config=getResources().getConfiguration();
    if (config.keyboard != Configuration.KEYBOARD_NOKEYS) {
      return false;
    }
  }
  return true;
}
Program: 192302
Project: 192302
Buggy source:
public void showWindow(boolean showInput){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + showInput + "String_Node_Str"+ mShowInputRequested+ "String_Node_Str"+ mWindowAdded+ "String_Node_Str"+ mWindowCreated+ "String_Node_Str"+ mWindowVisible+ "String_Node_Str"+ mInputStarted);
  if (mInShowWindow) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  try {
    mWindowWasVisible=mWindowVisible;
    mInShowWindow=true;
    showWindowInner(showInput);
  }
 catch (  BadTokenException e) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str");
    mWindowVisible=false;
    mWindowAdded=false;
    throw e;
  }
 finally {
    mWindowWasVisible=true;
    mInShowWindow=false;
  }
}

Fixed version (ground truth):
public void showWindow(boolean showInput){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + showInput + "String_Node_Str"+ mShowInputRequested+ "String_Node_Str"+ mWindowAdded+ "String_Node_Str"+ mWindowCreated+ "String_Node_Str"+ mWindowVisible+ "String_Node_Str"+ mInputStarted+ "String_Node_Str"+ mShowInputFlags);
  if (mInShowWindow) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  try {
    mWindowWasVisible=mWindowVisible;
    mInShowWindow=true;
    showWindowInner(showInput);
  }
 catch (  BadTokenException e) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str");
    mWindowVisible=false;
    mWindowAdded=false;
    throw e;
  }
 finally {
    mWindowWasVisible=true;
    mInShowWindow=false;
  }
}
Program: 192305
Project: 192305
Buggy source:
/** 
 * Prepares the header bar layout for the next transition, if the task view bounds has changed since the last call, it will attempt to re-measure and layout the header bar to the new size.
 * @param stack the stack to initialize the stack layout with
 */
private void updateHeaderBarLayout(TaskStack stack){
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect systemInsets=new Rect();
  ssp.getStableInsets(systemInsets);
  Rect windowRect=ssp.getWindowRect();
  calculateWindowStableInsets(systemInsets,windowRect);
  windowRect.offsetTo(0,0);
  TaskStackLayoutAlgorithm stackLayout=mDummyStackView.getStackAlgorithm();
  stackLayout.getTaskStackBounds(windowRect,systemInsets.top,systemInsets.right,mTaskStackBounds);
  Rect taskStackBounds=new Rect(mTaskStackBounds);
  stackLayout.setSystemInsets(systemInsets);
  if (stack != null) {
    stackLayout.initialize(windowRect,taskStackBounds,TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
    mDummyStackView.setTasks(stack,false);
  }
  Rect taskViewBounds=stackLayout.getUntransformedTaskViewBounds();
  if (!taskViewBounds.equals(mLastTaskViewBounds)) {
    mLastTaskViewBounds.set(taskViewBounds);
    int taskViewWidth=taskViewBounds.width();
synchronized (mHeaderBarLock) {
      mHeaderBar.measure(View.MeasureSpec.makeMeasureSpec(taskViewWidth,View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mTaskBarHeight,View.MeasureSpec.EXACTLY));
      mHeaderBar.layout(0,0,taskViewWidth,mTaskBarHeight);
    }
  }
}

Fixed version (ground truth):
/** 
 * Prepares the header bar layout for the next transition, if the task view bounds has changed since the last call, it will attempt to re-measure and layout the header bar to the new size.
 * @param stack the stack to initialize the stack layout with
 */
private void updateHeaderBarLayout(TaskStack stack){
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect systemInsets=new Rect();
  ssp.getStableInsets(systemInsets);
  Rect windowRect=ssp.getWindowRect();
  if (ssp.hasDockedTask()) {
    windowRect.bottom-=systemInsets.bottom;
    systemInsets.bottom=0;
  }
  calculateWindowStableInsets(systemInsets,windowRect);
  windowRect.offsetTo(0,0);
  TaskStackLayoutAlgorithm stackLayout=mDummyStackView.getStackAlgorithm();
  stackLayout.setSystemInsets(systemInsets);
  if (stack != null) {
    stackLayout.getTaskStackBounds(windowRect,systemInsets.top,systemInsets.right,mTaskStackBounds);
    stackLayout.initialize(windowRect,mTaskStackBounds,TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
    mDummyStackView.setTasks(stack,false);
  }
  Rect taskViewBounds=stackLayout.getUntransformedTaskViewBounds();
  if (!taskViewBounds.equals(mLastTaskViewBounds)) {
    mLastTaskViewBounds.set(taskViewBounds);
    int taskViewWidth=taskViewBounds.width();
synchronized (mHeaderBarLock) {
      mHeaderBar.measure(View.MeasureSpec.makeMeasureSpec(taskViewWidth,View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mTaskBarHeight,View.MeasureSpec.EXACTLY));
      mHeaderBar.layout(0,0,taskViewWidth,mTaskBarHeight);
    }
  }
}
Program: 192306
Project: 192306
Buggy source:
/** 
 * Prepares the header bar layout for the next transition, if the task view bounds has changed since the last call, it will attempt to re-measure and layout the header bar to the new size.
 * @param stack the stack to initialize the stack layout with
 */
private void updateHeaderBarLayout(TaskStack stack){
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect systemInsets=new Rect();
  ssp.getStableInsets(systemInsets);
  Rect windowRect=ssp.getWindowRect();
  calculateWindowStableInsets(systemInsets,windowRect);
  windowRect.offsetTo(0,0);
  TaskStackLayoutAlgorithm stackLayout=mDummyStackView.getStackAlgorithm();
  stackLayout.getTaskStackBounds(windowRect,systemInsets.top,systemInsets.right,mTaskStackBounds);
  Rect taskStackBounds=new Rect(mTaskStackBounds);
  stackLayout.setSystemInsets(systemInsets);
  if (stack != null) {
    stackLayout.initialize(windowRect,taskStackBounds,TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
    mDummyStackView.setTasks(stack,false);
  }
  Rect taskViewBounds=stackLayout.getUntransformedTaskViewBounds();
  if (!taskViewBounds.equals(mLastTaskViewBounds)) {
    mLastTaskViewBounds.set(taskViewBounds);
    int taskViewWidth=taskViewBounds.width();
synchronized (mHeaderBarLock) {
      mHeaderBar.measure(View.MeasureSpec.makeMeasureSpec(taskViewWidth,View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mTaskBarHeight,View.MeasureSpec.EXACTLY));
      mHeaderBar.layout(0,0,taskViewWidth,mTaskBarHeight);
    }
  }
}

Fixed version (ground truth):
/** 
 * Prepares the header bar layout for the next transition, if the task view bounds has changed since the last call, it will attempt to re-measure and layout the header bar to the new size.
 * @param stack the stack to initialize the stack layout with
 */
private void updateHeaderBarLayout(TaskStack stack){
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect systemInsets=new Rect();
  ssp.getStableInsets(systemInsets);
  Rect windowRect=ssp.getWindowRect();
  if (ssp.hasDockedTask()) {
    windowRect.bottom-=systemInsets.bottom;
    systemInsets.bottom=0;
  }
  calculateWindowStableInsets(systemInsets,windowRect);
  windowRect.offsetTo(0,0);
  TaskStackLayoutAlgorithm stackLayout=mDummyStackView.getStackAlgorithm();
  stackLayout.setSystemInsets(systemInsets);
  if (stack != null) {
    stackLayout.getTaskStackBounds(windowRect,systemInsets.top,systemInsets.right,mTaskStackBounds);
    stackLayout.initialize(windowRect,mTaskStackBounds,TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
    mDummyStackView.setTasks(stack,false);
  }
  Rect taskViewBounds=stackLayout.getUntransformedTaskViewBounds();
  if (!taskViewBounds.equals(mLastTaskViewBounds)) {
    mLastTaskViewBounds.set(taskViewBounds);
    int taskViewWidth=taskViewBounds.width();
synchronized (mHeaderBarLock) {
      mHeaderBar.measure(View.MeasureSpec.makeMeasureSpec(taskViewWidth,View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mTaskBarHeight,View.MeasureSpec.EXACTLY));
      mHeaderBar.layout(0,0,taskViewWidth,mTaskBarHeight);
    }
  }
}
Program: 192311
Project: 192311
Buggy source:
void handleLaunchTaskBehindCompleteLocked(ActivityRecord r){
  r.mLaunchTaskBehind=false;
  final TaskRecord task=r.task;
  task.setLastThumbnailLocked(task.stack.screenshotActivitiesLocked(r));
  mRecentTasks.addLocked(task);
  mService.notifyTaskStackChangedLocked();
  mWindowManager.setAppVisibility(r.appToken,false);
}

Fixed version (ground truth):
void handleLaunchTaskBehindCompleteLocked(ActivityRecord r){
  final TaskRecord task=r.task;
  final ActivityStack stack=task.stack;
  r.mLaunchTaskBehind=false;
  task.setLastThumbnailLocked(stack.screenshotActivitiesLocked(r));
  mRecentTasks.addLocked(task);
  mService.notifyTaskStackChangedLocked();
  mWindowManager.setAppVisibility(r.appToken,false);
  final ActivityRecord top=stack.topActivity();
  if (top != null) {
    top.task.touchActiveTime();
  }
}
Program: 192312
Project: 192312
Buggy source:
/** 
 * Checks the two objects for equality by delegating to their respective  {@link Object#equals(Object)} methods.
 * @param o the {@link Pair} to which this one is to be checked for equality
 * @return true if the underlying objects of the Pair are both consideredequal
 */
@Override public boolean equals(Object o){
  if (!(o instanceof Pair)) {
    return false;
  }
  Pair<?,?> p=(Pair<?,?>)o;
  return Objects.equal(p.first,first) && Objects.equal(p.second,second);
}

Fixed version (ground truth):
/** 
 * Checks the two objects for equality by delegating to their respective  {@link Object#equals(Object)} methods.
 * @param o the {@link Pair} to which this one is to be checked for equality
 * @return true if the underlying objects of the Pair are both consideredequal
 */
@Override public boolean equals(Object o){
  if (!(o instanceof Pair)) {
    return false;
  }
  Pair<?,?> p=(Pair<?,?>)o;
  return Objects.equals(p.first,first) && Objects.equals(p.second,second);
}
Program: 192313
Project: 192313
Buggy source:
@Override protected Void doInBackground(Void... params){
  final long start=SystemClock.elapsedRealtime();
  if (mFilterPackage != null) {
    if (!waitForFirstLoad()) {
      return null;
    }
  }
  mTaskRoots.put(mRecentsRoot.authority,mRecentsRoot);
  final ContentResolver resolver=mContext.getContentResolver();
  final PackageManager pm=mContext.getPackageManager();
  final Intent intent=new Intent(DocumentsContract.PROVIDER_INTERFACE);
  final List<ResolveInfo> providers=pm.queryIntentContentProviders(intent,0);
  for (  ResolveInfo info : providers) {
    handleDocumentsProvider(info.providerInfo);
  }
  final long delta=SystemClock.elapsedRealtime() - start;
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mTaskRoots.size() + "String_Node_Str"+ delta+ "String_Node_Str");
synchronized (mLock) {
    mFirstLoadDone=true;
    if (mBootCompletedResult != null) {
      mBootCompletedResult.finish();
      mBootCompletedResult=null;
    }
    mRoots=mTaskRoots;
    mStoppedAuthorities=mTaskStoppedAuthorities;
  }
  mFirstLoad.countDown();
  resolver.notifyChange(sNotificationUri,null,false);
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... params){
  final long start=SystemClock.elapsedRealtime();
  if (mForceRefreshPackage != null) {
    if (!waitForFirstLoad()) {
      return null;
    }
  }
  mTaskRoots.put(mRecentsRoot.authority,mRecentsRoot);
  final ContentResolver resolver=mContext.getContentResolver();
  final PackageManager pm=mContext.getPackageManager();
  final Intent intent=new Intent(DocumentsContract.PROVIDER_INTERFACE);
  final List<ResolveInfo> providers=pm.queryIntentContentProviders(intent,0);
  for (  ResolveInfo info : providers) {
    handleDocumentsProvider(info.providerInfo);
  }
  final long delta=SystemClock.elapsedRealtime() - start;
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mTaskRoots.size() + "String_Node_Str"+ delta+ "String_Node_Str");
synchronized (mLock) {
    mFirstLoadDone=true;
    if (mBootCompletedResult != null) {
      mBootCompletedResult.finish();
      mBootCompletedResult=null;
    }
    mRoots=mTaskRoots;
    mStoppedAuthorities=mTaskStoppedAuthorities;
  }
  mFirstLoad.countDown();
  resolver.notifyChange(sNotificationUri,null,false);
  return null;
}
Program: 192314
Project: 192314
Buggy source:
/** 
 * Bring up requested provider and query for all active roots.
 */
private Collection<RootInfo> loadRootsForAuthority(ContentResolver resolver,String authority){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + authority);
synchronized (mObservedAuthorities) {
    if (mObservedAuthorities.add(authority)) {
      final Uri rootsUri=DocumentsContract.buildRootsUri(authority);
      mContext.getContentResolver().registerContentObserver(rootsUri,true,mObserver);
    }
  }
  final Uri rootsUri=DocumentsContract.buildRootsUri(authority);
  if (ENABLE_SYSTEM_CACHE) {
    final Bundle systemCache=resolver.getCache(rootsUri);
    if (systemCache != null) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str" + authority);
      return systemCache.getParcelableArrayList(TAG);
    }
  }
  final ArrayList<RootInfo> roots=new ArrayList<>();
  ContentProviderClient client=null;
  Cursor cursor=null;
  try {
    client=DocumentsApplication.acquireUnstableProviderOrThrow(resolver,authority);
    cursor=client.query(rootsUri,null,null,null,null);
    while (cursor.moveToNext()) {
      final RootInfo root=RootInfo.fromRootsCursor(authority,cursor);
      roots.add(root);
    }
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str" + authority + "String_Node_Str"+ e);
  }
 finally {
    IoUtils.closeQuietly(cursor);
    ContentProviderClient.releaseQuietly(client);
  }
  if (ENABLE_SYSTEM_CACHE) {
    final Bundle systemCache=new Bundle();
    systemCache.putParcelableArrayList(TAG,roots);
    resolver.putCache(rootsUri,systemCache);
  }
  return roots;
}

Fixed version (ground truth):
/** 
 * Bring up requested provider and query for all active roots.
 */
private Collection<RootInfo> loadRootsForAuthority(ContentResolver resolver,String authority,boolean forceRefresh){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + authority);
synchronized (mObservedAuthorities) {
    if (mObservedAuthorities.add(authority)) {
      final Uri rootsUri=DocumentsContract.buildRootsUri(authority);
      mContext.getContentResolver().registerContentObserver(rootsUri,true,mObserver);
    }
  }
  final Uri rootsUri=DocumentsContract.buildRootsUri(authority);
  if (!forceRefresh) {
    final Bundle systemCache=resolver.getCache(rootsUri);
    if (systemCache != null) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str" + authority);
      return systemCache.getParcelableArrayList(TAG);
    }
  }
  final ArrayList<RootInfo> roots=new ArrayList<>();
  ContentProviderClient client=null;
  Cursor cursor=null;
  try {
    client=DocumentsApplication.acquireUnstableProviderOrThrow(resolver,authority);
    cursor=client.query(rootsUri,null,null,null,null);
    while (cursor.moveToNext()) {
      final RootInfo root=RootInfo.fromRootsCursor(authority,cursor);
      roots.add(root);
    }
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str" + authority + "String_Node_Str"+ e);
  }
 finally {
    IoUtils.closeQuietly(cursor);
    ContentProviderClient.releaseQuietly(client);
  }
  final Bundle systemCache=new Bundle();
  systemCache.putParcelableArrayList(TAG,roots);
  resolver.putCache(rootsUri,systemCache);
  return roots;
}
Program: 192315
Project: 192315
Buggy source:
/** 
 * Only update roots belonging to given package name. Other roots will be copied from cached   {@link #mRoots} values.
 */
public UpdateTask(String filterPackage){
  mFilterPackage=filterPackage;
}

Fixed version (ground truth):
/** 
 * Force update roots belonging to given package name. Other roots will be copied from cached   {@link #mRoots} values.
 */
public UpdateTask(String forceRefreshPackage){
  mForceRefreshPackage=forceRefreshPackage;
}
Program: 192316
Project: 192316
Buggy source:
/** 
 * Return the requested   {@link RootInfo}, but only loading the roots for the requested authority. This is useful when we want to load fast without waiting for all the other roots to come back.
 */
public RootInfo getRootOneshot(String authority,String rootId){
synchronized (mLock) {
    RootInfo root=getRootLocked(authority,rootId);
    if (root == null) {
      mRoots.putAll(authority,loadRootsForAuthority(mContext.getContentResolver(),authority));
      root=getRootLocked(authority,rootId);
    }
    return root;
  }
}

Fixed version (ground truth):
/** 
 * Return the requested   {@link RootInfo}, but only loading the roots for the requested authority. This is useful when we want to load fast without waiting for all the other roots to come back.
 */
public RootInfo getRootOneshot(String authority,String rootId){
synchronized (mLock) {
    RootInfo root=getRootLocked(authority,rootId);
    if (root == null) {
      mRoots.putAll(authority,loadRootsForAuthority(mContext.getContentResolver(),authority,false));
      root=getRootLocked(authority,rootId);
    }
    return root;
  }
}
Program: 192317
Project: 192317
Buggy source:
/** 
 * Load roots from authorities that are in stopped state. Normal  {@link UpdateTask} passes ignore stopped applications.
 */
private void loadStoppedAuthorities(){
  final ContentResolver resolver=mContext.getContentResolver();
synchronized (mLock) {
    for (    String authority : mStoppedAuthorities) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str" + authority);
      mRoots.putAll(authority,loadRootsForAuthority(resolver,authority));
    }
    mStoppedAuthorities.clear();
  }
}

Fixed version (ground truth):
/** 
 * Load roots from authorities that are in stopped state. Normal  {@link UpdateTask} passes ignore stopped applications.
 */
private void loadStoppedAuthorities(){
  final ContentResolver resolver=mContext.getContentResolver();
synchronized (mLock) {
    for (    String authority : mStoppedAuthorities) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str" + authority);
      mRoots.putAll(authority,loadRootsForAuthority(resolver,authority,true));
    }
    mStoppedAuthorities.clear();
  }
}