nus-yam/ex-repair huggingface dataset:
Program: 23119
Project: 23119
Buggy source:
/** 
 * Removes a dead service.
 * @param service The service.
 * @return True if the service was removed, false otherwise.
 */
private boolean removeDeadServiceLocked(Service service){
  mServices.remove(service);
  mHandler.removeMessages(service.mId);
  if (LOGV) {
    Log.i(LOG_TAG,"String_Node_Str" + service.mService + "String_Node_Str");
  }
  if (mServices.isEmpty()) {
    mIsEnabled=false;
    updateClientsLocked();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Removes a dead service.
 * @param service The service.
 * @return True if the service was removed, false otherwise.
 */
private boolean removeDeadServiceLocked(Service service){
  mServices.remove(service);
  mHandler.removeMessages(service.mId);
  if (Config.DEBUG) {
    Log.i(LOG_TAG,"String_Node_Str" + service.mService + "String_Node_Str");
  }
  if (mServices.isEmpty()) {
    mIsEnabled=false;
    updateClientsLocked();
  }
  return true;
}
Program: 23120
Project: 23120
Buggy source:
/** 
 * Creates a new instance.
 * @param context A {@link Context} instance.
 */
AccessibilityManagerService(Context context){
  mContext=context;
  mPackageManager=mContext.getPackageManager();
  mCaller=new HandlerCaller(context,this);
  registerPackageChangeAndBootCompletedBroadcastReceiver();
  registerSettingsContentObservers();
synchronized (mLock) {
    populateAccessibilityServiceListLocked();
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance.
 * @param context A {@link Context} instance.
 */
AccessibilityManagerService(Context context){
  mContext=context;
  mPackageManager=mContext.getPackageManager();
  mCaller=new HandlerCaller(context,this);
  registerPackageChangeAndBootCompletedBroadcastReceiver();
  registerSettingsContentObservers();
}
Program: 23121
Project: 23121
Buggy source:
/** 
 * Registers a   {@link BroadcastReceiver} for the events ofadding/changing/removing/restarting a package and boot completion.
 */
private void registerPackageChangeAndBootCompletedBroadcastReceiver(){
  Context context=mContext;
  BroadcastReceiver broadcastReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
synchronized (mLock) {
        populateAccessibilityServiceListLocked();
        manageServicesLocked();
        if (intent.getAction() == Intent.ACTION_BOOT_COMPLETED) {
          mIsEnabled=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_ENABLED,0) == 1;
          updateClientsLocked();
        }
      }
    }
  }
;
  IntentFilter packageFilter=new IntentFilter();
  packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
  packageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  packageFilter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
  packageFilter.addDataScheme("String_Node_Str");
  context.registerReceiver(broadcastReceiver,packageFilter);
  IntentFilter sdFilter=new IntentFilter();
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
  mContext.registerReceiver(broadcastReceiver,sdFilter);
  IntentFilter bootFiler=new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
  mContext.registerReceiver(broadcastReceiver,bootFiler);
}

Fixed version (ground truth):
/** 
 * Registers a   {@link BroadcastReceiver} for the events ofadding/changing/removing/restarting a package and boot completion.
 */
private void registerPackageChangeAndBootCompletedBroadcastReceiver(){
  Context context=mContext;
  BroadcastReceiver broadcastReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
synchronized (mLock) {
        populateAccessibilityServiceListLocked();
        if (intent.getAction() == Intent.ACTION_BOOT_COMPLETED) {
          mIsEnabled=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_ENABLED,0) == 1;
          if (mIsEnabled) {
            updateClientsLocked();
          }
        }
        manageServicesLocked();
      }
    }
  }
;
  IntentFilter packageFilter=new IntentFilter();
  packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
  packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  packageFilter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
  packageFilter.addDataScheme("String_Node_Str");
  context.registerReceiver(broadcastReceiver,packageFilter);
  IntentFilter sdFilter=new IntentFilter();
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
  mContext.registerReceiver(broadcastReceiver,sdFilter);
  IntentFilter bootFiler=new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
  mContext.registerReceiver(broadcastReceiver,bootFiler);
}
Program: 23122
Project: 23122
Buggy source:
@Override public void onReceive(Context context,Intent intent){
synchronized (mLock) {
    populateAccessibilityServiceListLocked();
    manageServicesLocked();
    if (intent.getAction() == Intent.ACTION_BOOT_COMPLETED) {
      mIsEnabled=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_ENABLED,0) == 1;
      updateClientsLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
synchronized (mLock) {
    populateAccessibilityServiceListLocked();
    if (intent.getAction() == Intent.ACTION_BOOT_COMPLETED) {
      mIsEnabled=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_ENABLED,0) == 1;
      if (mIsEnabled) {
        updateClientsLocked();
      }
    }
    manageServicesLocked();
  }
}
Program: 23123
Project: 23123
Buggy source:
/** 
 * Updates the state of each service by starting (or keeping running) enabled ones and stopping the rest.
 * @param installedServices All installed {@link AccessibilityService}s.
 * @param enabledServices The {@link ComponentName}s of the enabled services.
 */
