nus-yam/ex-repair huggingface dataset:
Program: 41736
Project: 41736
Buggy source:
/** 
 * Try to parse this message as an email gateway message There are two ways specified in TS 23.040 Section 3.8 : - SMS message "may have its TP-PID set for internet electronic mail - MT SMS format: [<from-address><space>]<message> - "Depending on the nature of the gateway, the destination/origination address is either derived from the content of the SMS TP-OA or TP-DA field, or the TP-OA/TP-DA field contains a generic gateway address and the to/from address is added at the beginning as shown above." (which is supported here) - Multiple addreses separated by commas, no spaces, Subject field delimited by '()' or '##' and '#' Section 9.2.3.24.11 (which are NOT supported here)
 */
protected void extractEmailAddressFromMessageBody(){
  String[] parts=messageBody.split("String_Node_Str",2);
  if (parts.length < 2)   return;
  emailFrom=parts[0];
  emailBody=parts[1];
  isEmail=true;
}

Fixed version (ground truth):
/** 
 * Try to parse this message as an email gateway message There are two ways specified in TS 23.040 Section 3.8 : - SMS message "may have its TP-PID set for internet electronic mail - MT SMS format: [<from-address><space>]<message> - "Depending on the nature of the gateway, the destination/origination address is either derived from the content of the SMS TP-OA or TP-DA field, or the TP-OA/TP-DA field contains a generic gateway address and the to/from address is added at the beginning as shown above." (which is supported here) - Multiple addreses separated by commas, no spaces, Subject field delimited by '()' or '##' and '#' Section 9.2.3.24.11 (which are NOT supported here)
 */
protected void extractEmailAddressFromMessageBody(){
  String[] parts=messageBody.split("String_Node_Str",2);
  if (parts.length < 2)   return;
  emailFrom=parts[0];
  emailBody=parts[1];
  isEmail=Telephony.Mms.isEmailAddress(emailFrom);
}
Program: 41737
Project: 41737
Buggy source:
private final boolean updateOomAdjLocked(){
  boolean didOomAdj=true;
  final HistoryRecord TOP_ACT=resumedAppLocked();
  final ProcessRecord TOP_APP=TOP_ACT != null ? TOP_ACT.app : null;
  if (false) {
    RuntimeException e=new RuntimeException();
    e.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + TOP_ACT,e);
  }
  mAdjSeq++;
  int numSlots=HIDDEN_APP_MAX_ADJ - HIDDEN_APP_MIN_ADJ + 1;
  int factor=(mLruProcesses.size() - 4) / numSlots;
  if (factor < 1)   factor=1;
  int step=0;
  int numHidden=0;
  int i=mLruProcesses.size();
  int curHiddenAdj=HIDDEN_APP_MIN_ADJ;
  while (i > 0) {
    i--;
    ProcessRecord app=mLruProcesses.get(i);
    if (updateOomAdjLocked(app,curHiddenAdj,TOP_APP)) {
      if (curHiddenAdj < EMPTY_APP_ADJ && app.curAdj == curHiddenAdj) {
        step++;
        if (step >= factor) {
          step=0;
          curHiddenAdj++;
        }
      }
      if (app.curAdj >= HIDDEN_APP_MIN_ADJ) {
        numHidden++;
        if (numHidden > MAX_HIDDEN_APPS) {
          Slog.i(TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str"+ numHidden+ "String_Node_Str"+ MAX_HIDDEN_APPS);
          EventLog.writeEvent(EventLogTags.AM_KILL,app.pid,app.processName,app.setAdj,"String_Node_Str");
          Process.killProcess(app.pid);
        }
      }
    }
 else {
      didOomAdj=false;
    }
  }
  return ENFORCE_PROCESS_LIMIT || mProcessLimit > 0 ? false : didOomAdj;
}

