nus-yam/ex-repair huggingface dataset:
Program: 195254
Project: 195254
Buggy source:
public void onServiceDisconnected(int profile){
switch (profile) {
case BluetoothProfile.A2DP:
synchronized (mConnectedDevices) {
synchronized (mA2dpAvrcpLock) {
        for (        Map.Entry<String,DeviceListSpec> entry : mConnectedDevices.entrySet()) {
          DeviceListSpec deviceSpec=entry.getValue();
          if (deviceSpec.mDeviceType == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
            makeA2dpDeviceUnavailableNow(deviceSpec.mDeviceAddress);
          }
        }
      }
    }
  break;
case BluetoothProfile.A2DP_SINK:
synchronized (mConnectedDevices) {
  for (  Map.Entry<String,DeviceListSpec> entry : mConnectedDevices.entrySet()) {
    DeviceListSpec deviceSpec=entry.getValue();
    if (deviceSpec.mDeviceType == AudioSystem.DEVICE_IN_BLUETOOTH_A2DP) {
      makeA2dpSrcUnavailable(deviceSpec.mDeviceAddress);
    }
  }
}
break;
case BluetoothProfile.HEADSET:
synchronized (mScoClients) {
mBluetoothHeadset=null;
}
break;
default :
break;
}
}

Fixed version (ground truth):
public void onServiceDisconnected(int profile){
  ArraySet<String> toRemove=null;
switch (profile) {
case BluetoothProfile.A2DP:
synchronized (mConnectedDevices) {
synchronized (mA2dpAvrcpLock) {
        for (int i=0; i < mConnectedDevices.size(); i++) {
          DeviceListSpec deviceSpec=mConnectedDevices.valueAt(i);
          if (deviceSpec.mDeviceType == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
            toRemove=toRemove != null ? toRemove : new ArraySet<String>();
            toRemove.add(deviceSpec.mDeviceAddress);
          }
        }
        if (toRemove != null) {
          for (int i=0; i < toRemove.size(); i++) {
            makeA2dpDeviceUnavailableNow(toRemove.valueAt(i));
          }
        }
      }
    }
  break;
case BluetoothProfile.A2DP_SINK:
synchronized (mConnectedDevices) {
  for (int i=0; i < mConnectedDevices.size(); i++) {
    DeviceListSpec deviceSpec=mConnectedDevices.valueAt(i);
    if (deviceSpec.mDeviceType == AudioSystem.DEVICE_IN_BLUETOOTH_A2DP) {
      toRemove=toRemove != null ? toRemove : new ArraySet<String>();
      toRemove.add(deviceSpec.mDeviceAddress);
    }
  }
  if (toRemove != null) {
    for (int i=0; i < toRemove.size(); i++) {
      makeA2dpSrcUnavailable(toRemove.valueAt(i));
    }
  }
}
break;
case BluetoothProfile.HEADSET:
synchronized (mScoClients) {
mBluetoothHeadset=null;
}
break;
default :
break;
}
}
Program: 195255
Project: 195255
Buggy source:
private int checkSendBecomingNoisyIntent(int device,int state){
  int delay=0;
  if ((state == 0) && ((device & mBecomingNoisyIntentDevices) != 0)) {
    int devices=0;
    for (    String key : mConnectedDevices.keySet()) {
      int dev=mConnectedDevices.get(key).mDeviceType;
      if (((dev & AudioSystem.DEVICE_BIT_IN) == 0) && ((dev & mBecomingNoisyIntentDevices) != 0)) {
        devices|=dev;
      }
    }
    if (devices == device) {
      sendMsg(mAudioHandler,MSG_BROADCAST_AUDIO_BECOMING_NOISY,SENDMSG_REPLACE,0,0,null,0);
      delay=1000;
    }
  }
  if (mAudioHandler.hasMessages(MSG_SET_A2DP_SRC_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_WIRED_DEVICE_CONNECTION_STATE)) {
synchronized (mLastDeviceConnectMsgTime) {
      long time=SystemClock.uptimeMillis();
      if (mLastDeviceConnectMsgTime > time) {
        delay=(int)(mLastDeviceConnectMsgTime - time) + 30;
      }
    }
  }
  return delay;
}

Fixed version (ground truth):
private int checkSendBecomingNoisyIntent(int device,int state){
  int delay=0;
  if ((state == 0) && ((device & mBecomingNoisyIntentDevices) != 0)) {
    int devices=0;
    for (int i=0; i < mConnectedDevices.size(); i++) {
      int dev=mConnectedDevices.valueAt(i).mDeviceType;
      if (((dev & AudioSystem.DEVICE_BIT_IN) == 0) && ((dev & mBecomingNoisyIntentDevices) != 0)) {
        devices|=dev;
      }
    }
    if (devices == device) {
      sendMsg(mAudioHandler,MSG_BROADCAST_AUDIO_BECOMING_NOISY,SENDMSG_REPLACE,0,0,null,0);
      delay=1000;
    }
  }
  if (mAudioHandler.hasMessages(MSG_SET_A2DP_SRC_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_WIRED_DEVICE_CONNECTION_STATE)) {
synchronized (mLastDeviceConnectMsgTime) {
      long time=SystemClock.uptimeMillis();
      if (mLastDeviceConnectMsgTime > time) {
        delay=(int)(mLastDeviceConnectMsgTime - time) + 30;
      }
    }
  }
  return delay;
}
Program: 195257
Project: 195257
Buggy source:
public void onServiceDisconnected(int profile){
switch (profile) {
case BluetoothProfile.A2DP:
synchronized (mConnectedDevices) {
synchronized (mA2dpAvrcpLock) {
        for (        Map.Entry<String,DeviceListSpec> entry : mConnectedDevices.entrySet()) {
          DeviceListSpec deviceSpec=entry.getValue();
          if (deviceSpec.mDeviceType == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
            makeA2dpDeviceUnavailableNow(deviceSpec.mDeviceAddress);
          }
        }
      }
    }
  break;
case BluetoothProfile.A2DP_SINK:
synchronized (mConnectedDevices) {
  for (  Map.Entry<String,DeviceListSpec> entry : mConnectedDevices.entrySet()) {
    DeviceListSpec deviceSpec=entry.getValue();
    if (deviceSpec.mDeviceType == AudioSystem.DEVICE_IN_BLUETOOTH_A2DP) {
      makeA2dpSrcUnavailable(deviceSpec.mDeviceAddress);
    }
  }
}
break;
case BluetoothProfile.HEADSET:
synchronized (mScoClients) {
mBluetoothHeadset=null;
}
break;
default :
break;
}
}

