nus-yam/ex-repair huggingface dataset:
Program: 189
Project: 189
Buggy source:
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}

Fixed version (ground truth):
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
    r.tracker.setStarted(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}
Program: 191
Project: 191
Buggy source:
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}

Fixed version (ground truth):
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
    r.tracker.setStarted(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}
Program: 192
Project: 192
Buggy source:
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.mPresentationDisplay=choosePresentationDisplayForRoute(newRoute,sStatic.getAllPresentationDisplays());
  return newRoute;
}

Fixed version (ground truth):
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.updatePresentationDisplay();
  return newRoute;
}
Program: 193
Project: 193
Buggy source:
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplay=getDisplayForGlobalRoute(globalRoute);
  return route;
}

Fixed version (ground truth):
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplayId=globalRoute.presentationDisplayId;
  route.updatePresentationDisplay();
  return route;
}
Program: 194
Project: 194
Buggy source:
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.mPresentationDisplay=choosePresentationDisplayForRoute(mDefaultAudioVideo,getAllPresentationDisplays());
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}

Fixed version (ground truth):
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.updatePresentationDisplay();
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}
Program: 195
Project: 195
Buggy source:
private void updatePresentationDisplays(int changedDisplayId){
  final Display[] displays=getAllPresentationDisplays();
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo info=mRoutes.get(i);
    Display display=choosePresentationDisplayForRoute(info,displays);
    if (display != info.mPresentationDisplay || (display != null && display.getDisplayId() == changedDisplayId)) {
      info.mPresentationDisplay=display;
      dispatchRoutePresentationDisplayChanged(info);
    }
  }
}

Fixed version (ground truth):
private void updatePresentationDisplays(int changedDisplayId){
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo route=mRoutes.get(i);
    if (route.updatePresentationDisplay() || (route.mPresentationDisplay != null && route.mPresentationDisplay.getDisplayId() == changedDisplayId)) {
      dispatchRoutePresentationDisplayChanged(route);
    }
  }
}
Program: 197
Project: 197
Buggy source:
RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}

Fixed version (ground truth):
/** 
 * Finds the remote display with the specified id, returns null if not found.
 * @param id Id of the remote display.
 */
public RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}
Program: 205
Project: 205
Buggy source:
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}

Fixed version (ground truth):
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
    r.tracker.setStarted(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}
Program: 207
Project: 207
Buggy source:
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}

Fixed version (ground truth):
private void serviceProcessGoneLocked(ServiceRecord r){
  if (r.tracker != null) {
    int memFactor=mAm.mProcessStats.getMemFactorLocked();
    long now=SystemClock.uptimeMillis();
    r.tracker.setExecuting(false,memFactor,now);
    r.tracker.setBound(false,memFactor,now);
    r.tracker.setStarted(false,memFactor,now);
  }
  serviceDoneExecutingLocked(r,true,true);
}
Program: 210
Project: 210
Buggy source:
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.mPresentationDisplay=choosePresentationDisplayForRoute(newRoute,sStatic.getAllPresentationDisplays());
  return newRoute;
}

Fixed version (ground truth):
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.updatePresentationDisplay();
  return newRoute;
}
Program: 211
Project: 211
Buggy source:
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplay=getDisplayForGlobalRoute(globalRoute);
  return route;
}

Fixed version (ground truth):
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplayId=globalRoute.presentationDisplayId;
  route.updatePresentationDisplay();
  return route;
}
Program: 212
Project: 212
Buggy source:
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.mPresentationDisplay=choosePresentationDisplayForRoute(mDefaultAudioVideo,getAllPresentationDisplays());
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}

Fixed version (ground truth):
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.updatePresentationDisplay();
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}
Program: 213
Project: 213
Buggy source:
private void updatePresentationDisplays(int changedDisplayId){
  final Display[] displays=getAllPresentationDisplays();
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo info=mRoutes.get(i);
    Display display=choosePresentationDisplayForRoute(info,displays);
    if (display != info.mPresentationDisplay || (display != null && display.getDisplayId() == changedDisplayId)) {
      info.mPresentationDisplay=display;
      dispatchRoutePresentationDisplayChanged(info);
    }
  }
}

Fixed version (ground truth):
private void updatePresentationDisplays(int changedDisplayId){
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo route=mRoutes.get(i);
    if (route.updatePresentationDisplay() || (route.mPresentationDisplay != null && route.mPresentationDisplay.getDisplayId() == changedDisplayId)) {
      dispatchRoutePresentationDisplayChanged(route);
    }
  }
}
Program: 215
Project: 215
Buggy source:
RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}

Fixed version (ground truth):
/** 
 * Finds the remote display with the specified id, returns null if not found.
 * @param id Id of the remote display.
 */
public RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}
Program: 216
Project: 216
Buggy source:
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.mPresentationDisplay=choosePresentationDisplayForRoute(newRoute,sStatic.getAllPresentationDisplays());
  return newRoute;
}

