nus-yam/ex-repair huggingface dataset:
Program: 199419
Project: 199419
Buggy source:
private void endUsbDeviceAdded(){
  if (DEBUG_AUDIO) {
    Slog.d(TAG,"String_Node_Str");
  }
  if (mNewInterface != null) {
    mNewInterface.setEndpoints(mNewEndpoints.toArray(new UsbEndpoint[mNewEndpoints.size()]));
  }
  if (mNewConfiguration != null) {
    mNewConfiguration.setInterfaces(mNewInterfaces.toArray(new UsbInterface[mNewInterfaces.size()]));
  }
synchronized (mLock) {
    if (mNewDevice != null) {
      mNewDevice.setConfigurations(mNewConfigurations.toArray(new UsbConfiguration[mNewConfigurations.size()]));
      mDevices.put(mNewDevice.getDeviceName(),mNewDevice);
      Slog.d(TAG,"String_Node_Str" + mNewDevice);
      getCurrentSettings().deviceAttached(mNewDevice);
    }
 else {
      Slog.e(TAG,"String_Node_Str");
    }
    mNewDevice=null;
    mNewConfigurations=null;
    mNewInterfaces=null;
    mNewEndpoints=null;
  }
}

Fixed version (ground truth):
private void endUsbDeviceAdded(){
  if (DEBUG_AUDIO) {
    Slog.d(TAG,"String_Node_Str");
  }
  if (mNewInterface != null) {
    mNewInterface.setEndpoints(mNewEndpoints.toArray(new UsbEndpoint[mNewEndpoints.size()]));
  }
  if (mNewConfiguration != null) {
    mNewConfiguration.setInterfaces(mNewInterfaces.toArray(new UsbInterface[mNewInterfaces.size()]));
  }
  final int kUsbClassId_Audio=0x01;
  boolean isAudioDevice=false;
  for (int ntrfaceIndex=0; !isAudioDevice && ntrfaceIndex < mNewInterfaces.size(); ntrfaceIndex++) {
    UsbInterface ntrface=mNewInterfaces.get(ntrfaceIndex);
    if (ntrface.getInterfaceClass() == kUsbClassId_Audio) {
      isAudioDevice=true;
    }
  }
synchronized (mLock) {
    if (mNewDevice != null) {
      mNewDevice.setConfigurations(mNewConfigurations.toArray(new UsbConfiguration[mNewConfigurations.size()]));
      mDevices.put(mNewDevice.getDeviceName(),mNewDevice);
      Slog.d(TAG,"String_Node_Str" + mNewDevice);
      getCurrentSettings().deviceAttached(mNewDevice);
    }
 else {
      Slog.e(TAG,"String_Node_Str");
    }
    mNewDevice=null;
    mNewConfigurations=null;
    mNewInterfaces=null;
    mNewEndpoints=null;
  }
  if (!isAudioDevice) {
    return;
  }
  AlsaCardsParser cardsParser=new AlsaCardsParser();
  cardsParser.scan();
  AlsaDevicesParser devicesParser=new AlsaDevicesParser();
  devicesParser.scan();
  mConnectedUsbCard=cardsParser.getNumCardRecords() - 1;
  mConnectedUsbDeviceNum=0;
  if (!waitForAlsaFile(mConnectedUsbCard,mConnectedUsbDeviceNum,false)) {
    return;
  }
  mConnectedHasPlayback=devicesParser.hasPlaybackDevices(mConnectedUsbCard);
  mConnectedHasCapture=devicesParser.hasCaptureDevices(mConnectedUsbCard);
  mConnectedHasMIDI=devicesParser.hasMIDIDevices(mConnectedUsbCard);
  if (DEBUG_AUDIO) {
    Slog.d(TAG,"String_Node_Str" + mConnectedHasPlayback + "String_Node_Str"+ mConnectedHasCapture);
  }
  sendDeviceNotification(mConnectedUsbCard,mConnectedUsbDeviceNum,true,mConnectedHasPlayback,mConnectedHasCapture,mConnectedHasMIDI);
}
Program: 199420
Project: 199420
Buggy source:
private void usbDeviceRemoved(String deviceName){
  if (DEBUG_AUDIO) {
    Slog.d(TAG,"String_Node_Str" + deviceName);
  }
  sendDeviceNotification(1,0,false,false,false,false);
synchronized (mLock) {
    UsbDevice device=mDevices.remove(deviceName);
    if (device != null) {
      getCurrentSettings().deviceDetached(device);
    }
  }
}