Fixed version (ground truth):
private final boolean updateOomAdjLocked(){
  boolean didOomAdj=true;
  final HistoryRecord TOP_ACT=resumedAppLocked();
  final ProcessRecord TOP_APP=TOP_ACT != null ? TOP_ACT.app : null;
  if (false) {
    RuntimeException e=new RuntimeException();
    e.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + TOP_ACT,e);
  }
  mAdjSeq++;
  int numSlots=HIDDEN_APP_MAX_ADJ - HIDDEN_APP_MIN_ADJ + 1;
  int factor=(mLruProcesses.size() - 4) / numSlots;
  if (factor < 1)   factor=1;
  int step=0;
  int numHidden=0;
  int i=mLruProcesses.size();
  int curHiddenAdj=HIDDEN_APP_MIN_ADJ;
  while (i > 0) {
    i--;
    ProcessRecord app=mLruProcesses.get(i);
    if (updateOomAdjLocked(app,curHiddenAdj,TOP_APP)) {
      if (curHiddenAdj < EMPTY_APP_ADJ && app.curAdj == curHiddenAdj) {
        step++;
        if (step >= factor) {
          step=0;
          curHiddenAdj++;
        }
      }
      if (app.curAdj >= HIDDEN_APP_MIN_ADJ) {
        if (!app.killedBackground) {
          numHidden++;
          if (numHidden > MAX_HIDDEN_APPS) {
            Slog.i(TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str"+ numHidden+ "String_Node_Str"+ MAX_HIDDEN_APPS);
            EventLog.writeEvent(EventLogTags.AM_KILL,app.pid,app.processName,app.setAdj,"String_Node_Str");
            app.killedBackground=true;
            Process.killProcess(app.pid);
          }
        }
      }
    }
 else {
      didOomAdj=false;
    }
  }
  return ENFORCE_PROCESS_LIMIT || mProcessLimit > 0 ? false : didOomAdj;
}
Program: 41739
Project: 41739
Buggy source:
void killAppAtUsersRequest(ProcessRecord app,Dialog fromDialog){
synchronized (this) {
    app.crashing=false;
    app.crashingReport=null;
    app.notResponding=false;
    app.notRespondingReport=null;
    if (app.anrDialog == fromDialog) {
      app.anrDialog=null;
    }
    if (app.waitDialog == fromDialog) {
      app.waitDialog=null;
    }
    if (app.pid > 0 && app.pid != MY_PID) {
      handleAppCrashLocked(app);
      Slog.i(ActivityManagerService.TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str");
      Process.killProcess(app.pid);
    }
  }
}

Fixed version (ground truth):
void killAppAtUsersRequest(ProcessRecord app,Dialog fromDialog){
synchronized (this) {
    app.crashing=false;
    app.crashingReport=null;
    app.notResponding=false;
    app.notRespondingReport=null;
    if (app.anrDialog == fromDialog) {
      app.anrDialog=null;
    }
    if (app.waitDialog == fromDialog) {
      app.waitDialog=null;
    }
    if (app.pid > 0 && app.pid != MY_PID) {
      handleAppCrashLocked(app);
      Slog.i(ActivityManagerService.TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str");
      EventLog.writeEvent(EventLogTags.AM_KILL,app.pid,app.processName,app.setAdj,"String_Node_Str");
      Process.killProcess(app.pid);
    }
  }
}
Program: 41740
Project: 41740
Buggy source:
private final boolean updateOomAdjLocked(){
  boolean didOomAdj=true;
  final HistoryRecord TOP_ACT=resumedAppLocked();
  final ProcessRecord TOP_APP=TOP_ACT != null ? TOP_ACT.app : null;
  if (false) {
    RuntimeException e=new RuntimeException();
    e.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + TOP_ACT,e);
  }
  mAdjSeq++;
  int numSlots=HIDDEN_APP_MAX_ADJ - HIDDEN_APP_MIN_ADJ + 1;
  int factor=(mLruProcesses.size() - 4) / numSlots;
  if (factor < 1)   factor=1;
  int step=0;
  int i=mLruProcesses.size();
  int curHiddenAdj=HIDDEN_APP_MIN_ADJ;
  while (i > 0) {
    i--;
    ProcessRecord app=mLruProcesses.get(i);
    if (updateOomAdjLocked(app,curHiddenAdj,TOP_APP)) {
      if (curHiddenAdj < EMPTY_APP_ADJ && app.curAdj == curHiddenAdj) {
        step++;
        if (step >= factor) {
          step=0;
          curHiddenAdj++;
        }
      }
    }
 else {
      didOomAdj=false;
    }
  }
  return ENFORCE_PROCESS_LIMIT || mProcessLimit > 0 ? false : didOomAdj;
}

Fixed version (ground truth):
private final boolean updateOomAdjLocked(){
  boolean didOomAdj=true;
  final HistoryRecord TOP_ACT=resumedAppLocked();
  final ProcessRecord TOP_APP=TOP_ACT != null ? TOP_ACT.app : null;
  if (false) {
    RuntimeException e=new RuntimeException();
    e.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + TOP_ACT,e);
  }
  mAdjSeq++;
  int numSlots=HIDDEN_APP_MAX_ADJ - HIDDEN_APP_MIN_ADJ + 1;
  int factor=(mLruProcesses.size() - 4) / numSlots;
  if (factor < 1)   factor=1;
  int step=0;
  int numHidden=0;
  int i=mLruProcesses.size();
  int curHiddenAdj=HIDDEN_APP_MIN_ADJ;
  while (i > 0) {
    i--;
    ProcessRecord app=mLruProcesses.get(i);
    if (updateOomAdjLocked(app,curHiddenAdj,TOP_APP)) {
      if (curHiddenAdj < EMPTY_APP_ADJ && app.curAdj == curHiddenAdj) {
        step++;
        if (step >= factor) {
          step=0;
          curHiddenAdj++;
        }
      }
      if (app.curAdj >= HIDDEN_APP_MIN_ADJ) {
        numHidden++;
        if (numHidden > MAX_HIDDEN_APPS) {
          Slog.i(TAG,"String_Node_Str" + app.processName + "String_Node_Str"+ app.pid+ "String_Node_Str"+ numHidden+ "String_Node_Str"+ MAX_HIDDEN_APPS);
          EventLog.writeEvent(EventLogTags.AM_KILL,app.pid,app.processName,app.setAdj,"String_Node_Str");
          Process.killProcess(app.pid);
        }
      }
    }
 else {
      didOomAdj=false;
    }
  }
  return ENFORCE_PROCESS_LIMIT || mProcessLimit > 0 ? false : didOomAdj;
}
Program: 41741
Project: 41741
Buggy source:
public boolean killPids(int[] pids,String pReason){
  if (Binder.getCallingUid() != Process.SYSTEM_UID) {
    throw new SecurityException("String_Node_Str");
  }
  String reason=(pReason == null) ? "String_Node_Str" : pReason;
  boolean killed=false;
synchronized (mPidsSelfLocked) {
    int[] types=new int[pids.length];
    int worstType=0;
    for (int i=0; i < pids.length; i++) {
      ProcessRecord proc=mPidsSelfLocked.get(pids[i]);
      if (proc != null) {
        int type=proc.setAdj;
        types[i]=type;
        if (type > worstType) {
          worstType=type;
        }
      }
    }
    if (worstType < EMPTY_APP_ADJ && worstType > HIDDEN_APP_MIN_ADJ) {
      worstType=HIDDEN_APP_MIN_ADJ;
    }
    Slog.w(TAG,"String_Node_Str" + reason + "String_Node_Str"+ worstType);
    for (int i=0; i < pids.length; i++) {
      ProcessRecord proc=mPidsSelfLocked.get(pids[i]);
      if (proc == null) {
        continue;
      }
      int adj=proc.setAdj;
      if (adj >= worstType) {
        Slog.w(TAG,"String_Node_Str" + reason + "String_Node_Str"+ proc+ "String_Node_Str"+ adj+ "String_Node_Str");
        EventLog.writeEvent(EventLogTags.AM_KILL,proc.pid,proc.processName,adj,reason);
        killed=true;
        Process.killProcess(pids[i]);
      }
    }
  }
  return killed;
}