Fixed version (ground truth):
public void onServiceDisconnected(int profile){
  ArraySet<String> toRemove=null;
switch (profile) {
case BluetoothProfile.A2DP:
synchronized (mConnectedDevices) {
synchronized (mA2dpAvrcpLock) {
        for (int i=0; i < mConnectedDevices.size(); i++) {
          DeviceListSpec deviceSpec=mConnectedDevices.valueAt(i);
          if (deviceSpec.mDeviceType == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
            toRemove=toRemove != null ? toRemove : new ArraySet<String>();
            toRemove.add(deviceSpec.mDeviceAddress);
          }
        }
        if (toRemove != null) {
          for (int i=0; i < toRemove.size(); i++) {
            makeA2dpDeviceUnavailableNow(toRemove.valueAt(i));
          }
        }
      }
    }
  break;
case BluetoothProfile.A2DP_SINK:
synchronized (mConnectedDevices) {
  for (int i=0; i < mConnectedDevices.size(); i++) {
    DeviceListSpec deviceSpec=mConnectedDevices.valueAt(i);
    if (deviceSpec.mDeviceType == AudioSystem.DEVICE_IN_BLUETOOTH_A2DP) {
      toRemove=toRemove != null ? toRemove : new ArraySet<String>();
      toRemove.add(deviceSpec.mDeviceAddress);
    }
  }
  if (toRemove != null) {
    for (int i=0; i < toRemove.size(); i++) {
      makeA2dpSrcUnavailable(toRemove.valueAt(i));
    }
  }
}
break;
case BluetoothProfile.HEADSET:
synchronized (mScoClients) {
mBluetoothHeadset=null;
}
break;
default :
break;
}
}
Program: 195258
Project: 195258
Buggy source:
private int checkSendBecomingNoisyIntent(int device,int state){
  int delay=0;
  if ((state == 0) && ((device & mBecomingNoisyIntentDevices) != 0)) {
    int devices=0;
    for (    String key : mConnectedDevices.keySet()) {
      int dev=mConnectedDevices.get(key).mDeviceType;
      if (((dev & AudioSystem.DEVICE_BIT_IN) == 0) && ((dev & mBecomingNoisyIntentDevices) != 0)) {
        devices|=dev;
      }
    }
    if (devices == device) {
      sendMsg(mAudioHandler,MSG_BROADCAST_AUDIO_BECOMING_NOISY,SENDMSG_REPLACE,0,0,null,0);
      delay=1000;
    }
  }
  if (mAudioHandler.hasMessages(MSG_SET_A2DP_SRC_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_WIRED_DEVICE_CONNECTION_STATE)) {
synchronized (mLastDeviceConnectMsgTime) {
      long time=SystemClock.uptimeMillis();
      if (mLastDeviceConnectMsgTime > time) {
        delay=(int)(mLastDeviceConnectMsgTime - time) + 30;
      }
    }
  }
  return delay;
}

Fixed version (ground truth):
private int checkSendBecomingNoisyIntent(int device,int state){
  int delay=0;
  if ((state == 0) && ((device & mBecomingNoisyIntentDevices) != 0)) {
    int devices=0;
    for (int i=0; i < mConnectedDevices.size(); i++) {
      int dev=mConnectedDevices.valueAt(i).mDeviceType;
      if (((dev & AudioSystem.DEVICE_BIT_IN) == 0) && ((dev & mBecomingNoisyIntentDevices) != 0)) {
        devices|=dev;
      }
    }
    if (devices == device) {
      sendMsg(mAudioHandler,MSG_BROADCAST_AUDIO_BECOMING_NOISY,SENDMSG_REPLACE,0,0,null,0);
      delay=1000;
    }
  }
  if (mAudioHandler.hasMessages(MSG_SET_A2DP_SRC_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE) || mAudioHandler.hasMessages(MSG_SET_WIRED_DEVICE_CONNECTION_STATE)) {
synchronized (mLastDeviceConnectMsgTime) {
      long time=SystemClock.uptimeMillis();
      if (mLastDeviceConnectMsgTime > time) {
        delay=(int)(mLastDeviceConnectMsgTime - time) + 30;
      }
    }
  }
  return delay;
}
Program: 195260
Project: 195260
Buggy source:
void restorePendingWhileIdleAlarmsLocked(){
  final long nowElapsed=SystemClock.elapsedRealtime();
  for (int i=mPendingWhileIdleAlarms.size() - 1; i >= 0 && mPendingIdleUntil != null; i--) {
    Alarm a=mPendingWhileIdleAlarms.remove(i);
    reAddAlarmLocked(a,nowElapsed,false);
  }
  rescheduleKernelAlarmsLocked();
  updateNextAlarmClockLocked();
}