private void updateServicesStateLocked(List<ServiceInfo> installedServices,Set<ComponentName> enabledServices){
  Map<ComponentName,Service> componentNameToServiceMap=mComponentNameToServiceMap;
  List<Service> services=mServices;
  for (int i=0, count=installedServices.size(); i < count; i++) {
    ServiceInfo intalledService=installedServices.get(i);
    ComponentName componentName=new ComponentName(intalledService.packageName,intalledService.name);
    Service service=componentNameToServiceMap.get(componentName);
    if (enabledServices.contains(componentName)) {
      if (service == null) {
        new Service(componentName).bind();
      }
    }
 else {
      if (service != null) {
        service.unbind();
        componentNameToServiceMap.remove(componentName);
        services.remove(service);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates the state of each service by starting (or keeping running) enabled ones and stopping the rest.
 * @param installedServices All installed {@link AccessibilityService}s.
 * @param enabledServices The {@link ComponentName}s of the enabled services.
 */
private void updateServicesStateLocked(List<ServiceInfo> installedServices,Set<ComponentName> enabledServices){
  Map<ComponentName,Service> componentNameToServiceMap=mComponentNameToServiceMap;
  List<Service> services=mServices;
  boolean isEnabled=mIsEnabled;
  for (int i=0, count=installedServices.size(); i < count; i++) {
    ServiceInfo intalledService=installedServices.get(i);
    ComponentName componentName=new ComponentName(intalledService.packageName,intalledService.name);
    Service service=componentNameToServiceMap.get(componentName);
    if (isEnabled && enabledServices.contains(componentName)) {
      if (service == null) {
        new Service(componentName).bind();
      }
    }
 else {
      if (service != null) {
        service.unbind();
        componentNameToServiceMap.remove(componentName);
        services.remove(service);
      }
    }
  }
}
Program: 23124
Project: 23124
Buggy source:
/** 
 * Notifies a service for a scheduled event given the event type.
 * @param service The service.
 * @param eventType The type of the event to dispatch.
 */
private void notifyEventListenerLocked(Service service,int eventType){
  IEventListener listener=service.mServiceInterface;
  AccessibilityEvent event=service.mPendingEvents.get(eventType);
  try {
    listener.onAccessibilityEvent(event);
    if (LOGV) {
      Log.i(LOG_TAG,"String_Node_Str" + event + "String_Node_Str"+ listener);
    }
  }
 catch (  RemoteException re) {
    if (re instanceof DeadObjectException) {
      Log.w(LOG_TAG,"String_Node_Str" + service.mService + "String_Node_Str");
synchronized (mLock) {
        removeDeadServiceLocked(service);
      }
    }
 else {
      Log.e(LOG_TAG,"String_Node_Str" + event + "String_Node_Str"+ service.mService,re);
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies a service for a scheduled event given the event type.
 * @param service The service.
 * @param eventType The type of the event to dispatch.
 */
private void notifyEventListenerLocked(Service service,int eventType){
  IEventListener listener=service.mServiceInterface;
  AccessibilityEvent event=service.mPendingEvents.get(eventType);
  try {
    listener.onAccessibilityEvent(event);
    if (Config.DEBUG) {
      Log.i(LOG_TAG,"String_Node_Str" + event + "String_Node_Str"+ listener);
    }
  }
 catch (  RemoteException re) {
    if (re instanceof DeadObjectException) {
      Log.w(LOG_TAG,"String_Node_Str" + service.mService + "String_Node_Str");
synchronized (mLock) {
        removeDeadServiceLocked(service);
      }
    }
 else {
      Log.e(LOG_TAG,"String_Node_Str" + event + "String_Node_Str"+ service.mService,re);
    }
  }
}
Program: 23125
Project: 23125
Buggy source:
public void writeToParcel(Parcel parcel,int flags){
  parcel.writeInt(eventTypes);
  parcel.writeStringArray(packageNames);
  parcel.writeInt(feedbackType);
  parcel.writeLong(notificationTimeout);
  parcel.writeInt(flags);
}

Fixed version (ground truth):
public void writeToParcel(Parcel parcel,int flagz){
  parcel.writeInt(eventTypes);
  parcel.writeStringArray(packageNames);
  parcel.writeInt(feedbackType);
  parcel.writeLong(notificationTimeout);
  parcel.writeInt(flags);
}
Program: 23126
Project: 23126
Buggy source:
/** 
 * @see AudioManager#adjustStreamVolume(int,int,int) 
 */
public void adjustStreamVolume(int streamType,int direction,int flags){
  ensureValidDirection(direction);
  ensureValidStreamType(streamType);
  VolumeStreamState streamState=mStreamStates[STREAM_VOLUME_ALIAS[streamType]];
  final int oldIndex=streamState.mIndex;
  boolean adjustVolume=true;
  if ((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0 || streamType == AudioSystem.STREAM_RING) {
    adjustVolume=checkForRingerModeChange(oldIndex,direction);
  }
  if (adjustVolume && streamState.adjustIndex(direction)) {
    if (streamState.muteCount() == 0) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,STREAM_VOLUME_ALIAS[streamType],SENDMSG_NOOP,0,0,streamState,0);
    }
  }
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType);
}

Fixed version (ground truth):
/** 
 * @see AudioManager#adjustStreamVolume(int,int,int) 
 */
public void adjustStreamVolume(int streamType,int direction,int flags){
  ensureValidDirection(direction);
  ensureValidStreamType(streamType);
  VolumeStreamState streamState=mStreamStates[STREAM_VOLUME_ALIAS[streamType]];
  final int oldIndex=streamState.mIndex;
  boolean adjustVolume=true;
  if ((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0 || streamType == AudioSystem.STREAM_RING) {
    adjustVolume=checkForRingerModeChange(oldIndex,direction);
  }
  if (adjustVolume && streamState.adjustIndex(direction)) {
    if (streamState.muteCount() == 0) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,STREAM_VOLUME_ALIAS[streamType],SENDMSG_NOOP,0,0,streamState,0);
    }
  }
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType,oldIndex,streamState.mIndex);
}
Program: 23127
Project: 23127
Buggy source:
private void sendVolumeUpdate(int streamType){
  Intent intent=new Intent(AudioManager.VOLUME_CHANGED_ACTION);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE,streamType);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE,getStreamVolume(streamType));
  if (streamType == AudioSystem.STREAM_BLUETOOTH_SCO) {
    mContext.sendBroadcast(intent);
  }
}

Fixed version (ground truth):
private void sendVolumeUpdate(int streamType,int oldIndex,int index){
  oldIndex=(oldIndex + 5) / 10;
  index=(index + 5) / 10;
  Intent intent=new Intent(AudioManager.VOLUME_CHANGED_ACTION);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE,streamType);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE,index);
  intent.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE,oldIndex);
  mContext.sendBroadcast(intent);
}
Program: 23128
Project: 23128
Buggy source:
/** 
 * @see AudioManager#setStreamVolume(int,int,int) 
 */