Fixed version (ground truth):
public boolean killPids(int[] pids,String pReason){
  if (Binder.getCallingUid() != Process.SYSTEM_UID) {
    throw new SecurityException("String_Node_Str");
  }
  String reason=(pReason == null) ? "String_Node_Str" : pReason;
  boolean killed=false;
synchronized (mPidsSelfLocked) {
    int[] types=new int[pids.length];
    int worstType=0;
    for (int i=0; i < pids.length; i++) {
      ProcessRecord proc=mPidsSelfLocked.get(pids[i]);
      if (proc != null) {
        int type=proc.setAdj;
        types[i]=type;
        if (type > worstType) {
          worstType=type;
        }
      }
    }
    if (worstType < EMPTY_APP_ADJ && worstType > HIDDEN_APP_MIN_ADJ) {
      worstType=HIDDEN_APP_MIN_ADJ;
    }
    Slog.w(TAG,"String_Node_Str" + reason + "String_Node_Str"+ worstType);
    for (int i=0; i < pids.length; i++) {
      ProcessRecord proc=mPidsSelfLocked.get(pids[i]);
      if (proc == null) {
        continue;
      }
      int adj=proc.setAdj;
      if (adj >= worstType) {
        Slog.w(TAG,"String_Node_Str" + proc + "String_Node_Str"+ adj+ "String_Node_Str"+ reason);
        EventLog.writeEvent(EventLogTags.AM_KILL,proc.pid,proc.processName,adj,reason);
        killed=true;
        Process.killProcess(pids[i]);
      }
    }
  }
  return killed;
}
Program: 41742
Project: 41742
Buggy source:
private final void removeDyingProviderLocked(ProcessRecord proc,ContentProviderRecord cpr){
synchronized (cpr) {
    cpr.launchingApp=null;
    cpr.notifyAll();
  }
  mProvidersByClass.remove(cpr.info.name);
  String names[]=cpr.info.authority.split("String_Node_Str");
  for (int j=0; j < names.length; j++) {
    mProvidersByName.remove(names[j]);
  }
  Iterator<ProcessRecord> cit=cpr.clients.iterator();
  while (cit.hasNext()) {
    ProcessRecord capp=cit.next();
    if (!capp.persistent && capp.thread != null && capp.pid != 0 && capp.pid != MY_PID) {
      Slog.i(TAG,"String_Node_Str" + capp.processName + "String_Node_Str"+ capp.pid+ "String_Node_Str"+ cpr.info.name+ "String_Node_Str"+ proc.processName);
      Process.killProcess(capp.pid);
    }
  }
  mLaunchingProviders.remove(cpr);
}