Fixed version (ground truth):
private void usbDeviceRemoved(String deviceName){
  if (DEBUG_AUDIO) {
    Slog.d(TAG,"String_Node_Str" + deviceName);
  }
  if (mConnectedUsbCard != -1 && mConnectedUsbDeviceNum != -1) {
    sendDeviceNotification(mConnectedUsbCard,mConnectedUsbDeviceNum,false,mConnectedHasPlayback,mConnectedHasCapture,mConnectedHasMIDI);
    mConnectedUsbCard=-1;
    mConnectedUsbDeviceNum=-1;
    mConnectedHasPlayback=false;
    mConnectedHasCapture=false;
    mConnectedHasMIDI=false;
  }
synchronized (mLock) {
    UsbDevice device=mDevices.remove(deviceName);
    if (device != null) {
      getCurrentSettings().deviceDetached(device);
    }
  }
}
Program: 199421
Project: 199421
Buggy source:
private boolean beginUsbDeviceAdded(String deviceName,int vendorID,int productID,int deviceClass,int deviceSubclass,int deviceProtocol,String manufacturerName,String productName,String serialNumber){
  if (DEBUG_AUDIO) {
    Slog.d(TAG,"String_Node_Str" + deviceName + "String_Node_Str");
    Slog.d(TAG,"String_Node_Str");
    Slog.d(TAG,"String_Node_Str" + deviceName + "String_Node_Str"+ vendorID+ "String_Node_Str"+ productID+ "String_Node_Str"+ deviceClass+ "String_Node_Str"+ deviceSubclass+ "String_Node_Str"+ deviceProtocol);
  }
  if (!isBuiltInUsbDevice(deviceName)) {
    com.android.alsascan.AlsaDevicesParser devicesParser=new com.android.alsascan.AlsaDevicesParser();
    devicesParser.scan();
    boolean hasPlaybackDevices=devicesParser.hasPlaybackDevices();
    boolean hasCaptureDevices=devicesParser.hasCaptureDevices();
    boolean hasMIDI=devicesParser.hasMIDIDevices();
    if (DEBUG_AUDIO) {
      Slog.d(TAG,"String_Node_Str" + hasPlaybackDevices + "String_Node_Str"+ hasCaptureDevices);
    }
    int cardNum=1;
    int deviceNum=0;
    sendDeviceNotification(cardNum,deviceNum,true,hasPlaybackDevices,hasCaptureDevices,hasMIDI);
  }
  if (isBlackListed(deviceName) || isBlackListed(deviceClass,deviceSubclass,deviceProtocol)) {
    return false;
  }
synchronized (mLock) {
    if (mDevices.get(deviceName) != null) {
      Slog.w(TAG,"String_Node_Str" + deviceName);
      return false;
    }
    if (mNewDevice != null) {
      Slog.e(TAG,"String_Node_Str");
      return false;
    }
    mNewDevice=new UsbDevice(deviceName,vendorID,productID,deviceClass,deviceSubclass,deviceProtocol,manufacturerName,productName,serialNumber);
    mNewConfigurations=new ArrayList<UsbConfiguration>();
    mNewInterfaces=new ArrayList<UsbInterface>();
    mNewEndpoints=new ArrayList<UsbEndpoint>();
  }
  return true;
}