Fixed version (ground truth):
void restorePendingWhileIdleAlarmsLocked(){
  final long nowElapsed=SystemClock.elapsedRealtime();
  for (int i=mPendingWhileIdleAlarms.size() - 1; i >= 0 && mPendingIdleUntil == null; i--) {
    Alarm a=mPendingWhileIdleAlarms.remove(i);
    reAddAlarmLocked(a,nowElapsed,false);
  }
  rescheduleKernelAlarmsLocked();
  updateNextAlarmClockLocked();
  try {
    mTimeTickSender.send();
  }
 catch (  PendingIntent.CanceledException e) {
  }
}
Program: 195261
Project: 195261
Buggy source:
void restorePendingWhileIdleAlarmsLocked(){
  final long nowElapsed=SystemClock.elapsedRealtime();
  for (int i=mPendingWhileIdleAlarms.size() - 1; i >= 0 && mPendingIdleUntil != null; i--) {
    Alarm a=mPendingWhileIdleAlarms.remove(i);
    reAddAlarmLocked(a,nowElapsed,false);
  }
  rescheduleKernelAlarmsLocked();
  updateNextAlarmClockLocked();
}

Fixed version (ground truth):
void restorePendingWhileIdleAlarmsLocked(){
  final long nowElapsed=SystemClock.elapsedRealtime();
  for (int i=mPendingWhileIdleAlarms.size() - 1; i >= 0 && mPendingIdleUntil == null; i--) {
    Alarm a=mPendingWhileIdleAlarms.remove(i);
    reAddAlarmLocked(a,nowElapsed,false);
  }
  rescheduleKernelAlarmsLocked();
  updateNextAlarmClockLocked();
  try {
    mTimeTickSender.send();
  }
 catch (  PendingIntent.CanceledException e) {
  }
}
Program: 195262
Project: 195262
Buggy source:
/** 
 * Initializes a new floating toolbar popup.
 * @param parent  A parent view to get the {@link android.view.View#getWindowToken()} tokenfrom.
 */
public FloatingToolbarPopup(View parent){
  mParent=Preconditions.checkNotNull(parent);
  mContentContainer=createContentContainer(parent.getContext());
  mPopupWindow=createPopupWindow(mContentContainer);
  mShowAnimation=createGrowFadeInFromBottom(mContentContainer);
  mDismissAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
      mContentContainer.removeAllViews();
    }
  }
);
  mHideAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
    }
  }
);
  mPopupWindow.getContentView().getRootView().getViewTreeObserver().addOnComputeInternalInsetsListener(new ViewTreeObserver.OnComputeInternalInsetsListener(){
    public void onComputeInternalInsets(    ViewTreeObserver.InternalInsetsInfo info){
      info.contentInsets.setEmpty();
      info.visibleInsets.setEmpty();
      info.touchableRegion.set(mTouchableRegion);
      info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    }
  }
);
  mMarginHorizontal=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
  mMarginVertical=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
}

Fixed version (ground truth):
/** 
 * Initializes a new floating toolbar popup.
 * @param parent  A parent view to get the {@link android.view.View#getWindowToken()} tokenfrom.
 */
public FloatingToolbarPopup(View parent){
  mParent=Preconditions.checkNotNull(parent);
  mContentContainer=createContentContainer(parent.getContext());
  mPopupWindow=createPopupWindow(mContentContainer);
  mShowAnimation=createGrowFadeInFromBottom(mContentContainer);
  mDismissAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
      mContentContainer.removeAllViews();
    }
  }
);
  mHideAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
    }
  }
);
  mMarginHorizontal=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
  mMarginVertical=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
}
Program: 195263
Project: 195263
Buggy source:
/** 
 * Shows this popup at the specified coordinates. The specified coordinates may be adjusted to make sure the popup is entirely on-screen.
 */
public void show(int x,int y){
  if (isShowing()) {
    return;
  }
  mHidden=false;
  mDismissed=false;
  cancelAllAnimations();
  if (mContentContainer.getChildCount() == 0) {
    setMainPanelAsContent();
  }
  preparePopupContent();
  mContentContainer.setAlpha(0);
  mPopupWindow.showAtLocation(mParent,Gravity.NO_GRAVITY,x,y);
  runShowAnimation();
}

Fixed version (ground truth):
/** 
 * Shows this popup at the specified coordinates. The specified coordinates may be adjusted to make sure the popup is entirely on-screen.
 */
public void show(int x,int y){
  if (isShowing()) {
    return;
  }
  mHidden=false;
  mDismissed=false;
  cancelAllAnimations();
  if (mContentContainer.getChildCount() == 0) {
    setMainPanelAsContent();
  }
  preparePopupContent();
  mContentContainer.setAlpha(0);
  mPopupWindow.showAtLocation(mParent,Gravity.NO_GRAVITY,x,y);
  setTouchableSurfaceInsetsComputer();
  runShowAnimation();
}
Program: 195264
Project: 195264
Buggy source:
/** 
 * Initializes a new floating toolbar popup.
 * @param parent  A parent view to get the {@link android.view.View#getWindowToken()} tokenfrom.
 */
