nus-yam/ex-repair huggingface dataset:
Program: 196499
Project: 196499
Buggy source:
private <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}

Fixed version (ground truth):
private static <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}
Program: 196505
Project: 196505
Buggy source:
protected void onTrackingStarted(){
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}

Fixed version (ground truth):
protected void onTrackingStarted(){
  mClosing=false;
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}
Program: 196506
Project: 196506
Buggy source:
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getActualHeight();
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}

Fixed version (ground truth):
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=StackStateAnimator.getFinalActualHeight(mFirstChildWhileExpanding);
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}
Program: 196507
Project: 196507
Buggy source:
public void notifyChildrenChanged(ViewGroup hostView){
  if (mIsExpansionChanging) {
    updateFirstChildHeightWhileExpanding(hostView);
  }
}

Fixed version (ground truth):
public void notifyChildrenChanged(final ViewGroup hostView){
  if (mIsExpansionChanging) {
    hostView.post(new Runnable(){
      @Override public void run(){
        updateFirstChildHeightWhileExpanding(hostView);
      }
    }
);
  }
}
Program: 196508
Project: 196508
Buggy source:
private <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}

Fixed version (ground truth):
private static <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}
Program: 196509
Project: 196509
Buggy source:
protected void onTrackingStarted(){
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}

Fixed version (ground truth):
protected void onTrackingStarted(){
  mClosing=false;
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}
Program: 196510
Project: 196510
Buggy source:
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getActualHeight();
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}

Fixed version (ground truth):
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=StackStateAnimator.getFinalActualHeight(mFirstChildWhileExpanding);
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}
Program: 196511
Project: 196511
Buggy source:
public void notifyChildrenChanged(ViewGroup hostView){
  if (mIsExpansionChanging) {
    updateFirstChildHeightWhileExpanding(hostView);
  }
}

Fixed version (ground truth):
public void notifyChildrenChanged(final ViewGroup hostView){
  if (mIsExpansionChanging) {
    hostView.post(new Runnable(){
      @Override public void run(){
        updateFirstChildHeightWhileExpanding(hostView);
      }
    }
);
  }
}
Program: 196512
Project: 196512
Buggy source:
private <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}

Fixed version (ground truth):
private static <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}
Program: 196513
Project: 196513
Buggy source:
protected void onTrackingStarted(){
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}

Fixed version (ground truth):
protected void onTrackingStarted(){
  mClosing=false;
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}
Program: 196514
Project: 196514
Buggy source:
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getActualHeight();
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}

Fixed version (ground truth):
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=StackStateAnimator.getFinalActualHeight(mFirstChildWhileExpanding);
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}
Program: 196515
Project: 196515
Buggy source:
public void notifyChildrenChanged(ViewGroup hostView){
  if (mIsExpansionChanging) {
    updateFirstChildHeightWhileExpanding(hostView);
  }
}

Fixed version (ground truth):
public void notifyChildrenChanged(final ViewGroup hostView){
  if (mIsExpansionChanging) {
    hostView.post(new Runnable(){
      @Override public void run(){
        updateFirstChildHeightWhileExpanding(hostView);
      }
    }
);
  }
}
Program: 196516
Project: 196516
Buggy source:
private <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}

Fixed version (ground truth):
private static <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}
Program: 196517
Project: 196517
Buggy source:
protected void onTrackingStarted(){
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}

Fixed version (ground truth):
protected void onTrackingStarted(){
  mClosing=false;
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}
Program: 196518
Project: 196518
Buggy source:
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getActualHeight();
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}

Fixed version (ground truth):
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=StackStateAnimator.getFinalActualHeight(mFirstChildWhileExpanding);
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}
Program: 196519
Project: 196519
Buggy source:
public void notifyChildrenChanged(ViewGroup hostView){
  if (mIsExpansionChanging) {
    updateFirstChildHeightWhileExpanding(hostView);
  }
}

Fixed version (ground truth):
public void notifyChildrenChanged(final ViewGroup hostView){
  if (mIsExpansionChanging) {
    hostView.post(new Runnable(){
      @Override public void run(){
        updateFirstChildHeightWhileExpanding(hostView);
      }
    }
);
  }
}
Program: 196520
Project: 196520
Buggy source:
private <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}

Fixed version (ground truth):
private static <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}
Program: 196533
Project: 196533
Buggy source:
protected void onTrackingStarted(){
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}

Fixed version (ground truth):
protected void onTrackingStarted(){
  mClosing=false;
  mTracking=true;
  mCollapseAfterPeek=false;
  mBar.onTrackingStarted(PanelView.this);
  notifyExpandingStarted();
}
Program: 196534
Project: 196534
Buggy source:
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getActualHeight();
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}

Fixed version (ground truth):
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=(ExpandableView)findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=StackStateAnimator.getFinalActualHeight(mFirstChildWhileExpanding);
    }
 else {
      updateFirstChildMaxSizeToMaxHeight();
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}
Program: 196535
Project: 196535
Buggy source:
public void notifyChildrenChanged(ViewGroup hostView){
  if (mIsExpansionChanging) {
    updateFirstChildHeightWhileExpanding(hostView);
  }
}