Fixed version (ground truth):
private boolean beginUsbDeviceAdded(String deviceName,int vendorID,int productID,int deviceClass,int deviceSubclass,int deviceProtocol,String manufacturerName,String productName,String serialNumber){
  if (DEBUG_AUDIO) {
    Slog.d(TAG,"String_Node_Str" + deviceName + "String_Node_Str");
    Slog.d(TAG,"String_Node_Str" + deviceName + "String_Node_Str"+ vendorID+ "String_Node_Str"+ productID+ "String_Node_Str"+ deviceClass+ "String_Node_Str"+ deviceSubclass+ "String_Node_Str"+ deviceProtocol);
  }
  if (isBlackListed(deviceName) || isBlackListed(deviceClass,deviceSubclass,deviceProtocol)) {
    return false;
  }
synchronized (mLock) {
    if (mDevices.get(deviceName) != null) {
      Slog.w(TAG,"String_Node_Str" + deviceName);
      return false;
    }
    if (mNewDevice != null) {
      Slog.e(TAG,"String_Node_Str");
      return false;
    }
    mNewDevice=new UsbDevice(deviceName,vendorID,productID,deviceClass,deviceSubclass,deviceProtocol,manufacturerName,productName,serialNumber);
    mNewConfigurations=new ArrayList<UsbConfiguration>();
    mNewInterfaces=new ArrayList<UsbInterface>();
    mNewEndpoints=new ArrayList<UsbEndpoint>();
  }
  return true;
}
Program: 199422
Project: 199422
Buggy source:
@SuppressWarnings("String_Node_Str") private <T>T getOverride(Key<T> key){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return (T)getAvailableFormats();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACES)) {
    return (T)getFaces();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return (T)getFaceRectangles();
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private <T>T getOverride(Key<T> key){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return (T)getAvailableFormats();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACES)) {
    return (T)getFaces();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return (T)getFaceRectangles();
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS)) {
    return (T)getAvailableStreamConfigurations();
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS)) {
    return (T)getAvailableMinFrameDurations();
  }
  return null;
}
Program: 199423
Project: 199423
Buggy source:
private <T>boolean setOverride(Key<T> key,T value){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return setAvailableFormats((int[])value);
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return setFaceRectangles((Rect[])value);
  }
  return false;
}

Fixed version (ground truth):
private <T>boolean setOverride(Key<T> key,T value){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return setAvailableFormats((int[])value);
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return setFaceRectangles((Rect[])value);
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS)) {
    return setAvailableStreamConfigurations((int[])value);
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS)) {
    return setAvailableMinFrameDurations((long[])value);
  }
  return false;
}
Program: 199425
Project: 199425
Buggy source:
@SuppressWarnings("String_Node_Str") private <T>T getOverride(Key<T> key){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return (T)getAvailableFormats();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACES)) {
    return (T)getFaces();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return (T)getFaceRectangles();
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private <T>T getOverride(Key<T> key){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return (T)getAvailableFormats();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACES)) {
    return (T)getFaces();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return (T)getFaceRectangles();
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS)) {
    return (T)getAvailableStreamConfigurations();
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS)) {
    return (T)getAvailableMinFrameDurations();
  }
  return null;
}
Program: 199426
Project: 199426
Buggy source:
private <T>boolean setOverride(Key<T> key,T value){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return setAvailableFormats((int[])value);
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return setFaceRectangles((Rect[])value);
  }
  return false;
}

Fixed version (ground truth):
private <T>boolean setOverride(Key<T> key,T value){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return setAvailableFormats((int[])value);
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return setFaceRectangles((Rect[])value);
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS)) {
    return setAvailableStreamConfigurations((int[])value);
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS)) {
    return setAvailableMinFrameDurations((long[])value);
  }
  return false;
}
Program: 199428
Project: 199428
Buggy source:
@SuppressWarnings("String_Node_Str") private <T>T getOverride(Key<T> key){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return (T)getAvailableFormats();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACES)) {
    return (T)getFaces();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return (T)getFaceRectangles();
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private <T>T getOverride(Key<T> key){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return (T)getAvailableFormats();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACES)) {
    return (T)getFaces();
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return (T)getFaceRectangles();
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS)) {
    return (T)getAvailableStreamConfigurations();
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS)) {
    return (T)getAvailableMinFrameDurations();
  }
  return null;
}
Program: 199429
Project: 199429
Buggy source:
private <T>boolean setOverride(Key<T> key,T value){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return setAvailableFormats((int[])value);
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return setFaceRectangles((Rect[])value);
  }
  return false;
}

Fixed version (ground truth):
private <T>boolean setOverride(Key<T> key,T value){
  if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_FORMATS)) {
    return setAvailableFormats((int[])value);
  }
 else   if (key.equals(CaptureResult.STATISTICS_FACE_RECTANGLES)) {
    return setFaceRectangles((Rect[])value);
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS)) {
    return setAvailableStreamConfigurations((int[])value);
  }
 else   if (key.equals(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS)) {
    return setAvailableMinFrameDurations((long[])value);
  }
  return false;
}
Program: 199431
Project: 199431
Buggy source:
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationDpsMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}

Fixed version (ground truth):
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationPxMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}
Program: 199432
Project: 199432
Buggy source:
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(Math.abs(distancePx) / config.animationDpsMovementPerSecond) * 1000);
}