public FloatingToolbarPopup(View parent){
  mParent=Preconditions.checkNotNull(parent);
  mContentContainer=createContentContainer(parent.getContext());
  mPopupWindow=createPopupWindow(mContentContainer);
  mShowAnimation=createGrowFadeInFromBottom(mContentContainer);
  mDismissAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
      mContentContainer.removeAllViews();
    }
  }
);
  mHideAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
    }
  }
);
  mPopupWindow.getContentView().getRootView().getViewTreeObserver().addOnComputeInternalInsetsListener(new ViewTreeObserver.OnComputeInternalInsetsListener(){
    public void onComputeInternalInsets(    ViewTreeObserver.InternalInsetsInfo info){
      info.contentInsets.setEmpty();
      info.visibleInsets.setEmpty();
      info.touchableRegion.set(mTouchableRegion);
      info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    }
  }
);
  mMarginHorizontal=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
  mMarginVertical=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
}

Fixed version (ground truth):
/** 
 * Initializes a new floating toolbar popup.
 * @param parent  A parent view to get the {@link android.view.View#getWindowToken()} tokenfrom.
 */
public FloatingToolbarPopup(View parent){
  mParent=Preconditions.checkNotNull(parent);
  mContentContainer=createContentContainer(parent.getContext());
  mPopupWindow=createPopupWindow(mContentContainer);
  mShowAnimation=createGrowFadeInFromBottom(mContentContainer);
  mDismissAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
      mContentContainer.removeAllViews();
    }
  }
);
  mHideAnimation=createShrinkFadeOutFromBottomAnimation(mContentContainer,new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      mPopupWindow.dismiss();
    }
  }
);
  mMarginHorizontal=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
  mMarginVertical=parent.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
}
Program: 195265
Project: 195265
Buggy source:
/** 
 * Shows this popup at the specified coordinates. The specified coordinates may be adjusted to make sure the popup is entirely on-screen.
 */
public void show(int x,int y){
  if (isShowing()) {
    return;
  }
  mHidden=false;
  mDismissed=false;
  cancelAllAnimations();
  if (mContentContainer.getChildCount() == 0) {
    setMainPanelAsContent();
  }
  preparePopupContent();
  mContentContainer.setAlpha(0);
  mPopupWindow.showAtLocation(mParent,Gravity.NO_GRAVITY,x,y);
  runShowAnimation();
}

Fixed version (ground truth):
/** 
 * Shows this popup at the specified coordinates. The specified coordinates may be adjusted to make sure the popup is entirely on-screen.
 */
public void show(int x,int y){
  if (isShowing()) {
    return;
  }
  mHidden=false;
  mDismissed=false;
  cancelAllAnimations();
  if (mContentContainer.getChildCount() == 0) {
    setMainPanelAsContent();
  }
  preparePopupContent();
  mContentContainer.setAlpha(0);
  mPopupWindow.showAtLocation(mParent,Gravity.NO_GRAVITY,x,y);
  setTouchableSurfaceInsetsComputer();
  runShowAnimation();
}
Program: 195266
Project: 195266
Buggy source:
@Override public int checkRtl(CharSequence cs,int start,int count){
  boolean haveUnlookedFor=false;
  for (int i=start, e=start + count; i < e; ++i) {
switch (isRtlText(Character.getDirectionality(cs.charAt(i)))) {
case STATE_TRUE:
      if (mLookForRtl) {
        return STATE_TRUE;
      }
    haveUnlookedFor=true;
  break;
case STATE_FALSE:
if (!mLookForRtl) {
  return STATE_FALSE;
}
haveUnlookedFor=true;
break;
default :
break;
}
}
if (haveUnlookedFor) {
return mLookForRtl ? STATE_FALSE : STATE_TRUE;
}
return STATE_UNKNOWN;
}

Fixed version (ground truth):
@Override public int checkRtl(CharSequence cs,int start,int count){
  boolean haveUnlookedFor=false;
  int openIsolateCount=0;
  for (int cp, i=start, end=start + count; i < end; i+=Character.charCount(cp)) {
    cp=Character.codePointAt(cs,i);
    if (0x2066 <= cp && cp <= 0x2068) {
      openIsolateCount+=1;
    }
 else     if (cp == 0x2069) {
      if (openIsolateCount > 0)       openIsolateCount-=1;
    }
 else     if (openIsolateCount == 0) {
switch (isRtlCodePoint(cp)) {
case STATE_TRUE:
        if (mLookForRtl) {
          return STATE_TRUE;
        }
      haveUnlookedFor=true;
    break;
case STATE_FALSE:
  if (!mLookForRtl) {
    return STATE_FALSE;
  }
haveUnlookedFor=true;
break;
default :
break;
}
}
}
if (haveUnlookedFor) {
return mLookForRtl ? STATE_FALSE : STATE_TRUE;
}
return STATE_UNKNOWN;
}
Program: 195267
Project: 195267
Buggy source:
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  boolean inExpansionState=isExpanded();
  int maxContentHeight;
  if (mIsHeadsUp) {
    if (inExpansionState) {
      maxContentHeight=Math.max(mMaxExpandHeight,mHeadsUpHeight);
    }
 else {
      maxContentHeight=Math.max(mRowMinHeight,mHeadsUpHeight);
    }
  }
 else   if ((!inExpansionState && !mChildrenExpanded) || mShowingPublicForIntrinsicHeight) {
    maxContentHeight=mRowMinHeight;
  }
 else   if (mChildrenExpanded) {
    maxContentHeight=mChildrenContainer.getIntrinsicHeight();
  }
 else {
    maxContentHeight=getMaxExpandHeight();
  }
  return maxContentHeight + getBottomDecorHeight();
}