Fixed version (ground truth):
private final void removeDyingProviderLocked(ProcessRecord proc,ContentProviderRecord cpr){
synchronized (cpr) {
    cpr.launchingApp=null;
    cpr.notifyAll();
  }
  mProvidersByClass.remove(cpr.info.name);
  String names[]=cpr.info.authority.split("String_Node_Str");
  for (int j=0; j < names.length; j++) {
    mProvidersByName.remove(names[j]);
  }
  Iterator<ProcessRecord> cit=cpr.clients.iterator();
  while (cit.hasNext()) {
    ProcessRecord capp=cit.next();
    if (!capp.persistent && capp.thread != null && capp.pid != 0 && capp.pid != MY_PID) {
      Slog.i(TAG,"String_Node_Str" + capp.processName + "String_Node_Str"+ capp.pid+ "String_Node_Str"+ cpr.info.name+ "String_Node_Str"+ proc.processName);
      EventLog.writeEvent(EventLogTags.AM_KILL,capp.pid,capp.processName,capp.setAdj,"String_Node_Str" + proc.processName);
      Process.killProcess(capp.pid);
    }
  }
  mLaunchingProviders.remove(cpr);
}
Program: 41743
Project: 41743
Buggy source:
public void setServiceForeground(ComponentName className,IBinder token,int id,Notification notification,boolean removeNotification){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      ServiceRecord r=findServiceLocked(className,token);
      if (r != null) {
        if (id != 0) {
          if (notification == null) {
            throw new IllegalArgumentException("String_Node_Str");
          }
          if (r.foregroundId != id) {
            r.cancelNotification();
            r.foregroundId=id;
          }
          notification.flags|=Notification.FLAG_FOREGROUND_SERVICE;
          r.foregroundNoti=notification;
          r.isForeground=true;
          r.postNotification();
          if (r.app != null) {
            updateServiceForegroundLocked(r.app,true);
          }
        }
 else {
          if (r.isForeground) {
            r.isForeground=false;
            if (r.app != null) {
              updateServiceForegroundLocked(r.app,true);
            }
          }
          if (removeNotification) {
            r.cancelNotification();
            r.foregroundId=0;
            r.foregroundNoti=null;
          }
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
public void setServiceForeground(ComponentName className,IBinder token,int id,Notification notification,boolean removeNotification){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      ServiceRecord r=findServiceLocked(className,token);
      if (r != null) {
        if (id != 0) {
          if (notification == null) {
            throw new IllegalArgumentException("String_Node_Str");
          }
          if (r.foregroundId != id) {
            r.cancelNotification();
            r.foregroundId=id;
          }
          notification.flags|=Notification.FLAG_FOREGROUND_SERVICE;
          r.foregroundNoti=notification;
          r.isForeground=true;
          r.postNotification();
          if (r.app != null) {
            updateServiceForegroundLocked(r.app,true);
          }
        }
 else {
          if (r.isForeground) {
            r.isForeground=false;
            if (r.app != null) {
              updateLruProcessLocked(r.app,false,true);
              updateServiceForegroundLocked(r.app,true);
            }
          }
          if (removeNotification) {
            r.cancelNotification();
            r.foregroundId=0;
            r.foregroundNoti=null;
          }
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 41744
Project: 41744
Buggy source:
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_CANCEL,listener));
  }
}

Fixed version (ground truth):
public void cancel(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_CANCEL,listener));
  }
}
Program: 41745
Project: 41745
Buggy source:
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_START_LISTENING,new StartListeningArgs(recognizerIntent,listener)));
  }
}