Fixed version (ground truth):
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(1000f * (Math.abs(distancePx) / config.animationPxMovementPerSecond)));
}
Program: 199433
Project: 199433
Buggy source:
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationDpsMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}

Fixed version (ground truth):
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationPxMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}
Program: 199434
Project: 199434
Buggy source:
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(Math.abs(distancePx) / config.animationDpsMovementPerSecond) * 1000);
}

Fixed version (ground truth):
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(1000f * (Math.abs(distancePx) / config.animationPxMovementPerSecond)));
}
Program: 199435
Project: 199435
Buggy source:
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationDpsMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}

Fixed version (ground truth):
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationPxMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}
Program: 199436
Project: 199436
Buggy source:
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(Math.abs(distancePx) / config.animationDpsMovementPerSecond) * 1000);
}

Fixed version (ground truth):
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(1000f * (Math.abs(distancePx) / config.animationPxMovementPerSecond)));
}
Program: 199437
Project: 199437
Buggy source:
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationDpsMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}

Fixed version (ground truth):
/** 
 * Updates the state, given the specified context 
 */
void update(Context context){
  Resources res=context.getResources();
  DisplayMetrics dm=res.getDisplayMetrics();
  mDisplayMetrics=dm;
  displayRect.set(0,0,dm.widthPixels,dm.heightPixels);
  animationPxMovementPerSecond=res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
  filteringCurrentViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
  filteringNewViewsMinAnimDuration=res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
}
Program: 199438
Project: 199438
Buggy source:
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(Math.abs(distancePx) / config.animationDpsMovementPerSecond) * 1000);
}

Fixed version (ground truth):
public static int calculateTranslationAnimationDuration(int distancePx,int minDuration){
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  return Math.max(minDuration,(int)(1000f * (Math.abs(distancePx) / config.animationPxMovementPerSecond)));
}
Program: 199439
Project: 199439
Buggy source:
@LayoutlibDelegate static void nativeDraw(int canvas_instance,Rect loc,int bitmap_instance,byte[] c,int paint_instance_or_null,int destDensity,int srcDensity){
  draw(canvas_instance,loc.left,loc.top,loc.width(),loc.height(),bitmap_instance,c,paint_instance_or_null,destDensity,srcDensity);
}

Fixed version (ground truth):
@LayoutlibDelegate static void nativeDraw(int canvas_instance,Rect loc,int bitmap_instance,byte[] c,int paint_instance_or_null,int destDensity,int srcDensity){
  draw(canvas_instance,loc.left,loc.top,loc.right,loc.bottom,bitmap_instance,c,paint_instance_or_null,destDensity,srcDensity);
}
Program: 199440
Project: 199440
Buggy source:
@LayoutlibDelegate static void nativeDraw(int canvas_instance,Rect loc,int bitmap_instance,byte[] c,int paint_instance_or_null,int destDensity,int srcDensity){
  draw(canvas_instance,loc.left,loc.top,loc.width(),loc.height(),bitmap_instance,c,paint_instance_or_null,destDensity,srcDensity);
}

Fixed version (ground truth):
@LayoutlibDelegate static void nativeDraw(int canvas_instance,Rect loc,int bitmap_instance,byte[] c,int paint_instance_or_null,int destDensity,int srcDensity){
  draw(canvas_instance,loc.left,loc.top,loc.right,loc.bottom,bitmap_instance,c,paint_instance_or_null,destDensity,srcDensity);
}
Program: 199441
Project: 199441
Buggy source:
@LayoutlibDelegate static void nativeDraw(int canvas_instance,Rect loc,int bitmap_instance,byte[] c,int paint_instance_or_null,int destDensity,int srcDensity){
  draw(canvas_instance,loc.left,loc.top,loc.width(),loc.height(),bitmap_instance,c,paint_instance_or_null,destDensity,srcDensity);
}

Fixed version (ground truth):
@LayoutlibDelegate static void nativeDraw(int canvas_instance,Rect loc,int bitmap_instance,byte[] c,int paint_instance_or_null,int destDensity,int srcDensity){
  draw(canvas_instance,loc.left,loc.top,loc.right,loc.bottom,bitmap_instance,c,paint_instance_or_null,destDensity,srcDensity);
}
Program: 199442
Project: 199442
Buggy source:
public boolean isCurrentProfile(int userId){
synchronized (this) {
    for (int i=0; i < mCurrentProfileIds.length; i++) {
      if (userId == mCurrentProfileIds[i])       return true;
    }
    return false;
  }
}