Fixed version (ground truth):
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.updatePresentationDisplay();
  return newRoute;
}
Program: 217
Project: 217
Buggy source:
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplay=getDisplayForGlobalRoute(globalRoute);
  return route;
}

Fixed version (ground truth):
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplayId=globalRoute.presentationDisplayId;
  route.updatePresentationDisplay();
  return route;
}
Program: 218
Project: 218
Buggy source:
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.mPresentationDisplay=choosePresentationDisplayForRoute(mDefaultAudioVideo,getAllPresentationDisplays());
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}

Fixed version (ground truth):
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.updatePresentationDisplay();
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}
Program: 219
Project: 219
Buggy source:
private void updatePresentationDisplays(int changedDisplayId){
  final Display[] displays=getAllPresentationDisplays();
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo info=mRoutes.get(i);
    Display display=choosePresentationDisplayForRoute(info,displays);
    if (display != info.mPresentationDisplay || (display != null && display.getDisplayId() == changedDisplayId)) {
      info.mPresentationDisplay=display;
      dispatchRoutePresentationDisplayChanged(info);
    }
  }
}

Fixed version (ground truth):
private void updatePresentationDisplays(int changedDisplayId){
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo route=mRoutes.get(i);
    if (route.updatePresentationDisplay() || (route.mPresentationDisplay != null && route.mPresentationDisplay.getDisplayId() == changedDisplayId)) {
      dispatchRoutePresentationDisplayChanged(route);
    }
  }
}
Program: 221
Project: 221
Buggy source:
RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}

Fixed version (ground truth):
/** 
 * Finds the remote display with the specified id, returns null if not found.
 * @param id Id of the remote display.
 */
public RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}
Program: 222
Project: 222
Buggy source:
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.mPresentationDisplay=choosePresentationDisplayForRoute(newRoute,sStatic.getAllPresentationDisplays());
  return newRoute;
}

Fixed version (ground truth):
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.updatePresentationDisplay();
  return newRoute;
}
Program: 223
Project: 223
Buggy source:
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplay=getDisplayForGlobalRoute(globalRoute);
  return route;
}

Fixed version (ground truth):
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplayId=globalRoute.presentationDisplayId;
  route.updatePresentationDisplay();
  return route;
}
Program: 224
Project: 224
Buggy source:
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.mPresentationDisplay=choosePresentationDisplayForRoute(mDefaultAudioVideo,getAllPresentationDisplays());
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}

Fixed version (ground truth):
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.updatePresentationDisplay();
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}
Program: 225
Project: 225
Buggy source:
private void updatePresentationDisplays(int changedDisplayId){
  final Display[] displays=getAllPresentationDisplays();
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo info=mRoutes.get(i);
    Display display=choosePresentationDisplayForRoute(info,displays);
    if (display != info.mPresentationDisplay || (display != null && display.getDisplayId() == changedDisplayId)) {
      info.mPresentationDisplay=display;
      dispatchRoutePresentationDisplayChanged(info);
    }
  }
}

Fixed version (ground truth):
private void updatePresentationDisplays(int changedDisplayId){
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo route=mRoutes.get(i);
    if (route.updatePresentationDisplay() || (route.mPresentationDisplay != null && route.mPresentationDisplay.getDisplayId() == changedDisplayId)) {
      dispatchRoutePresentationDisplayChanged(route);
    }
  }
}
Program: 227
Project: 227
Buggy source:
RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}

Fixed version (ground truth):
/** 
 * Finds the remote display with the specified id, returns null if not found.
 * @param id Id of the remote display.
 */
public RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}
Program: 228
Project: 228
Buggy source:
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.mPresentationDisplay=choosePresentationDisplayForRoute(newRoute,sStatic.getAllPresentationDisplays());
  return newRoute;
}

Fixed version (ground truth):
static RouteInfo makeWifiDisplayRoute(WifiDisplay display,WifiDisplayStatus wfdStatus){
  final RouteInfo newRoute=new RouteInfo(sStatic.mSystemCategory);
  newRoute.mDeviceAddress=display.getDeviceAddress();
  newRoute.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO | ROUTE_TYPE_REMOTE_DISPLAY;
  newRoute.mVolumeHandling=RouteInfo.PLAYBACK_VOLUME_FIXED;
  newRoute.mPlaybackType=RouteInfo.PLAYBACK_TYPE_REMOTE;
  newRoute.setStatusCode(getWifiDisplayStatusCode(display,wfdStatus));
  newRoute.mEnabled=isWifiDisplayEnabled(display,wfdStatus);
  newRoute.mName=display.getFriendlyDisplayName();
  newRoute.mDescription=sStatic.mResources.getText(com.android.internal.R.string.wireless_display_route_description);
  newRoute.updatePresentationDisplay();
  return newRoute;
}
Program: 229
Project: 229
Buggy source:
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplay=getDisplayForGlobalRoute(globalRoute);
  return route;
}