Fixed version (ground truth):
public void startListening(Intent recognizerIntent,IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_START_LISTENING,mInternalService.new StartListeningArgs(recognizerIntent,listener)));
  }
}
Program: 41746
Project: 41746
Buggy source:
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (checkPermissions(listener)) {
    mHandler.sendMessage(Message.obtain(mHandler,MSG_STOP_LISTENING,listener));
  }
}

Fixed version (ground truth):
public void stopListening(IRecognitionListener listener){
  if (DBG)   Log.d(TAG,"String_Node_Str" + listener.asBinder());
  if (mInternalService != null && mInternalService.checkPermissions(listener)) {
    mInternalService.mHandler.sendMessage(Message.obtain(mInternalService.mHandler,MSG_STOP_LISTENING,listener));
  }
}
Program: 41747
Project: 41747
Buggy source:
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
}

Fixed version (ground truth):
/** 
 * Destroys the   {@code SpeechRecognizer} object.
 */
public void destroy(){
  if (mConnection != null) {
    mContext.unbindService(mConnection);
  }
  mPendingTasks.clear();
  mService=null;
  mConnection=null;
  mListener.mInternalListener=null;
}
Program: 41749
Project: 41749
Buggy source:
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  mBluetoothHeadsetConnected=false;
  mBluetoothHeadset=new BluetoothHeadset(context,mBluetoothHeadsetServiceListener);
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  intentFilter.addAction(Intent.ACTION_DOCK_EVENT);
  intentFilter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
  intentFilter=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
  intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
  context.registerReceiver(mMediaButtonReceiver,intentFilter);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  mRingerModeMutedStreams=0;
  setRingerModeInt(getRingerMode(),false);
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  mBluetoothHeadsetConnected=false;
  mBluetoothHeadset=new BluetoothHeadset(context,mBluetoothHeadsetServiceListener);
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  intentFilter.addAction(Intent.ACTION_DOCK_EVENT);
  intentFilter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
  intentFilter=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
  intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
  context.registerReceiver(mMediaButtonReceiver,intentFilter);
}
Program: 41750
Project: 41750
Buggy source:
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  mBluetoothHeadsetConnected=false;
  mBluetoothHeadset=new BluetoothHeadset(context,mBluetoothHeadsetServiceListener);
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  intentFilter.addAction(Intent.ACTION_DOCK_EVENT);
  intentFilter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
  intentFilter=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
  intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
  context.registerReceiver(mMediaButtonReceiver,intentFilter);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  mRingerModeMutedStreams=0;
  setRingerModeInt(getRingerMode(),false);
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  mBluetoothHeadsetConnected=false;
  mBluetoothHeadset=new BluetoothHeadset(context,mBluetoothHeadsetServiceListener);
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  intentFilter.addAction(Intent.ACTION_DOCK_EVENT);
  intentFilter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
  intentFilter=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
  intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
  context.registerReceiver(mMediaButtonReceiver,intentFilter);
}
Program: 41751
Project: 41751
Buggy source:
private void makeA2dpDeviceUnavailableLater(String address){
  mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
  Message msg=mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT,address);
  mAudioHandler.sendMessageDelayed(msg,BTA2DP_DOCK_TIMEOUT_MILLIS);
}