Fixed version (ground truth):
public void notifyChildrenChanged(final ViewGroup hostView){
  if (mIsExpansionChanging) {
    hostView.post(new Runnable(){
      @Override public void run(){
        updateFirstChildHeightWhileExpanding(hostView);
      }
    }
);
  }
}
Program: 196536
Project: 196536
Buggy source:
private <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}

Fixed version (ground truth):
private static <T>T getChildTag(View child,int tag){
  return (T)child.getTag(tag);
}
Program: 196537
Project: 196537
Buggy source:
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}
Program: 196539
Project: 196539
Buggy source:
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}

Fixed version (ground truth):
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}
Program: 196543
Project: 196543
Buggy source:
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}
Program: 196545
Project: 196545
Buggy source:
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}

Fixed version (ground truth):
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}
Program: 196549
Project: 196549
Buggy source:
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}
Program: 196551
Project: 196551
Buggy source:
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}

Fixed version (ground truth):
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}
Program: 196555
Project: 196555
Buggy source:
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}
Program: 196557
Project: 196557
Buggy source:
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}

Fixed version (ground truth):
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}
Program: 196561
Project: 196561
Buggy source:
private void instantCollapseNotificationPanel(){
  mNotificationPanel.setExpandedFraction(0);
}

Fixed version (ground truth):
private void instantCollapseNotificationPanel(){
  mNotificationPanel.instantCollapse();
}
Program: 196562
Project: 196562
Buggy source:
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}
Program: 196564
Project: 196564
Buggy source:
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}

Fixed version (ground truth):
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}
Program: 196568
Project: 196568
Buggy source:
private void instantCollapseNotificationPanel(){
  mNotificationPanel.setExpandedFraction(0);
}

Fixed version (ground truth):
private void instantCollapseNotificationPanel(){
  mNotificationPanel.instantCollapse();
}
Program: 196569
Project: 196569
Buggy source:
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}
Program: 196571
Project: 196571
Buggy source:
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}

Fixed version (ground truth):
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}
Program: 196575
Project: 196575
Buggy source:
private void instantCollapseNotificationPanel(){
  mNotificationPanel.setExpandedFraction(0);
}

Fixed version (ground truth):
private void instantCollapseNotificationPanel(){
  mNotificationPanel.instantCollapse();
}
Program: 196577
Project: 196577
Buggy source:
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
private void handleEnable(boolean quietMode){
  mQuietEnable=quietMode;
synchronized (mConnection) {
    if ((mBluetooth == null) && (!mBinding)) {
      Message timeoutMsg=mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND);
      mHandler.sendMessageDelayed(timeoutMsg,TIMEOUT_BIND_MS);
      mConnection.setGetNameAddressOnly(false);
      Intent i=new Intent(IBluetooth.class.getName());
      if (!doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT)) {
        mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
      }
 else {
        mBinding=true;
      }
    }
 else     if (mBluetooth != null) {
      if (mConnection.isGetNameAddressOnly()) {
        mConnection.setGetNameAddressOnly(false);
        try {
          mBluetooth.registerCallback(mBluetoothCallback);
        }
 catch (        RemoteException re) {
          Log.e(TAG,"String_Node_Str",re);
        }
        sendBluetoothServiceUpCallback();
      }
      try {
        if (!mQuietEnable) {
          if (!mBluetooth.enable()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 else {
          if (!mBluetooth.enableNoAutoConnect()) {
            Log.e(TAG,"String_Node_Str");
          }
        }
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
}
Program: 196579
Project: 196579
Buggy source:
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}

Fixed version (ground truth):
private void bluetoothStateChangeHandler(int prevState,int newState){
  if (prevState != newState) {
    if (newState == BluetoothAdapter.STATE_ON || newState == BluetoothAdapter.STATE_OFF) {
      boolean isUp=(newState == BluetoothAdapter.STATE_ON);
      sendBluetoothStateCallback(isUp);
      if (isUp) {
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
          Intent i=new Intent(IBluetoothGatt.class.getName());
          doBind(i,mConnection,Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT,UserHandle.CURRENT);
        }
      }
 else {
        if (!isUp && canUnbindBluetoothService()) {
          sendBluetoothServiceDownCallback();
          unbindAndFinish();
        }
      }
    }
    Intent intent=new Intent(BluetoothAdapter.ACTION_STATE_CHANGED);
    intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE,prevState);
    intent.putExtra(BluetoothAdapter.EXTRA_STATE,newState);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    if (DBG)     Log.d(TAG,"String_Node_Str" + prevState + "String_Node_Str"+ newState);
    mContext.sendBroadcastAsUser(intent,UserHandle.ALL,BLUETOOTH_PERM);
  }
}
Program: 196584
Project: 196584
Buggy source:
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}

Fixed version (ground truth):
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}