Fixed version (ground truth):
public boolean isCurrentProfile(int userId){
synchronized (this) {
    if (userId == mCurrentUserId)     return true;
    for (int i=0; i < mCurrentProfileIds.length; i++) {
      if (userId == mCurrentProfileIds[i])       return true;
    }
    return false;
  }
}
Program: 199443
Project: 199443
Buggy source:
/** 
 * Checks whether the userid is a profile of the current user.
 */
private boolean isCurrentProfileLocked(int userId){
  for (int i=0; i < mService.mCurrentProfileIds.length; i++) {
    if (mService.mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks whether the userid is a profile of the current user.
 */
private boolean isCurrentProfileLocked(int userId){
  if (userId == mCurrentUser)   return true;
  for (int i=0; i < mService.mCurrentProfileIds.length; i++) {
    if (mService.mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}
Program: 199444
Project: 199444
Buggy source:
boolean isCurrentProfileLocked(int userId){
  for (int i=0; i < mCurrentProfileIds.length; i++) {
    if (mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isCurrentProfileLocked(int userId){
  if (userId == mCurrentUserId)   return true;
  for (int i=0; i < mCurrentProfileIds.length; i++) {
    if (mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}
Program: 199445
Project: 199445
Buggy source:
public boolean isCurrentProfile(int userId){
synchronized (this) {
    for (int i=0; i < mCurrentProfileIds.length; i++) {
      if (userId == mCurrentProfileIds[i])       return true;
    }
    return false;
  }
}

Fixed version (ground truth):
public boolean isCurrentProfile(int userId){
synchronized (this) {
    if (userId == mCurrentUserId)     return true;
    for (int i=0; i < mCurrentProfileIds.length; i++) {
      if (userId == mCurrentProfileIds[i])       return true;
    }
    return false;
  }
}
Program: 199446
Project: 199446
Buggy source:
/** 
 * Checks whether the userid is a profile of the current user.
 */
private boolean isCurrentProfileLocked(int userId){
  for (int i=0; i < mService.mCurrentProfileIds.length; i++) {
    if (mService.mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks whether the userid is a profile of the current user.
 */
private boolean isCurrentProfileLocked(int userId){
  if (userId == mCurrentUser)   return true;
  for (int i=0; i < mService.mCurrentProfileIds.length; i++) {
    if (mService.mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}
Program: 199447
Project: 199447
Buggy source:
boolean isCurrentProfileLocked(int userId){
  for (int i=0; i < mCurrentProfileIds.length; i++) {
    if (mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isCurrentProfileLocked(int userId){
  if (userId == mCurrentUserId)   return true;
  for (int i=0; i < mCurrentProfileIds.length; i++) {
    if (mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}
Program: 199448
Project: 199448
Buggy source:
public boolean isCurrentProfile(int userId){
synchronized (this) {
    for (int i=0; i < mCurrentProfileIds.length; i++) {
      if (userId == mCurrentProfileIds[i])       return true;
    }
    return false;
  }
}

Fixed version (ground truth):
public boolean isCurrentProfile(int userId){
synchronized (this) {
    if (userId == mCurrentUserId)     return true;
    for (int i=0; i < mCurrentProfileIds.length; i++) {
      if (userId == mCurrentProfileIds[i])       return true;
    }
    return false;
  }
}
Program: 199449
Project: 199449
Buggy source:
/** 
 * Checks whether the userid is a profile of the current user.
 */
private boolean isCurrentProfileLocked(int userId){
  for (int i=0; i < mService.mCurrentProfileIds.length; i++) {
    if (mService.mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks whether the userid is a profile of the current user.
 */
private boolean isCurrentProfileLocked(int userId){
  if (userId == mCurrentUser)   return true;
  for (int i=0; i < mService.mCurrentProfileIds.length; i++) {
    if (mService.mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}
Program: 199450
Project: 199450
Buggy source:
boolean isCurrentProfileLocked(int userId){
  for (int i=0; i < mCurrentProfileIds.length; i++) {
    if (mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isCurrentProfileLocked(int userId){
  if (userId == mCurrentUserId)   return true;
  for (int i=0; i < mCurrentProfileIds.length; i++) {
    if (mCurrentProfileIds[i] == userId)     return true;
  }
  return false;
}
Program: 199452
Project: 199452
Buggy source:
private void waitUntilIdle() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      throw new IllegalStateException("String_Node_Str");
    }
    try {
      mRemoteDevice.waitUntilIdle();
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return;
    }
    mRepeatingRequestId=REQUEST_ID_NONE;
    mRepeatingRequestIdDeletedList.clear();
    mCaptureListenerMap.clear();
  }
}

Fixed version (ground truth):
private void waitUntilIdle() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      throw new IllegalStateException("String_Node_Str");
    }
    try {
      mRemoteDevice.waitUntilIdle();
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return;
    }
    mRepeatingRequestId=REQUEST_ID_NONE;
  }
}
Program: 199453
Project: 199453
Buggy source:
@Override public void stopRepeating() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      int requestId=mRepeatingRequestId;
      mRepeatingRequestId=REQUEST_ID_NONE;
      mRepeatingRequestIdDeletedList.add(requestId);
      try {
        mRemoteDevice.cancelRequest(requestId);
      }
 catch (      CameraRuntimeException e) {
        throw e.asChecked();
      }
catch (      RemoteException e) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void stopRepeating() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      int requestId=mRepeatingRequestId;
      mRepeatingRequestId=REQUEST_ID_NONE;
      if (mCaptureListenerMap.get(requestId) != null) {
        mRepeatingRequestIdDeletedList.add(requestId);
      }
      try {
        mRemoteDevice.cancelRequest(requestId);
      }
 catch (      CameraRuntimeException e) {
        throw e.asChecked();
      }
catch (      RemoteException e) {
        return;
      }
    }
  }
}
Program: 199454
Project: 199454
Buggy source:
private void waitUntilIdle() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      throw new IllegalStateException("String_Node_Str");
    }
    try {
      mRemoteDevice.waitUntilIdle();
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return;
    }
    mRepeatingRequestId=REQUEST_ID_NONE;
    mRepeatingRequestIdDeletedList.clear();
    mCaptureListenerMap.clear();
  }
}

Fixed version (ground truth):
private void waitUntilIdle() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      throw new IllegalStateException("String_Node_Str");
    }
    try {
      mRemoteDevice.waitUntilIdle();
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return;
    }
    mRepeatingRequestId=REQUEST_ID_NONE;
  }
}
Program: 199455
Project: 199455
Buggy source:
@Override public void stopRepeating() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      int requestId=mRepeatingRequestId;
      mRepeatingRequestId=REQUEST_ID_NONE;
      mRepeatingRequestIdDeletedList.add(requestId);
      try {
        mRemoteDevice.cancelRequest(requestId);
      }
 catch (      CameraRuntimeException e) {
        throw e.asChecked();
      }
catch (      RemoteException e) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void stopRepeating() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      int requestId=mRepeatingRequestId;
      mRepeatingRequestId=REQUEST_ID_NONE;
      if (mCaptureListenerMap.get(requestId) != null) {
        mRepeatingRequestIdDeletedList.add(requestId);
      }
      try {
        mRemoteDevice.cancelRequest(requestId);
      }
 catch (      CameraRuntimeException e) {
        throw e.asChecked();
      }
catch (      RemoteException e) {
        return;
      }
    }
  }
}
Program: 199457
Project: 199457
Buggy source:
private void waitUntilIdle() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      throw new IllegalStateException("String_Node_Str");
    }
    try {
      mRemoteDevice.waitUntilIdle();
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return;
    }
    mRepeatingRequestId=REQUEST_ID_NONE;
    mRepeatingRequestIdDeletedList.clear();
    mCaptureListenerMap.clear();
  }
}

Fixed version (ground truth):
private void waitUntilIdle() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      throw new IllegalStateException("String_Node_Str");
    }
    try {
      mRemoteDevice.waitUntilIdle();
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return;
    }
    mRepeatingRequestId=REQUEST_ID_NONE;
  }
}
Program: 199458
Project: 199458
Buggy source:
@Override public void stopRepeating() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      int requestId=mRepeatingRequestId;
      mRepeatingRequestId=REQUEST_ID_NONE;
      mRepeatingRequestIdDeletedList.add(requestId);
      try {
        mRemoteDevice.cancelRequest(requestId);
      }
 catch (      CameraRuntimeException e) {
        throw e.asChecked();
      }
catch (      RemoteException e) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void stopRepeating() throws CameraAccessException {
synchronized (mLock) {
    checkIfCameraClosed();
    if (mRepeatingRequestId != REQUEST_ID_NONE) {
      int requestId=mRepeatingRequestId;
      mRepeatingRequestId=REQUEST_ID_NONE;
      if (mCaptureListenerMap.get(requestId) != null) {
        mRepeatingRequestIdDeletedList.add(requestId);
      }
      try {
        mRemoteDevice.cancelRequest(requestId);
      }
 catch (      CameraRuntimeException e) {
        throw e.asChecked();
      }
catch (      RemoteException e) {
        return;
      }
    }
  }
}
Program: 199461
Project: 199461
Buggy source:
/** 
 * @deprecated in API 16Bind an os surface
 * @param w
 * @param h
 * @param sur
 */
public void setSurfaceTexture(SurfaceTexture sur,int w,int h){
  validate();
  mWidth=w;
  mHeight=h;
  nContextSetSurfaceTexture(w,h,sur);
}

Fixed version (ground truth):
/** 
 * @deprecated in API 16Bind an os surface
 * @param w
 * @param h
 * @param sur
 */
public void setSurfaceTexture(SurfaceTexture sur,int w,int h){
  validate();
  Surface s=null;
  if (sur != null) {
    s=new Surface(sur);
  }
  mWidth=w;
  mHeight=h;
  nContextSetSurface(w,h,s);
}
Program: 199462
Project: 199462
Buggy source:
/** 
 * @deprecated in API 16Bind an os surface
 * @param w
 * @param h
 * @param sur
 */
public void setSurfaceTexture(SurfaceTexture sur,int w,int h){
  validate();
  mWidth=w;
  mHeight=h;
  nContextSetSurfaceTexture(w,h,sur);
}

Fixed version (ground truth):
/** 
 * @deprecated in API 16Bind an os surface
 * @param w
 * @param h
 * @param sur
 */
public void setSurfaceTexture(SurfaceTexture sur,int w,int h){
  validate();
  Surface s=null;
  if (sur != null) {
    s=new Surface(sur);
  }
  mWidth=w;
  mHeight=h;
  nContextSetSurface(w,h,s);
}
Program: 199463
Project: 199463
Buggy source:
/** 
 * @deprecated in API 16Bind an os surface
 * @param w
 * @param h
 * @param sur
 */
public void setSurfaceTexture(SurfaceTexture sur,int w,int h){
  validate();
  mWidth=w;
  mHeight=h;
  nContextSetSurfaceTexture(w,h,sur);
}

Fixed version (ground truth):
/** 
 * @deprecated in API 16Bind an os surface
 * @param w
 * @param h
 * @param sur
 */
public void setSurfaceTexture(SurfaceTexture sur,int w,int h){
  validate();
  Surface s=null;
  if (sur != null) {
    s=new Surface(sur);
  }
  mWidth=w;
  mHeight=h;
  nContextSetSurface(w,h,s);
}
Program: 199464
Project: 199464
Buggy source:
/** 
 * @param context everything needs a context :(
 */
public GlobalActions(Context context,WindowManagerFuncs windowManagerFuncs){
  mContext=context;
  mWindowManagerFuncs=windowManagerFuncs;
  mAudioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  mDreamManager=IDreamManager.Stub.asInterface(ServiceManager.getService(DreamService.DREAM_SERVICE));
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  context.registerReceiver(mBroadcastReceiver,filter);
  TelephonyManager telephonyManager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE);
  ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  mHasTelephony=cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
  mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),true,mAirplaneModeObserver);
  Vibrator vibrator=(Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
  mHasVibrator=vibrator != null && vibrator.hasVibrator();
  mShowSilentToggle=SHOW_SILENT_TOGGLE && !mContext.getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume);
}

Fixed version (ground truth):
/** 
 * @param context everything needs a context :(
 */
public GlobalActions(Context context,WindowManagerFuncs windowManagerFuncs){
  mContext=context;
  mWindowManagerFuncs=windowManagerFuncs;
  mAudioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  mDreamManager=IDreamManager.Stub.asInterface(ServiceManager.getService(DreamService.DREAM_SERVICE));
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  context.registerReceiver(mBroadcastReceiver,filter);
  ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  mHasTelephony=cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
  TelephonyManager telephonyManager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE);
  mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),true,mAirplaneModeObserver);
  Vibrator vibrator=(Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
  mHasVibrator=vibrator != null && vibrator.hasVibrator();
  mShowSilentToggle=SHOW_SILENT_TOGGLE && !mContext.getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume);
}
Program: 199465
Project: 199465
Buggy source:
/** 
 * @param context everything needs a context :(
 */