public void setStreamVolume(int streamType,int index,int flags){
  ensureValidStreamType(streamType);
  index=rescaleIndex(index * 10,streamType,STREAM_VOLUME_ALIAS[streamType]);
  setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,false,true);
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType);
}

Fixed version (ground truth):
/** 
 * @see AudioManager#setStreamVolume(int,int,int) 
 */
public void setStreamVolume(int streamType,int index,int flags){
  ensureValidStreamType(streamType);
  final int oldIndex=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
  index=rescaleIndex(index * 10,streamType,STREAM_VOLUME_ALIAS[streamType]);
  setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,false,true);
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType,oldIndex,index);
}
Program: 23129
Project: 23129
Buggy source:
/** 
 * @see AudioManager#adjustStreamVolume(int,int,int) 
 */
public void adjustStreamVolume(int streamType,int direction,int flags){
  ensureValidDirection(direction);
  ensureValidStreamType(streamType);
  VolumeStreamState streamState=mStreamStates[STREAM_VOLUME_ALIAS[streamType]];
  final int oldIndex=streamState.mIndex;
  boolean adjustVolume=true;
  if ((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0 || streamType == AudioSystem.STREAM_RING) {
    adjustVolume=checkForRingerModeChange(oldIndex,direction);
  }
  if (adjustVolume && streamState.adjustIndex(direction)) {
    if (streamState.muteCount() == 0) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,STREAM_VOLUME_ALIAS[streamType],SENDMSG_NOOP,0,0,streamState,0);
    }
  }
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType);
}

Fixed version (ground truth):
/** 
 * @see AudioManager#adjustStreamVolume(int,int,int) 
 */
public void adjustStreamVolume(int streamType,int direction,int flags){
  ensureValidDirection(direction);
  ensureValidStreamType(streamType);
  VolumeStreamState streamState=mStreamStates[STREAM_VOLUME_ALIAS[streamType]];
  final int oldIndex=streamState.mIndex;
  boolean adjustVolume=true;
  if ((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0 || streamType == AudioSystem.STREAM_RING) {
    adjustVolume=checkForRingerModeChange(oldIndex,direction);
  }
  if (adjustVolume && streamState.adjustIndex(direction)) {
    if (streamState.muteCount() == 0) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,STREAM_VOLUME_ALIAS[streamType],SENDMSG_NOOP,0,0,streamState,0);
    }
  }
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType,oldIndex,streamState.mIndex);
}
Program: 23130
Project: 23130
Buggy source:
private void sendVolumeUpdate(int streamType){
  Intent intent=new Intent(AudioManager.VOLUME_CHANGED_ACTION);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE,streamType);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE,getStreamVolume(streamType));
  if (streamType == AudioSystem.STREAM_BLUETOOTH_SCO) {
    mContext.sendBroadcast(intent);
  }
}

Fixed version (ground truth):
private void sendVolumeUpdate(int streamType,int oldIndex,int index){
  oldIndex=(oldIndex + 5) / 10;
  index=(index + 5) / 10;
  Intent intent=new Intent(AudioManager.VOLUME_CHANGED_ACTION);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE,streamType);
  intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE,index);
  intent.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE,oldIndex);
  mContext.sendBroadcast(intent);
}
Program: 23131
Project: 23131
Buggy source:
/** 
 * @see AudioManager#setStreamVolume(int,int,int) 
 */
public void setStreamVolume(int streamType,int index,int flags){
  ensureValidStreamType(streamType);
  index=rescaleIndex(index * 10,streamType,STREAM_VOLUME_ALIAS[streamType]);
  setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,false,true);
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType);
}

Fixed version (ground truth):
/** 
 * @see AudioManager#setStreamVolume(int,int,int) 
 */
public void setStreamVolume(int streamType,int index,int flags){
  ensureValidStreamType(streamType);
  final int oldIndex=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
  index=rescaleIndex(index * 10,streamType,STREAM_VOLUME_ALIAS[streamType]);
  setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,false,true);
  mVolumePanel.postVolumeChanged(streamType,flags);
  sendVolumeUpdate(streamType,oldIndex,index);
}
Program: 23132
Project: 23132
Buggy source:
/** 
 * Checks whether audio routing to the wired headset is on or off.
 * @return true if audio is being routed to/from wired headset;false if otherwise
 */