Fixed version (ground truth):
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  boolean inExpansionState=isExpanded();
  int maxContentHeight;
  if (mSensitive && mHideSensitiveForIntrinsicHeight) {
    return mRowMinHeight;
  }
 else   if (mIsHeadsUp) {
    if (inExpansionState) {
      maxContentHeight=Math.max(mMaxExpandHeight,mHeadsUpHeight);
    }
 else {
      maxContentHeight=Math.max(mRowMinHeight,mHeadsUpHeight);
    }
  }
 else   if ((!inExpansionState && !mChildrenExpanded)) {
    maxContentHeight=mRowMinHeight;
  }
 else   if (mChildrenExpanded) {
    maxContentHeight=mChildrenContainer.getIntrinsicHeight();
  }
 else {
    maxContentHeight=getMaxExpandHeight();
  }
  return maxContentHeight + getBottomDecorHeight();
}
Program: 195268
Project: 195268
Buggy source:
public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive){
  mShowingPublicForIntrinsicHeight=mSensitive && hideSensitive;
}

Fixed version (ground truth):
public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive){
  mHideSensitiveForIntrinsicHeight=hideSensitive;
}
Program: 195269
Project: 195269
Buggy source:
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  boolean inExpansionState=isExpanded();
  int maxContentHeight;
  if (mIsHeadsUp) {
    if (inExpansionState) {
      maxContentHeight=Math.max(mMaxExpandHeight,mHeadsUpHeight);
    }
 else {
      maxContentHeight=Math.max(mRowMinHeight,mHeadsUpHeight);
    }
  }
 else   if ((!inExpansionState && !mChildrenExpanded) || mShowingPublicForIntrinsicHeight) {
    maxContentHeight=mRowMinHeight;
  }
 else   if (mChildrenExpanded) {
    maxContentHeight=mChildrenContainer.getIntrinsicHeight();
  }
 else {
    maxContentHeight=getMaxExpandHeight();
  }
  return maxContentHeight + getBottomDecorHeight();
}

Fixed version (ground truth):
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  boolean inExpansionState=isExpanded();
  int maxContentHeight;
  if (mSensitive && mHideSensitiveForIntrinsicHeight) {
    return mRowMinHeight;
  }
 else   if (mIsHeadsUp) {
    if (inExpansionState) {
      maxContentHeight=Math.max(mMaxExpandHeight,mHeadsUpHeight);
    }
 else {
      maxContentHeight=Math.max(mRowMinHeight,mHeadsUpHeight);
    }
  }
 else   if ((!inExpansionState && !mChildrenExpanded)) {
    maxContentHeight=mRowMinHeight;
  }
 else   if (mChildrenExpanded) {
    maxContentHeight=mChildrenContainer.getIntrinsicHeight();
  }
 else {
    maxContentHeight=getMaxExpandHeight();
  }
  return maxContentHeight + getBottomDecorHeight();
}
Program: 195270
Project: 195270
Buggy source:
public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive){
  mShowingPublicForIntrinsicHeight=mSensitive && hideSensitive;
}

Fixed version (ground truth):
public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive){
  mHideSensitiveForIntrinsicHeight=hideSensitive;
}
Program: 195271
Project: 195271
Buggy source:
/** 
 * Handles SET_OCCLUDED message sent by setOccluded()
 */
private void handleSetOccluded(boolean isOccluded){
synchronized (KeyguardViewMediator.this) {
    if (mOccluded != isOccluded) {
      mOccluded=isOccluded;
      mStatusBarKeyguardViewManager.setOccluded(isOccluded);
      updateActivityLockScreenState();
      adjustStatusBarLocked();
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles SET_OCCLUDED message sent by setOccluded()
 */
private void handleSetOccluded(boolean isOccluded){
synchronized (KeyguardViewMediator.this) {
    if (mHiding && isOccluded) {
      startKeyguardExitAnimation(0,0);
    }
    if (mOccluded != isOccluded) {
      mOccluded=isOccluded;
      mStatusBarKeyguardViewManager.setOccluded(isOccluded);
      updateActivityLockScreenState();
      adjustStatusBarLocked();
    }
  }
}
Program: 195272
Project: 195272
Buggy source:
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  mKeyguardService=new KeyguardServiceWrapper(mContext,IKeyguardService.Stub.asInterface(service));
  if (mKeyguardState.systemIsReady) {
    mKeyguardService.onSystemReady();
    mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(mShowListenerWhenConnect));
    mShowListenerWhenConnect=null;
  }
  if (mKeyguardState.bootCompleted) {
    mKeyguardService.onBootCompleted();
  }
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  mKeyguardService=new KeyguardServiceWrapper(mContext,IKeyguardService.Stub.asInterface(service));
  if (mKeyguardState.systemIsReady) {
    mKeyguardService.onSystemReady();
    mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(mShowListenerWhenConnect));
    mShowListenerWhenConnect=null;
  }
  if (mKeyguardState.bootCompleted) {
    mKeyguardService.onBootCompleted();
  }
  if (mKeyguardState.occluded) {
    mKeyguardService.setOccluded(mKeyguardState.occluded);
  }
}
Program: 195273
Project: 195273
Buggy source:
/** 
 * Handles SET_OCCLUDED message sent by setOccluded()
 */