public GlobalActions(Context context,WindowManagerFuncs windowManagerFuncs){
  mContext=context;
  mWindowManagerFuncs=windowManagerFuncs;
  mAudioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  mDreamManager=IDreamManager.Stub.asInterface(ServiceManager.getService(DreamService.DREAM_SERVICE));
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  context.registerReceiver(mBroadcastReceiver,filter);
  TelephonyManager telephonyManager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE);
  ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  mHasTelephony=cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
  mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),true,mAirplaneModeObserver);
  Vibrator vibrator=(Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
  mHasVibrator=vibrator != null && vibrator.hasVibrator();
  mShowSilentToggle=SHOW_SILENT_TOGGLE && !mContext.getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume);
}

Fixed version (ground truth):
/** 
 * @param context everything needs a context :(
 */
public GlobalActions(Context context,WindowManagerFuncs windowManagerFuncs){
  mContext=context;
  mWindowManagerFuncs=windowManagerFuncs;
  mAudioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  mDreamManager=IDreamManager.Stub.asInterface(ServiceManager.getService(DreamService.DREAM_SERVICE));
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  context.registerReceiver(mBroadcastReceiver,filter);
  ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  mHasTelephony=cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
  TelephonyManager telephonyManager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE);
  mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),true,mAirplaneModeObserver);
  Vibrator vibrator=(Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
  mHasVibrator=vibrator != null && vibrator.hasVibrator();
  mShowSilentToggle=SHOW_SILENT_TOGGLE && !mContext.getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume);
}
Program: 199466
Project: 199466
Buggy source:
/** 
 * @param context everything needs a context :(
 */