public boolean isWiredHeadsetOn(){
  if (AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET,"String_Node_Str") == AudioSystem.DEVICE_STATE_UNAVAILABLE) {
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether audio routing to the wired headset is on or off.
 * @return true if audio is being routed to/from wired headset;false if otherwise
 */
public boolean isWiredHeadsetOn(){
  if (AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET,"String_Node_Str") == AudioSystem.DEVICE_STATE_UNAVAILABLE && AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE,"String_Node_Str") == AudioSystem.DEVICE_STATE_UNAVAILABLE) {
    return false;
  }
 else {
    return true;
  }
}
Program: 23133
Project: 23133
Buggy source:
/** 
 * Checks whether a speech recognition service is available on the system. If this method returns   {@code false},   {@link RecognitionManager#createRecognitionManager(Context)} willfail.
 * @param context with which {@code RecognitionManager} will be created
 * @return {@code true} if recognition is available, {@code false} otherwise
 */
public static boolean isRecognitionAvailable(final Context context){
  final List<ResolveInfo> list=context.getPackageManager().queryIntentServices(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),0);
  return list != null && list.size() != 0;
}

Fixed version (ground truth):
/** 
 * Checks whether a speech recognition service is available on the system. If this method returns   {@code false},   {@link RecognitionManager#createRecognitionManager(Context)} willfail.
 * @param context with which {@code RecognitionManager} will be created
 * @return {@code true} if recognition is available, {@code false} otherwise
 */
public static boolean isRecognitionAvailable(final Context context){
  final List<ResolveInfo> list=context.getPackageManager().queryIntentServices(new Intent(RecognitionService.SERVICE_INTERFACE),0);
  return list != null && list.size() != 0;
}
Program: 23136
Project: 23136
Buggy source:
/** 
 * Checks whether a speech recognition service is available on the system. If this method returns   {@code false},   {@link RecognitionManager#createRecognitionManager(Context)} willfail.
 * @param context with which {@code RecognitionManager} will be created
 * @return {@code true} if recognition is available, {@code false} otherwise
 */
public static boolean isRecognitionAvailable(final Context context){
  final List<ResolveInfo> list=context.getPackageManager().queryIntentServices(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),0);
  return list != null && list.size() != 0;
}

Fixed version (ground truth):
/** 
 * Checks whether a speech recognition service is available on the system. If this method returns   {@code false},   {@link RecognitionManager#createRecognitionManager(Context)} willfail.
 * @param context with which {@code RecognitionManager} will be created
 * @return {@code true} if recognition is available, {@code false} otherwise
 */
public static boolean isRecognitionAvailable(final Context context){
  final List<ResolveInfo> list=context.getPackageManager().queryIntentServices(new Intent(RecognitionService.SERVICE_INTERFACE),0);
  return list != null && list.size() != 0;
}
Program: 23137
Project: 23137
Buggy source:
/** 
 * Checks whether audio routing to the wired headset is on or off.
 * @return true if audio is being routed to/from wired headset;false if otherwise
 */
public boolean isWiredHeadsetOn(){
  if (AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET,"String_Node_Str") == AudioSystem.DEVICE_STATE_UNAVAILABLE) {
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether audio routing to the wired headset is on or off.
 * @return true if audio is being routed to/from wired headset;false if otherwise
 */
public boolean isWiredHeadsetOn(){
  if (AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET,"String_Node_Str") == AudioSystem.DEVICE_STATE_UNAVAILABLE && AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE,"String_Node_Str") == AudioSystem.DEVICE_STATE_UNAVAILABLE) {
    return false;
  }
 else {
    return true;
  }
}
Program: 23138
Project: 23138
Buggy source:
public void testBasicAccess() throws Exception {
  try {
    byte[] newKey=mSysKeyStore.generateNewKey(128,"String_Node_Str",keyName);
    assertNotNull(newKey);
    byte[] recKey=mSysKeyStore.retrieveKey(keyName);
    assertEquals(newKey.length,recKey.length);
    for (int i=0; i < newKey.length; i++) {
      assertEquals(newKey[i],recKey[i]);
    }
    mSysKeyStore.deleteKey(keyName);
    byte[] nullKey=mSysKeyStore.retrieveKey(keyName);
    assertNull(nullKey);
    String newKeyStr=mSysKeyStore.generateNewKeyHexString(128,"String_Node_Str",keyName2);
    assertNotNull(newKeyStr);
    String recKeyStr=mSysKeyStore.retrieveKeyHexString(keyName2);
    assertEquals(newKeyStr,recKeyStr);
    mSysKeyStore.deleteKey(keyName2);
    String nullKey2=mSysKeyStore.retrieveKeyHexString(keyName);
    assertNull(nullKey2);
  }
 catch (  Exception e) {
    fail();
  }
}