private void handleSetOccluded(boolean isOccluded){
synchronized (KeyguardViewMediator.this) {
    if (mOccluded != isOccluded) {
      mOccluded=isOccluded;
      mStatusBarKeyguardViewManager.setOccluded(isOccluded);
      updateActivityLockScreenState();
      adjustStatusBarLocked();
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles SET_OCCLUDED message sent by setOccluded()
 */
private void handleSetOccluded(boolean isOccluded){
synchronized (KeyguardViewMediator.this) {
    if (mHiding && isOccluded) {
      startKeyguardExitAnimation(0,0);
    }
    if (mOccluded != isOccluded) {
      mOccluded=isOccluded;
      mStatusBarKeyguardViewManager.setOccluded(isOccluded);
      updateActivityLockScreenState();
      adjustStatusBarLocked();
    }
  }
}
Program: 195274
Project: 195274
Buggy source:
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  mKeyguardService=new KeyguardServiceWrapper(mContext,IKeyguardService.Stub.asInterface(service));
  if (mKeyguardState.systemIsReady) {
    mKeyguardService.onSystemReady();
    mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(mShowListenerWhenConnect));
    mShowListenerWhenConnect=null;
  }
  if (mKeyguardState.bootCompleted) {
    mKeyguardService.onBootCompleted();
  }
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  mKeyguardService=new KeyguardServiceWrapper(mContext,IKeyguardService.Stub.asInterface(service));
  if (mKeyguardState.systemIsReady) {
    mKeyguardService.onSystemReady();
    mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(mShowListenerWhenConnect));
    mShowListenerWhenConnect=null;
  }
  if (mKeyguardState.bootCompleted) {
    mKeyguardService.onBootCompleted();
  }
  if (mKeyguardState.occluded) {
    mKeyguardService.setOccluded(mKeyguardState.occluded);
  }
}
Program: 195275
Project: 195275
Buggy source:
@Override public void finish(IBinder token){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return;
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.finishLocked(callingPid,callingUid,token);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public void finish(IBinder token){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return;
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.finishLocked(token);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195276
Project: 195276
Buggy source:
@Override public boolean showSessionFromSession(IBinder token,Bundle sessionArgs,int flags){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return false;
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      return mImpl.showSessionLocked(callingPid,callingUid,sessionArgs,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public boolean showSessionFromSession(IBinder token,Bundle sessionArgs,int flags){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return false;
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      return mImpl.showSessionLocked(sessionArgs,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195277
Project: 195277
Buggy source:
@Override public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback){
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
      return;
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(callingPid,callingUid,new Bundle(),VoiceInteractionService.START_SOURCE_ASSIST_GESTURE | VoiceInteractionService.START_WITH_ASSIST | VoiceInteractionService.START_WITH_SCREENSHOT,showCallback);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback){
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
      return;
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(new Bundle(),VoiceInteractionService.START_SOURCE_ASSIST_GESTURE | VoiceInteractionService.START_WITH_ASSIST | VoiceInteractionService.START_WITH_SCREENSHOT,showCallback);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195278
Project: 195278
Buggy source:
@Override public void showSession(IVoiceInteractionService service,Bundle args,int flags){
synchronized (this) {
    if (mImpl == null || mImpl.mService == null || service.asBinder() != mImpl.mService.asBinder()) {
      throw new SecurityException("String_Node_Str");
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(callingPid,callingUid,args,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public void showSession(IVoiceInteractionService service,Bundle args,int flags){
synchronized (this) {
    if (mImpl == null || mImpl.mService == null || service.asBinder() != mImpl.mService.asBinder()) {
      throw new SecurityException("String_Node_Str");
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(args,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195279
Project: 195279
Buggy source:
public void finishLocked(int callingPid,int callingUid,IBinder token){
  if (mActiveSession == null || token != mActiveSession.mToken) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  mActiveSession.cancel();
  mActiveSession=null;
}

Fixed version (ground truth):
public void finishLocked(IBinder token){
  if (mActiveSession == null || token != mActiveSession.mToken) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  mActiveSession.cancel();
  mActiveSession=null;
}
Program: 195280
Project: 195280
Buggy source:
public boolean showSessionLocked(int callingPid,int callingUid,Bundle args,int flags,IVoiceInteractionSessionShowCallback showCallback){
  if (mActiveSession == null) {
    mActiveSession=new VoiceInteractionSessionConnection(mLock,mSessionComponentName,mUser,mContext,this,callingPid,callingUid);
  }
  return mActiveSession.showLocked(args,flags,showCallback);
}

Fixed version (ground truth):
public boolean showSessionLocked(Bundle args,int flags,IVoiceInteractionSessionShowCallback showCallback){
  if (mActiveSession == null) {
    mActiveSession=new VoiceInteractionSessionConnection(mLock,mSessionComponentName,mUser,mContext,this,mInfo.getServiceInfo().applicationInfo.uid);
  }
  return mActiveSession.showLocked(args,flags,showCallback);
}
Program: 195281
Project: 195281
Buggy source:
@Override public void sessionConnectionGone(VoiceInteractionSessionConnection connection){
synchronized (mLock) {
    finishLocked(connection.mCallingPid,connection.mCallingUid,connection.mToken);
  }
}

Fixed version (ground truth):
@Override public void sessionConnectionGone(VoiceInteractionSessionConnection connection){
synchronized (mLock) {
    finishLocked(connection.mToken);
  }
}
Program: 195282
Project: 195282
Buggy source:
public VoiceInteractionSessionConnection(Object lock,ComponentName component,int user,Context context,Callback callback,int callingPid,int callingUid){
  mLock=lock;
  mSessionComponentName=component;
  mUser=user;
  mContext=context;
  mCallback=callback;
  mCallingPid=callingPid;
  mCallingUid=callingUid;
  mAm=ActivityManagerNative.getDefault();
  mIWindowManager=IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
  mAppOps=context.getSystemService(AppOpsManager.class);
  IBinder permOwner=null;
  try {
    permOwner=mAm.newUriPermissionOwner("String_Node_Str" + component.flattenToShortString());
  }
 catch (  RemoteException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
  }
  mPermissionOwner=permOwner;
  mBindIntent=new Intent(VoiceInteractionService.SERVICE_INTERFACE);
  mBindIntent.setComponent(mSessionComponentName);
  mBound=mContext.bindServiceAsUser(mBindIntent,this,Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY | Context.BIND_ALLOW_OOM_MANAGEMENT,new UserHandle(mUser));
  if (mBound) {
    try {
      mIWindowManager.addWindowToken(mToken,WindowManager.LayoutParams.TYPE_VOICE_INTERACTION);
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
 else {
    Slog.w(TAG,"String_Node_Str" + mSessionComponentName);
  }
}

Fixed version (ground truth):
public VoiceInteractionSessionConnection(Object lock,ComponentName component,int user,Context context,Callback callback,int callingUid){
  mLock=lock;
  mSessionComponentName=component;
  mUser=user;
  mContext=context;
  mCallback=callback;
  mCallingUid=callingUid;
  mAm=ActivityManagerNative.getDefault();
  mIWindowManager=IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
  mAppOps=context.getSystemService(AppOpsManager.class);
  IBinder permOwner=null;
  try {
    permOwner=mAm.newUriPermissionOwner("String_Node_Str" + component.flattenToShortString());
  }
 catch (  RemoteException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
  }
  mPermissionOwner=permOwner;
  mBindIntent=new Intent(VoiceInteractionService.SERVICE_INTERFACE);
  mBindIntent.setComponent(mSessionComponentName);
  mBound=mContext.bindServiceAsUser(mBindIntent,this,Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY | Context.BIND_ALLOW_OOM_MANAGEMENT,new UserHandle(mUser));
  if (mBound) {
    try {
      mIWindowManager.addWindowToken(mToken,WindowManager.LayoutParams.TYPE_VOICE_INTERACTION);
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
 else {
    Slog.w(TAG,"String_Node_Str" + mSessionComponentName);
  }
}
Program: 195283
Project: 195283
Buggy source:
@Override public void finish(IBinder token){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return;
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.finishLocked(callingPid,callingUid,token);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public void finish(IBinder token){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return;
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.finishLocked(token);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195284
Project: 195284
Buggy source:
@Override public boolean showSessionFromSession(IBinder token,Bundle sessionArgs,int flags){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return false;
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      return mImpl.showSessionLocked(callingPid,callingUid,sessionArgs,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public boolean showSessionFromSession(IBinder token,Bundle sessionArgs,int flags){
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str");
      return false;
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      return mImpl.showSessionLocked(sessionArgs,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195285
Project: 195285
Buggy source:
@Override public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback){
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
      return;
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(callingPid,callingUid,new Bundle(),VoiceInteractionService.START_SOURCE_ASSIST_GESTURE | VoiceInteractionService.START_WITH_ASSIST | VoiceInteractionService.START_WITH_SCREENSHOT,showCallback);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback){
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    if (mImpl == null) {
      Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
      return;
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(new Bundle(),VoiceInteractionService.START_SOURCE_ASSIST_GESTURE | VoiceInteractionService.START_WITH_ASSIST | VoiceInteractionService.START_WITH_SCREENSHOT,showCallback);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195286
Project: 195286
Buggy source:
@Override public void showSession(IVoiceInteractionService service,Bundle args,int flags){
synchronized (this) {
    if (mImpl == null || mImpl.mService == null || service.asBinder() != mImpl.mService.asBinder()) {
      throw new SecurityException("String_Node_Str");
    }
    final int callingPid=Binder.getCallingPid();
    final int callingUid=Binder.getCallingUid();
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(callingPid,callingUid,args,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}

Fixed version (ground truth):
@Override public void showSession(IVoiceInteractionService service,Bundle args,int flags){
synchronized (this) {
    if (mImpl == null || mImpl.mService == null || service.asBinder() != mImpl.mService.asBinder()) {
      throw new SecurityException("String_Node_Str");
    }
    final long caller=Binder.clearCallingIdentity();
    try {
      mImpl.showSessionLocked(args,flags,null);
    }
  finally {
      Binder.restoreCallingIdentity(caller);
    }
  }
}
Program: 195287
Project: 195287
Buggy source:
public void finishLocked(int callingPid,int callingUid,IBinder token){
  if (mActiveSession == null || token != mActiveSession.mToken) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  mActiveSession.cancel();
  mActiveSession=null;
}

Fixed version (ground truth):
public void finishLocked(IBinder token){
  if (mActiveSession == null || token != mActiveSession.mToken) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  mActiveSession.cancel();
  mActiveSession=null;
}
Program: 195288
Project: 195288
Buggy source:
public boolean showSessionLocked(int callingPid,int callingUid,Bundle args,int flags,IVoiceInteractionSessionShowCallback showCallback){
  if (mActiveSession == null) {
    mActiveSession=new VoiceInteractionSessionConnection(mLock,mSessionComponentName,mUser,mContext,this,callingPid,callingUid);
  }
  return mActiveSession.showLocked(args,flags,showCallback);
}

Fixed version (ground truth):
public boolean showSessionLocked(Bundle args,int flags,IVoiceInteractionSessionShowCallback showCallback){
  if (mActiveSession == null) {
    mActiveSession=new VoiceInteractionSessionConnection(mLock,mSessionComponentName,mUser,mContext,this,mInfo.getServiceInfo().applicationInfo.uid);
  }
  return mActiveSession.showLocked(args,flags,showCallback);
}
Program: 195289
Project: 195289
Buggy source:
@Override public void sessionConnectionGone(VoiceInteractionSessionConnection connection){
synchronized (mLock) {
    finishLocked(connection.mCallingPid,connection.mCallingUid,connection.mToken);
  }
}

Fixed version (ground truth):
@Override public void sessionConnectionGone(VoiceInteractionSessionConnection connection){
synchronized (mLock) {
    finishLocked(connection.mToken);
  }
}
Program: 195290
Project: 195290
Buggy source:
public VoiceInteractionSessionConnection(Object lock,ComponentName component,int user,Context context,Callback callback,int callingPid,int callingUid){
  mLock=lock;
  mSessionComponentName=component;
  mUser=user;
  mContext=context;
  mCallback=callback;
  mCallingPid=callingPid;
  mCallingUid=callingUid;
  mAm=ActivityManagerNative.getDefault();
  mIWindowManager=IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
  mAppOps=context.getSystemService(AppOpsManager.class);
  IBinder permOwner=null;
  try {
    permOwner=mAm.newUriPermissionOwner("String_Node_Str" + component.flattenToShortString());
  }
 catch (  RemoteException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
  }
  mPermissionOwner=permOwner;
  mBindIntent=new Intent(VoiceInteractionService.SERVICE_INTERFACE);
  mBindIntent.setComponent(mSessionComponentName);
  mBound=mContext.bindServiceAsUser(mBindIntent,this,Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY | Context.BIND_ALLOW_OOM_MANAGEMENT,new UserHandle(mUser));
  if (mBound) {
    try {
      mIWindowManager.addWindowToken(mToken,WindowManager.LayoutParams.TYPE_VOICE_INTERACTION);
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
 else {
    Slog.w(TAG,"String_Node_Str" + mSessionComponentName);
  }
}

Fixed version (ground truth):
public VoiceInteractionSessionConnection(Object lock,ComponentName component,int user,Context context,Callback callback,int callingUid){
  mLock=lock;
  mSessionComponentName=component;
  mUser=user;
  mContext=context;
  mCallback=callback;
  mCallingUid=callingUid;
  mAm=ActivityManagerNative.getDefault();
  mIWindowManager=IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
  mAppOps=context.getSystemService(AppOpsManager.class);
  IBinder permOwner=null;
  try {
    permOwner=mAm.newUriPermissionOwner("String_Node_Str" + component.flattenToShortString());
  }
 catch (  RemoteException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
  }
  mPermissionOwner=permOwner;
  mBindIntent=new Intent(VoiceInteractionService.SERVICE_INTERFACE);
  mBindIntent.setComponent(mSessionComponentName);
  mBound=mContext.bindServiceAsUser(mBindIntent,this,Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY | Context.BIND_ALLOW_OOM_MANAGEMENT,new UserHandle(mUser));
  if (mBound) {
    try {
      mIWindowManager.addWindowToken(mToken,WindowManager.LayoutParams.TYPE_VOICE_INTERACTION);
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
 else {
    Slog.w(TAG,"String_Node_Str" + mSessionComponentName);
  }
}
Program: 195291
Project: 195291
Buggy source:
/** 
 * Helper method for adding launch-search to most applications. Opens the search window using default settings.
 * @return true if search window opened
 */
private boolean launchDefaultSearch(KeyEvent event){
  boolean result;
  final Callback cb=getCallback();
  if (cb == null || isDestroyed()) {
    result=false;
  }
 else {
    sendCloseSystemWindows("String_Node_Str");
    int deviceId=event.getDeviceId();
    SearchEvent searchEvent=null;
    if (deviceId != 0) {
      searchEvent=new SearchEvent(InputDevice.getDevice(deviceId));
    }
    result=cb.onSearchRequested(searchEvent);
  }
  if (!result && (getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION) {
    return ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE)).launchAssistAction(null,UserHandle.myUserId());
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Helper method for adding launch-search to most applications. Opens the search window using default settings.
 * @return true if search window opened
 */
private boolean launchDefaultSearch(KeyEvent event){
  boolean result;
  final Callback cb=getCallback();
  if (cb == null || isDestroyed()) {
    result=false;
  }
 else {
    sendCloseSystemWindows("String_Node_Str");
    int deviceId=event.getDeviceId();
    SearchEvent searchEvent=null;
    if (deviceId != 0) {
      searchEvent=new SearchEvent(InputDevice.getDevice(deviceId));
    }
    try {
      result=cb.onSearchRequested(searchEvent);
    }
 catch (    AbstractMethodError e) {
      Log.e(TAG,"String_Node_Str" + cb.getClass().getName() + "String_Node_Str"+ "String_Node_Str",e);
      result=cb.onSearchRequested();
    }
  }
  if (!result && (getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION) {
    return ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE)).launchAssistAction(null,UserHandle.myUserId());
  }
  return result;
}