Fixed version (ground truth):
private void makeA2dpDeviceUnavailableLater(String address){
  AudioSystem.setParameters("String_Node_Str");
  mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
  Message msg=mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT,address);
  mAudioHandler.sendMessageDelayed(msg,BTA2DP_DOCK_TIMEOUT_MILLIS);
}
Program: 41752
Project: 41752
Buggy source:
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  mBluetoothHeadsetConnected=false;
  mBluetoothHeadset=new BluetoothHeadset(context,mBluetoothHeadsetServiceListener);
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  intentFilter.addAction(Intent.ACTION_DOCK_EVENT);
  intentFilter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
  intentFilter=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
  intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
  context.registerReceiver(mMediaButtonReceiver,intentFilter);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  mRingerModeMutedStreams=0;
  setRingerModeInt(getRingerMode(),false);
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  mBluetoothHeadsetConnected=false;
  mBluetoothHeadset=new BluetoothHeadset(context,mBluetoothHeadsetServiceListener);
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  intentFilter.addAction(Intent.ACTION_DOCK_EVENT);
  intentFilter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
  intentFilter=new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
  intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
  context.registerReceiver(mMediaButtonReceiver,intentFilter);
}
Program: 41753
Project: 41753
Buggy source:
private void makeA2dpDeviceUnavailableLater(String address){
  mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
  Message msg=mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT,address);
  mAudioHandler.sendMessageDelayed(msg,BTA2DP_DOCK_TIMEOUT_MILLIS);
}

Fixed version (ground truth):
private void makeA2dpDeviceUnavailableLater(String address){
  AudioSystem.setParameters("String_Node_Str");
  mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
  Message msg=mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT,address);
  mAudioHandler.sendMessageDelayed(msg,BTA2DP_DOCK_TIMEOUT_MILLIS);
}
Program: 41754
Project: 41754
Buggy source:
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
}

Fixed version (ground truth):
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
  if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
    initialAwakenScrollBars();
    mPrivateFlags&=~AWAKEN_SCROLL_BARS_ON_ATTACH;
  }
}
Program: 41755
Project: 41755
Buggy source:
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
  if (visibility == VISIBLE) {
    if (mAttachInfo != null) {
      initialAwakenScrollBars();
    }
 else {
      mPrivateFlags|=AWAKEN_SCROLL_BARS_ON_ATTACH;
    }
  }
}
Program: 41756
Project: 41756
Buggy source:
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
  if (visibility == VISIBLE) {
    initialAwakenScrollBars();
  }
}
Program: 41757
Project: 41757
Buggy source:
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
}

Fixed version (ground truth):
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
  if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
    initialAwakenScrollBars();
    mPrivateFlags&=~AWAKEN_SCROLL_BARS_ON_ATTACH;
  }
}
Program: 41758
Project: 41758
Buggy source:
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
  if (visibility == VISIBLE) {
    if (mAttachInfo != null) {
      initialAwakenScrollBars();
    }
 else {
      mPrivateFlags|=AWAKEN_SCROLL_BARS_ON_ATTACH;
    }
  }
}
Program: 41759
Project: 41759
Buggy source:
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
  if (visibility == VISIBLE) {
    initialAwakenScrollBars();
  }
}
Program: 41760
Project: 41760
Buggy source:
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
}

Fixed version (ground truth):
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
  if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
    initialAwakenScrollBars();
    mPrivateFlags&=~AWAKEN_SCROLL_BARS_ON_ATTACH;
  }
}
Program: 41761
Project: 41761
Buggy source:
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
  if (visibility == VISIBLE) {
    if (mAttachInfo != null) {
      initialAwakenScrollBars();
    }
 else {
      mPrivateFlags|=AWAKEN_SCROLL_BARS_ON_ATTACH;
    }
  }
}
Program: 41762
Project: 41762
Buggy source:
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
  if (visibility == VISIBLE) {
    initialAwakenScrollBars();
  }
}
Program: 41763
Project: 41763
Buggy source:
private void makeA2dpDeviceUnavailableLater(String address){
  mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
  Message msg=mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT,address);
  mAudioHandler.sendMessageDelayed(msg,BTA2DP_DOCK_TIMEOUT_MILLIS);
}

Fixed version (ground truth):
private void makeA2dpDeviceUnavailableLater(String address){
  AudioSystem.setParameters("String_Node_Str");
  mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
  Message msg=mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT,address);
  mAudioHandler.sendMessageDelayed(msg,BTA2DP_DOCK_TIMEOUT_MILLIS);
}
Program: 41764
Project: 41764
Buggy source:
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
}

Fixed version (ground truth):
/** 
 * This is called when the view is attached to a window.  At this point it has a Surface and will start drawing.  Note that this function is guaranteed to be called before   {@link #onDraw}, however it may be called any time before the first onDraw -- including before or after  {@link #onMeasure}.
 * @see #onDetachedFromWindow()
 */