Fixed version (ground truth):
public void testBasicAccess() throws Exception {
  try {
    byte[] newKey=mSysKeyStore.generateNewKey(128,"String_Node_Str",keyName);
    assertNotNull(newKey);
    byte[] recKey=mSysKeyStore.retrieveKey(keyName);
    assertEquals(newKey.length,recKey.length);
    for (int i=0; i < newKey.length; i++) {
      assertEquals(newKey[i],recKey[i]);
    }
    mSysKeyStore.deleteKey(keyName);
    byte[] nullKey=mSysKeyStore.retrieveKey(keyName);
    assertNull(nullKey);
    String newKeyStr=mSysKeyStore.generateNewKeyHexString(128,"String_Node_Str",keyName2);
    assertNotNull(newKeyStr);
    String recKeyStr=mSysKeyStore.retrieveKeyHexString(keyName2);
    assertEquals(newKeyStr,recKeyStr);
    mSysKeyStore.deleteKey(keyName2);
    String nullKey2=mSysKeyStore.retrieveKeyHexString(keyName2);
    assertNull(nullKey2);
  }
 catch (  Exception e) {
    fail();
  }
}
Program: 23139
Project: 23139
Buggy source:
public void testBasicAccess() throws Exception {
  try {
    byte[] newKey=mSysKeyStore.generateNewKey(128,"String_Node_Str",keyName);
    assertNotNull(newKey);
    byte[] recKey=mSysKeyStore.retrieveKey(keyName);
    assertEquals(newKey.length,recKey.length);
    for (int i=0; i < newKey.length; i++) {
      assertEquals(newKey[i],recKey[i]);
    }
    mSysKeyStore.deleteKey(keyName);
    byte[] nullKey=mSysKeyStore.retrieveKey(keyName);
    assertNull(nullKey);
    String newKeyStr=mSysKeyStore.generateNewKeyHexString(128,"String_Node_Str",keyName2);
    assertNotNull(newKeyStr);
    String recKeyStr=mSysKeyStore.retrieveKeyHexString(keyName2);
    assertEquals(newKeyStr,recKeyStr);
    mSysKeyStore.deleteKey(keyName2);
    String nullKey2=mSysKeyStore.retrieveKeyHexString(keyName);
    assertNull(nullKey2);
  }
 catch (  Exception e) {
    fail();
  }
}

Fixed version (ground truth):
public void testBasicAccess() throws Exception {
  try {
    byte[] newKey=mSysKeyStore.generateNewKey(128,"String_Node_Str",keyName);
    assertNotNull(newKey);
    byte[] recKey=mSysKeyStore.retrieveKey(keyName);
    assertEquals(newKey.length,recKey.length);
    for (int i=0; i < newKey.length; i++) {
      assertEquals(newKey[i],recKey[i]);
    }
    mSysKeyStore.deleteKey(keyName);
    byte[] nullKey=mSysKeyStore.retrieveKey(keyName);
    assertNull(nullKey);
    String newKeyStr=mSysKeyStore.generateNewKeyHexString(128,"String_Node_Str",keyName2);
    assertNotNull(newKeyStr);
    String recKeyStr=mSysKeyStore.retrieveKeyHexString(keyName2);
    assertEquals(newKeyStr,recKeyStr);
    mSysKeyStore.deleteKey(keyName2);
    String nullKey2=mSysKeyStore.retrieveKeyHexString(keyName2);
    assertNull(nullKey2);
  }
 catch (  Exception e) {
    fail();
  }
}
Program: 23140
Project: 23140
Buggy source:
/** 
 * Cancels the speech recognition. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void cancel(){
  checkIsCalledFromMainThread();
  checkIsCommandAllowed();
  putMessage(Message.obtain(mHandler,MSG_CANCEL));
}

Fixed version (ground truth):
/** 
 * Cancels the speech recognition. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void cancel(){
  checkIsCalledFromMainThread();
  putMessage(Message.obtain(mHandler,MSG_CANCEL));
}
Program: 23141
Project: 23141
Buggy source:
/** 
 * Starts listening for speech. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 * @param recognizerIntent contains parameters for the recognition to be performed. The intentmay also contain optional extras, see  {@link RecognizerIntent}. If these values are not set explicitly, default values will be used by the recognizer.
 */
public void startListening(final Intent recognizerIntent){
  if (recognizerIntent == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkIsCalledFromMainThread();
  checkIsCommandAllowed();
  if (mConnection == null) {
    mConnection=new Connection();
    if (!mContext.bindService(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),mConnection,Context.BIND_AUTO_CREATE)) {
      Log.e(TAG,"String_Node_Str");
      mConnection=null;
      mService=null;
      mListener.onError(ERROR_CLIENT);
      return;
    }
  }
  putMessage(Message.obtain(mHandler,MSG_START,recognizerIntent));
}

Fixed version (ground truth):
/** 
 * Starts listening for speech. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 * @param recognizerIntent contains parameters for the recognition to be performed. The intentmay also contain optional extras, see  {@link RecognizerIntent}. If these values are not set explicitly, default values will be used by the recognizer.
 */
public void startListening(final Intent recognizerIntent){
  if (recognizerIntent == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkIsCalledFromMainThread();
  if (mConnection == null) {
    mConnection=new Connection();
    if (!mContext.bindService(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),mConnection,Context.BIND_AUTO_CREATE)) {
      Log.e(TAG,"String_Node_Str");
      mConnection=null;
      mService=null;
      mListener.onError(ERROR_CLIENT);
      return;
    }
  }
  putMessage(Message.obtain(mHandler,MSG_START,recognizerIntent));
}
Program: 23142
Project: 23142
Buggy source:
/** 
 * sends the actual message to the service 
 */