Fixed version (ground truth):
RouteInfo makeGlobalRoute(MediaRouterClientState.RouteInfo globalRoute){
  RouteInfo route=new RouteInfo(sStatic.mSystemCategory);
  route.mGlobalRouteId=globalRoute.id;
  route.mName=globalRoute.name;
  route.mDescription=globalRoute.description;
  route.mSupportedTypes=globalRoute.supportedTypes;
  route.mEnabled=globalRoute.enabled;
  route.setStatusCode(globalRoute.statusCode);
  route.mPlaybackType=globalRoute.playbackType;
  route.mPlaybackStream=globalRoute.playbackStream;
  route.mVolume=globalRoute.volume;
  route.mVolumeMax=globalRoute.volumeMax;
  route.mVolumeHandling=globalRoute.volumeHandling;
  route.mPresentationDisplayId=globalRoute.presentationDisplayId;
  route.updatePresentationDisplay();
  return route;
}
Program: 230
Project: 230
Buggy source:
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.mPresentationDisplay=choosePresentationDisplayForRoute(mDefaultAudioVideo,getAllPresentationDisplays());
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}

Fixed version (ground truth):
void startMonitoringRoutes(Context appContext){
  mDefaultAudioVideo=new RouteInfo(mSystemCategory);
  mDefaultAudioVideo.mNameResId=com.android.internal.R.string.default_audio_route_name;
  mDefaultAudioVideo.mSupportedTypes=ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO;
  mDefaultAudioVideo.updatePresentationDisplay();
  addRouteStatic(mDefaultAudioVideo);
  updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus());
  appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(),new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
  appContext.registerReceiver(new VolumeChangeReceiver(),new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
  mDisplayService.registerDisplayListener(this,mHandler);
  AudioRoutesInfo newAudioRoutes=null;
  try {
    newAudioRoutes=mAudioService.startWatchingRoutes(mAudioRoutesObserver);
  }
 catch (  RemoteException e) {
  }
  if (newAudioRoutes != null) {
    updateAudioRoutes(newAudioRoutes);
  }
  rebindAsUser(UserHandle.myUserId());
  if (mSelectedRoute == null) {
    selectDefaultRouteStatic();
  }
}
Program: 231
Project: 231
Buggy source:
private void updatePresentationDisplays(int changedDisplayId){
  final Display[] displays=getAllPresentationDisplays();
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo info=mRoutes.get(i);
    Display display=choosePresentationDisplayForRoute(info,displays);
    if (display != info.mPresentationDisplay || (display != null && display.getDisplayId() == changedDisplayId)) {
      info.mPresentationDisplay=display;
      dispatchRoutePresentationDisplayChanged(info);
    }
  }
}

Fixed version (ground truth):
private void updatePresentationDisplays(int changedDisplayId){
  final int count=mRoutes.size();
  for (int i=0; i < count; i++) {
    final RouteInfo route=mRoutes.get(i);
    if (route.updatePresentationDisplay() || (route.mPresentationDisplay != null && route.mPresentationDisplay.getDisplayId() == changedDisplayId)) {
      dispatchRoutePresentationDisplayChanged(route);
    }
  }
}
Program: 233
Project: 233
Buggy source:
RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}

Fixed version (ground truth):
/** 
 * Finds the remote display with the specified id, returns null if not found.
 * @param id Id of the remote display.
 */
public RemoteDisplay findRemoteDisplay(String id){
  return mDisplays.get(id);
}
Program: 234
Project: 234
Buggy source:
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result=true;
  if (r != null) {
    padding.set(r);
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result;
  if (r != null) {
    padding.set(r);
    result=(r.left | r.top | r.bottom| r.right) != 0;
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}
Program: 235
Project: 235
Buggy source:
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return (padding.left | padding.top | padding.right| padding.bottom) != 0;
}
Program: 236
Project: 236
Buggy source:
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result=true;
  if (r != null) {
    padding.set(r);
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result;
  if (r != null) {
    padding.set(r);
    result=(r.left | r.top | r.bottom| r.right) != 0;
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}
Program: 237
Project: 237
Buggy source:
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return (padding.left | padding.top | padding.right| padding.bottom) != 0;
}
Program: 238
Project: 238
Buggy source:
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result=true;
  if (r != null) {
    padding.set(r);
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result;
  if (r != null) {
    padding.set(r);
    result=(r.left | r.top | r.bottom| r.right) != 0;
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}
Program: 239
Project: 239
Buggy source:
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return (padding.left | padding.top | padding.right| padding.bottom) != 0;
}
Program: 240
Project: 240
Buggy source:
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}

Fixed version (ground truth):
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}
Program: 241
Project: 241
Buggy source:
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dump(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}

Fixed version (ground truth):
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 242
Project: 242
Buggy source:
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStartedState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}

Fixed version (ground truth):
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStarted) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}
Program: 243
Project: 243
Buggy source:
void incStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
}

Fixed version (ground truth):
void incStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices + 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_SERVICE_RESTARTING + (memFactor * STATE_COUNT),now);
  }
}