public GlobalActions(Context context,WindowManagerFuncs windowManagerFuncs){
  mContext=context;
  mWindowManagerFuncs=windowManagerFuncs;
  mAudioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  mDreamManager=IDreamManager.Stub.asInterface(ServiceManager.getService(DreamService.DREAM_SERVICE));
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  context.registerReceiver(mBroadcastReceiver,filter);
  TelephonyManager telephonyManager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE);
  ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  mHasTelephony=cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
  mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),true,mAirplaneModeObserver);
  Vibrator vibrator=(Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
  mHasVibrator=vibrator != null && vibrator.hasVibrator();
  mShowSilentToggle=SHOW_SILENT_TOGGLE && !mContext.getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume);
}

Fixed version (ground truth):
/** 
 * @param context everything needs a context :(
 */
public GlobalActions(Context context,WindowManagerFuncs windowManagerFuncs){
  mContext=context;
  mWindowManagerFuncs=windowManagerFuncs;
  mAudioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  mDreamManager=IDreamManager.Stub.asInterface(ServiceManager.getService(DreamService.DREAM_SERVICE));
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  context.registerReceiver(mBroadcastReceiver,filter);
  ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  mHasTelephony=cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
  TelephonyManager telephonyManager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE);
  mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),true,mAirplaneModeObserver);
  Vibrator vibrator=(Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
  mHasVibrator=vibrator != null && vibrator.hasVibrator();
  mShowSilentToggle=SHOW_SILENT_TOGGLE && !mContext.getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume);
}
Program: 199467
Project: 199467
Buggy source:
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    if (DEBUG_APP)     Slog.v(TAG,"String_Node_Str" + r);
    r.app=null;
  }
  mStackSupervisor.mFinishingActivities.remove(r);
  mStackSupervisor.mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (!mService.mPendingThumbnails.isEmpty()) {
    mStackSupervisor.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}

Fixed version (ground truth):
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mPausingActivity == r) {
    mPausingActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    if (DEBUG_APP)     Slog.v(TAG,"String_Node_Str" + r);
    r.app=null;
  }
  mStackSupervisor.mFinishingActivities.remove(r);
  mStackSupervisor.mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (!mService.mPendingThumbnails.isEmpty()) {
    mStackSupervisor.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}