private void handleStopMessage(){
  try {
    mService.stopListening(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}

Fixed version (ground truth):
/** 
 * sends the actual message to the service 
 */
private void handleStopMessage(){
  if (!checkOpenConnection()) {
    return;
  }
  try {
    mService.stopListening(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}
Program: 23143
Project: 23143
Buggy source:
/** 
 * sends the actual message to the service 
 */
private void handleCancelMessage(){
  try {
    mService.cancel(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}

Fixed version (ground truth):
/** 
 * sends the actual message to the service 
 */
private void handleCancelMessage(){
  if (!checkOpenConnection()) {
    return;
  }
  try {
    mService.cancel(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}
Program: 23144
Project: 23144
Buggy source:
/** 
 * Stops listening for speech. Speech captured so far will be recognized as if the user had stopped speaking at this point. Note that in the default case, this does not need to be called, as the speech endpointer will automatically stop the recognizer listening when it determines speech has completed. However, you can manipulate endpointer parameters directly using the intent extras defined in   {@link RecognizerIntent}, in which case you may sometimes want to manually call this method to stop listening sooner. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void stopListening(){
  checkIsCalledFromMainThread();
  checkIsCommandAllowed();
  putMessage(Message.obtain(mHandler,MSG_STOP));
}

Fixed version (ground truth):
/** 
 * Stops listening for speech. Speech captured so far will be recognized as if the user had stopped speaking at this point. Note that in the default case, this does not need to be called, as the speech endpointer will automatically stop the recognizer listening when it determines speech has completed. However, you can manipulate endpointer parameters directly using the intent extras defined in   {@link RecognizerIntent}, in which case you may sometimes want to manually call this method to stop listening sooner. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void stopListening(){
  checkIsCalledFromMainThread();
  putMessage(Message.obtain(mHandler,MSG_STOP));
}
Program: 23145
Project: 23145
Buggy source:
/** 
 * sends the actual message to the service 
 */
private void handleStartListening(Intent recognizerIntent){
  try {
    mService.startListening(recognizerIntent,mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}

Fixed version (ground truth):
/** 
 * sends the actual message to the service 
 */
private void handleStartListening(Intent recognizerIntent){
  if (!checkOpenConnection()) {
    return;
  }
  try {
    mService.startListening(recognizerIntent,mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}
Program: 23152
Project: 23152
Buggy source:
/** 
 * Cancels the speech recognition. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void cancel(){
  checkIsCalledFromMainThread();
  checkIsCommandAllowed();
  putMessage(Message.obtain(mHandler,MSG_CANCEL));
}

Fixed version (ground truth):
/** 
 * Cancels the speech recognition. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void cancel(){
  checkIsCalledFromMainThread();
  putMessage(Message.obtain(mHandler,MSG_CANCEL));
}
Program: 23153
Project: 23153
Buggy source:
/** 
 * Starts listening for speech. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 * @param recognizerIntent contains parameters for the recognition to be performed. The intentmay also contain optional extras, see  {@link RecognizerIntent}. If these values are not set explicitly, default values will be used by the recognizer.
 */
public void startListening(final Intent recognizerIntent){
  if (recognizerIntent == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkIsCalledFromMainThread();
  checkIsCommandAllowed();
  if (mConnection == null) {
    mConnection=new Connection();
    if (!mContext.bindService(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),mConnection,Context.BIND_AUTO_CREATE)) {
      Log.e(TAG,"String_Node_Str");
      mConnection=null;
      mService=null;
      mListener.onError(ERROR_CLIENT);
      return;
    }
  }
  putMessage(Message.obtain(mHandler,MSG_START,recognizerIntent));
}

Fixed version (ground truth):
/** 
 * Starts listening for speech. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 * @param recognizerIntent contains parameters for the recognition to be performed. The intentmay also contain optional extras, see  {@link RecognizerIntent}. If these values are not set explicitly, default values will be used by the recognizer.
 */
public void startListening(final Intent recognizerIntent){
  if (recognizerIntent == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkIsCalledFromMainThread();
  if (mConnection == null) {
    mConnection=new Connection();
    if (!mContext.bindService(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),mConnection,Context.BIND_AUTO_CREATE)) {
      Log.e(TAG,"String_Node_Str");
      mConnection=null;
      mService=null;
      mListener.onError(ERROR_CLIENT);
      return;
    }
  }
  putMessage(Message.obtain(mHandler,MSG_START,recognizerIntent));
}
Program: 23154
Project: 23154
Buggy source:
/** 
 * sends the actual message to the service 
 */
private void handleStopMessage(){
  try {
    mService.stopListening(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}

Fixed version (ground truth):
/** 
 * sends the actual message to the service 
 */
private void handleStopMessage(){
  if (!checkOpenConnection()) {
    return;
  }
  try {
    mService.stopListening(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}
Program: 23155
Project: 23155
Buggy source:
/** 
 * sends the actual message to the service 
 */
private void handleCancelMessage(){
  try {
    mService.cancel(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}

Fixed version (ground truth):
/** 
 * sends the actual message to the service 
 */
private void handleCancelMessage(){
  if (!checkOpenConnection()) {
    return;
  }
  try {
    mService.cancel(mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}
Program: 23156
Project: 23156
Buggy source:
/** 
 * Stops listening for speech. Speech captured so far will be recognized as if the user had stopped speaking at this point. Note that in the default case, this does not need to be called, as the speech endpointer will automatically stop the recognizer listening when it determines speech has completed. However, you can manipulate endpointer parameters directly using the intent extras defined in   {@link RecognizerIntent}, in which case you may sometimes want to manually call this method to stop listening sooner. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void stopListening(){
  checkIsCalledFromMainThread();
  checkIsCommandAllowed();
  putMessage(Message.obtain(mHandler,MSG_STOP));
}

Fixed version (ground truth):
/** 
 * Stops listening for speech. Speech captured so far will be recognized as if the user had stopped speaking at this point. Note that in the default case, this does not need to be called, as the speech endpointer will automatically stop the recognizer listening when it determines speech has completed. However, you can manipulate endpointer parameters directly using the intent extras defined in   {@link RecognizerIntent}, in which case you may sometimes want to manually call this method to stop listening sooner. Please note that  {@link #setRecognitionListener(RecognitionListener)} must be called beforehand, otherwise a{@link RuntimeException} will be thrown.
 */
public void stopListening(){
  checkIsCalledFromMainThread();
  putMessage(Message.obtain(mHandler,MSG_STOP));
}
Program: 23157
Project: 23157
Buggy source:
/** 
 * sends the actual message to the service 
 */
private void handleStartListening(Intent recognizerIntent){
  try {
    mService.startListening(recognizerIntent,mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}

Fixed version (ground truth):
/** 
 * sends the actual message to the service 
 */
private void handleStartListening(Intent recognizerIntent){
  if (!checkOpenConnection()) {
    return;
  }
  try {
    mService.startListening(recognizerIntent,mListener);
    if (DBG)     Log.d(TAG,"String_Node_Str");
  }
 catch (  final RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    mListener.onError(ERROR_CLIENT);
  }
}
Program: 23159
Project: 23159
Buggy source:
private boolean startScrollIfNeeded(int deltaY){
  final int distance=Math.abs(deltaY);
  if (distance > mTouchSlop) {
    createScrollingCache();
    mTouchMode=TOUCH_MODE_SCROLL;
    mMotionCorrection=deltaY;
    final Handler handler=getHandler();
    if (handler != null) {
      handler.removeCallbacks(mPendingCheckForLongPress);
    }
    setPressed(false);
    View motionView=getChildAt(mMotionPosition - mFirstPosition);
    if (motionView != null) {
      motionView.setPressed(false);
    }
    reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
    requestDisallowInterceptTouchEvent(true);
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean startScrollIfNeeded(int deltaY){
  final int distance=Math.abs(deltaY);
  final boolean overscroll=mScrollY != 0;
  if (overscroll || distance > mTouchSlop) {
    createScrollingCache();
    mTouchMode=overscroll ? TOUCH_MODE_OVERSCROLL : TOUCH_MODE_SCROLL;
    mMotionCorrection=deltaY;
    final Handler handler=getHandler();
    if (handler != null) {
      handler.removeCallbacks(mPendingCheckForLongPress);
    }
    setPressed(false);
    View motionView=getChildAt(mMotionPosition - mFirstPosition);
    if (motionView != null) {
      motionView.setPressed(false);
    }
    reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
    requestDisallowInterceptTouchEvent(true);
    return true;
  }
  return false;
}
Program: 23160
Project: 23160
Buggy source:
private boolean springback(int startX,int startY,int minX,int maxX,int minY,int maxY,Scroller scroller){
  int xoff=0;
  int yoff=0;
  if (startX < minX) {
    xoff=minX - startX;
  }
 else   if (startX > maxX) {
    xoff=maxX - startX;
  }
  if (startY < minY) {
    yoff=minY - startY;
  }
 else   if (startY > maxY) {
    yoff=maxY - startY;
  }
  if (xoff != 0 || yoff != 0) {
    scroller.startScroll(startX,startY,xoff,yoff,SPRINGBACK_DURATION);
    mCurrScroller.abortAnimation();
    mCurrScroller=scroller;
    mScrollMode=MODE_SPRINGBACK;
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean springback(int startX,int startY,int minX,int maxX,int minY,int maxY,Scroller scroller){
  int xoff=0;
  int yoff=0;
  if (startX < minX) {
    xoff=minX - startX;
  }
 else   if (startX > maxX) {
    xoff=maxX - startX;
  }
  if (startY < minY) {
    yoff=minY - startY;
  }
 else   if (startY > maxY) {
    yoff=maxY - startY;
  }
  if (xoff != 0 || yoff != 0) {
    mCurrScroller.abortAnimation();
    scroller.startScroll(startX,startY,xoff,yoff,SPRINGBACK_DURATION);
    mCurrScroller=scroller;
    mScrollMode=MODE_SPRINGBACK;
    return true;
  }
  return false;
}
Program: 23161
Project: 23161
Buggy source:
private void overfling(int startx,int starty,float xvel,float yvel){
  Scroller scroller=mDecelScroller;
  final float durationSecs=(OVERFLING_DURATION / 1000.f);
  int dx=(int)(xvel * durationSecs) / 8;
  int dy=(int)(yvel * durationSecs) / 8;
  scroller.startScroll(startx,starty,dx,dy,OVERFLING_DURATION);
  mCurrScroller.abortAnimation();
  mCurrScroller=scroller;
  mScrollMode=MODE_OVERFLING;
}

Fixed version (ground truth):
private void overfling(int startx,int starty,float xvel,float yvel){
  Scroller scroller=mDecelScroller;
  final float durationSecs=(OVERFLING_DURATION / 1000.f);
  int dx=(int)(xvel * durationSecs) / 8;
  int dy=(int)(yvel * durationSecs) / 8;
  mCurrScroller.abortAnimation();
  scroller.startScroll(startx,starty,dx,dy,OVERFLING_DURATION);
  mCurrScroller=scroller;
  mScrollMode=MODE_OVERFLING;
}
Program: 23163
Project: 23163
Buggy source:
private boolean startScrollIfNeeded(int deltaY){
  final int distance=Math.abs(deltaY);
  if (distance > mTouchSlop) {
    createScrollingCache();
    mTouchMode=TOUCH_MODE_SCROLL;
    mMotionCorrection=deltaY;
    final Handler handler=getHandler();
    if (handler != null) {
      handler.removeCallbacks(mPendingCheckForLongPress);
    }
    setPressed(false);
    View motionView=getChildAt(mMotionPosition - mFirstPosition);
    if (motionView != null) {
      motionView.setPressed(false);
    }
    reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
    requestDisallowInterceptTouchEvent(true);
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean startScrollIfNeeded(int deltaY){
  final int distance=Math.abs(deltaY);
  final boolean overscroll=mScrollY != 0;
  if (overscroll || distance > mTouchSlop) {
    createScrollingCache();
    mTouchMode=overscroll ? TOUCH_MODE_OVERSCROLL : TOUCH_MODE_SCROLL;
    mMotionCorrection=deltaY;
    final Handler handler=getHandler();
    if (handler != null) {
      handler.removeCallbacks(mPendingCheckForLongPress);
    }
    setPressed(false);
    View motionView=getChildAt(mMotionPosition - mFirstPosition);
    if (motionView != null) {
      motionView.setPressed(false);
    }
    reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
    requestDisallowInterceptTouchEvent(true);
    return true;
  }
  return false;
}
Program: 23164
Project: 23164
Buggy source:
private boolean springback(int startX,int startY,int minX,int maxX,int minY,int maxY,Scroller scroller){
  int xoff=0;
  int yoff=0;
  if (startX < minX) {
    xoff=minX - startX;
  }
 else   if (startX > maxX) {
    xoff=maxX - startX;
  }
  if (startY < minY) {
    yoff=minY - startY;
  }
 else   if (startY > maxY) {
    yoff=maxY - startY;
  }
  if (xoff != 0 || yoff != 0) {
    scroller.startScroll(startX,startY,xoff,yoff,SPRINGBACK_DURATION);
    mCurrScroller.abortAnimation();
    mCurrScroller=scroller;
    mScrollMode=MODE_SPRINGBACK;
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean springback(int startX,int startY,int minX,int maxX,int minY,int maxY,Scroller scroller){
  int xoff=0;
  int yoff=0;
  if (startX < minX) {
    xoff=minX - startX;
  }
 else   if (startX > maxX) {
    xoff=maxX - startX;
  }
  if (startY < minY) {
    yoff=minY - startY;
  }
 else   if (startY > maxY) {
    yoff=maxY - startY;
  }
  if (xoff != 0 || yoff != 0) {
    mCurrScroller.abortAnimation();
    scroller.startScroll(startX,startY,xoff,yoff,SPRINGBACK_DURATION);
    mCurrScroller=scroller;
    mScrollMode=MODE_SPRINGBACK;
    return true;
  }
  return false;
}
Program: 23165
Project: 23165
Buggy source:
private void overfling(int startx,int starty,float xvel,float yvel){
  Scroller scroller=mDecelScroller;
  final float durationSecs=(OVERFLING_DURATION / 1000.f);
  int dx=(int)(xvel * durationSecs) / 8;
  int dy=(int)(yvel * durationSecs) / 8;
  scroller.startScroll(startx,starty,dx,dy,OVERFLING_DURATION);
  mCurrScroller.abortAnimation();
  mCurrScroller=scroller;
  mScrollMode=MODE_OVERFLING;
}

Fixed version (ground truth):
private void overfling(int startx,int starty,float xvel,float yvel){
  Scroller scroller=mDecelScroller;
  final float durationSecs=(OVERFLING_DURATION / 1000.f);
  int dx=(int)(xvel * durationSecs) / 8;
  int dy=(int)(yvel * durationSecs) / 8;
  mCurrScroller.abortAnimation();
  scroller.startScroll(startx,starty,dx,dy,OVERFLING_DURATION);
  mCurrScroller=scroller;
  mScrollMode=MODE_OVERFLING;
}
Program: 23167
Project: 23167
Buggy source:
void addProvidersForPackageLocked(String pkgName){
  Intent intent=new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
  List<ResolveInfo> broadcastReceivers=mPackageManager.queryBroadcastReceivers(intent,PackageManager.GET_META_DATA);
  final int N=broadcastReceivers.size();
  for (int i=0; i < N; i++) {
    ResolveInfo ri=broadcastReceivers.get(i);
    ActivityInfo ai=ri.activityInfo;
    if (pkgName.equals(ai.packageName)) {
      addProviderLocked(ri);
    }
  }
}

Fixed version (ground truth):
void addProvidersForPackageLocked(String pkgName){
  Intent intent=new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
  intent.setPackage(pkgName);
  List<ResolveInfo> broadcastReceivers=mPackageManager.queryBroadcastReceivers(intent,PackageManager.GET_META_DATA);
  final int N=broadcastReceivers.size();
  for (int i=0; i < N; i++) {
    ResolveInfo ri=broadcastReceivers.get(i);
    ActivityInfo ai=ri.activityInfo;
    if (pkgName.equals(ai.packageName)) {
      addProviderLocked(ri);
    }
  }
}
Program: 23168
Project: 23168
Buggy source:
private DateFormat getDateFormat(){
  String format=Settings.System.getString(getContext().getContentResolver(),Settings.System.DATE_FORMAT);
  if ("String_Node_Str".equals(format)) {
    return DateFormat.getDateInstance(DateFormat.SHORT);
  }
 else {
    return new SimpleDateFormat(format);
  }
}

Fixed version (ground truth):
private DateFormat getDateFormat(){
  String format=Settings.System.getString(getContext().getContentResolver(),Settings.System.DATE_FORMAT);
  if (format == null || "String_Node_Str".equals(format)) {
    return DateFormat.getDateInstance(DateFormat.SHORT);
  }
 else {
    return new SimpleDateFormat(format);
  }
}