protected void onAttachedToWindow(){
  if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
    mParent.requestTransparentRegion(this);
  }
  if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
    initialAwakenScrollBars();
    mPrivateFlags&=~AWAKEN_SCROLL_BARS_ON_ATTACH;
  }
}
Program: 41765
Project: 41765
Buggy source:
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the visibility of the view or an ancestor of the view is changed.
 * @param changedView The view whose visibility changed. Could be 'this' oran ancestor view.
 * @param visibility The new visibility of changedView: {@link #VISIBLE},  {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(View changedView,int visibility){
  if (visibility == VISIBLE) {
    if (mAttachInfo != null) {
      initialAwakenScrollBars();
    }
 else {
      mPrivateFlags|=AWAKEN_SCROLL_BARS_ON_ATTACH;
    }
  }
}
Program: 41766
Project: 41766
Buggy source:
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
}

Fixed version (ground truth):
/** 
 * Called when the window containing has change its visibility (between   {@link #GONE},   {@link #INVISIBLE}, and   {@link #VISIBLE}).  Note that this tells you whether or not your window is being made visible to the window manager; this does <em>not</em> tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(int visibility){
  if (visibility == VISIBLE) {
    initialAwakenScrollBars();
  }
}
Program: 41767
Project: 41767
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    mPlayer.setOnCompletionListener(this);
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 41768
Project: 41768
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    mPlayer.setOnCompletionListener(this);
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 41769
Project: 41769
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    mPlayer.setOnCompletionListener(this);
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 41770
Project: 41770
Buggy source:
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    mPlayer.setOnCompletionListener(this);
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}

Fixed version (ground truth):
private void startSound(Command cmd){
  try {
    if (mDebug)     Log.d(mTag,"String_Node_Str");
    PlayerCreationThread t=new PlayerCreationThread(cmd);
synchronized (t) {
      t.start();
      t.wait();
    }
    long delay=SystemClock.uptimeMillis() - cmd.requestTime;
    if (delay > 1000) {
      Log.w(mTag,"String_Node_Str" + delay + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    Log.w(mTag,"String_Node_Str" + cmd.uri,e);
  }
}
Program: 41776
Project: 41776
Buggy source:
/** 
 * Checks if the adjustment should change ringer mode instead of just adjusting volume. If so, this will set the proper ringer mode and volume indices on the stream states.
 */
private boolean checkForRingerModeChange(int oldIndex,int direction){
  boolean adjustVolumeIndex=true;
  int newRingerMode=mRingerMode;
  if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
    if (direction == AudioManager.ADJUST_LOWER && (oldIndex + 5) / 10 == 1) {
      newRingerMode=System.getInt(mContentResolver,System.VIBRATE_IN_SILENT,1) == 1 ? AudioManager.RINGER_MODE_VIBRATE : AudioManager.RINGER_MODE_SILENT;
    }
  }
 else {
    if (direction == AudioManager.ADJUST_RAISE) {
      newRingerMode=AudioManager.RINGER_MODE_NORMAL;
    }
  }
  if (newRingerMode != mRingerMode) {
    setRingerMode(newRingerMode);
    adjustVolumeIndex=false;
  }
  return adjustVolumeIndex;
}

Fixed version (ground truth):
/** 
 * Checks if the adjustment should change ringer mode instead of just adjusting volume. If so, this will set the proper ringer mode and volume indices on the stream states.
 */
private boolean checkForRingerModeChange(int oldIndex,int direction){
  boolean adjustVolumeIndex=true;
  int newRingerMode=mRingerMode;
  if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
    if (direction == AudioManager.ADJUST_LOWER && (oldIndex + 5) / 10 == 1) {
      newRingerMode=System.getInt(mContentResolver,System.VIBRATE_IN_SILENT,1) == 1 ? AudioManager.RINGER_MODE_VIBRATE : AudioManager.RINGER_MODE_SILENT;
    }
  }
 else {
    if (direction == AudioManager.ADJUST_RAISE) {
      newRingerMode=AudioManager.RINGER_MODE_NORMAL;
    }
 else {
      adjustVolumeIndex=false;
    }
  }
  if (newRingerMode != mRingerMode) {
    setRingerMode(newRingerMode);
    adjustVolumeIndex=false;
  }
  return adjustVolumeIndex;
}