nus-yam/ex-repair huggingface dataset:
Program: 23170
Project: 23170
Buggy source:
void addProvidersForPackageLocked(String pkgName){
  Intent intent=new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
  List<ResolveInfo> broadcastReceivers=mPackageManager.queryBroadcastReceivers(intent,PackageManager.GET_META_DATA);
  final int N=broadcastReceivers.size();
  for (int i=0; i < N; i++) {
    ResolveInfo ri=broadcastReceivers.get(i);
    ActivityInfo ai=ri.activityInfo;
    if (pkgName.equals(ai.packageName)) {
      addProviderLocked(ri);
    }
  }
}

Fixed version (ground truth):
void addProvidersForPackageLocked(String pkgName){
  Intent intent=new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
  intent.setPackage(pkgName);
  List<ResolveInfo> broadcastReceivers=mPackageManager.queryBroadcastReceivers(intent,PackageManager.GET_META_DATA);
  final int N=broadcastReceivers.size();
  for (int i=0; i < N; i++) {
    ResolveInfo ri=broadcastReceivers.get(i);
    ActivityInfo ai=ri.activityInfo;
    if (pkgName.equals(ai.packageName)) {
      addProviderLocked(ri);
    }
  }
}
Program: 23171
Project: 23171
Buggy source:
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  try {
    ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE)).stopSearch();
    if (mSearchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (mSearchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  SearchableInfo searchable=mSearchable;
  cancel();
  try {
    if (searchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (searchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}
Program: 23172
Project: 23172
Buggy source:
private DateFormat getDateFormat(){
  String format=Settings.System.getString(getContext().getContentResolver(),Settings.System.DATE_FORMAT);
  if ("String_Node_Str".equals(format)) {
    return DateFormat.getDateInstance(DateFormat.SHORT);
  }
 else {
    return new SimpleDateFormat(format);
  }
}

Fixed version (ground truth):
private DateFormat getDateFormat(){
  String format=Settings.System.getString(getContext().getContentResolver(),Settings.System.DATE_FORMAT);
  if (format == null || "String_Node_Str".equals(format)) {
    return DateFormat.getDateInstance(DateFormat.SHORT);
  }
 else {
    return new SimpleDateFormat(format);
  }
}
Program: 23173
Project: 23173
Buggy source:
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  try {
    ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE)).stopSearch();
    if (mSearchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (mSearchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  SearchableInfo searchable=mSearchable;
  cancel();
  try {
    if (searchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (searchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}
Program: 23174
Project: 23174
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),1000);
  }
 else {
    sendIntents(mHeadsetState,mPrevHeadsetState,mHeadsetName);
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  int delay=0;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    delay=1000;
  }
 else {
    if (mHandler.hasMessages(0)) {
      delay=1000;
    }
  }
  mWakeLock.acquire();
  mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),delay);
}
Program: 23175
Project: 23175
Buggy source:
protected void startPhotoQuery(long photoId,Uri lookupKey){
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startPhotoQuery internal method to query contact photo by photo id and uri.
 * @param photoId the photo id.
 * @param lookupKey the lookup uri.
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
 */
protected void startPhotoQuery(long photoId,Uri lookupKey,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}
Program: 23176
Project: 23176
Buggy source:
private void startContactQuery(Uri contactUri){
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startContactQuery internal method to query contact by Uri.
 * @param contactUri the contact uri
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not
 */
private void startContactQuery(Uri contactUri,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}
Program: 23177
Project: 23177
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param conatctUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  mContactUri=contactLookupUri;
  startContactQuery(contactLookupUri);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param contactLookupUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  bindFromContactUriInternal(contactLookupUri,true);
}
Program: 23178
Project: 23178
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param number The phone number used to do a reverse lookup inthe contacts database. If more than one contact contains this phone number, one of them will be chosen to bind to.
 */
public void bindFromPhoneNumber(String number){
  mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,number,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(number)),PHONE_LOOKUP_PROJECTION,null,null,null);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param number The phone number used to do a reverse lookup inthe contacts database. If more than one contact contains this phone number, one of them will be chosen to bind to.
 */
public void bindFromPhoneNumber(String number){
  resetAsyncQueryHandler();
  mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,number,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(number)),PHONE_LOOKUP_PROJECTION,null,null,null);
}
Program: 23179
Project: 23179
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param emailAddress The email address used to do a reverse lookup inthe contacts database. If more than one contact contains this email address, one of them will be chosen to bind to.
 */
public void bindFromEmail(String emailAddress){
  mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,emailAddress,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(emailAddress)),EMAIL_LOOKUP_PROJECTION,null,null,null);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param emailAddress The email address used to do a reverse lookup inthe contacts database. If more than one contact contains this email address, one of them will be chosen to bind to.
 */
public void bindFromEmail(String emailAddress){
  resetAsyncQueryHandler();
  mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,emailAddress,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(emailAddress)),EMAIL_LOOKUP_PROJECTION,null,null,null);
}
Program: 23180
Project: 23180
Buggy source:
/** 
 * Method to force this widget to forget everything it knows about the contact. The widget isn't automatically updated or redrawn.
 */
public void wipeClean(){
  setDisplayName(null,null);
  setPhoto(null);
  setSocialSnippet(null);
  mContactUri=null;
  mExcludeMimes=null;
}

Fixed version (ground truth):
/** 
 * Method to force this widget to forget everything it knows about the contact. We need to stop any existing async queries for phone, email, contact, and photos.
 */
public void wipeClean(){
  resetAsyncQueryHandler();
  setDisplayName(null,null);
  setPhoto(loadPlaceholderPhoto(null));
  setSocialSnippet(null);
  setPresence(0);
  mContactUri=null;
  mExcludeMimes=null;
}
Program: 23181
Project: 23181
Buggy source:
public ContactHeaderWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mContentResolver=mContext.getContentResolver();
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.contact_header,this);
  mDisplayNameView=(TextView)findViewById(R.id.name);
  mAggregateBadge=findViewById(R.id.aggregate_badge);
  mAggregateBadge.setVisibility(View.GONE);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mStarredView=(CheckBox)findViewById(R.id.star);
  mStarredView.setOnClickListener(this);
  mPhotoView=(QuickContactBadge)findViewById(R.id.photo);
  mPresenceView=(ImageView)findViewById(R.id.presence);
  mStatusView=(TextView)findViewById(R.id.status);
  mStatusAttributionView=(TextView)findViewById(R.id.status_date);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  mQueryHandler=new QueryHandler(mContentResolver);
}

Fixed version (ground truth):
public ContactHeaderWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mContentResolver=mContext.getContentResolver();
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.contact_header,this);
  mDisplayNameView=(TextView)findViewById(R.id.name);
  mAggregateBadge=findViewById(R.id.aggregate_badge);
  mAggregateBadge.setVisibility(View.GONE);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mStarredView=(CheckBox)findViewById(R.id.star);
  mStarredView.setOnClickListener(this);
  mPhotoView=(QuickContactBadge)findViewById(R.id.photo);
  mPresenceView=(ImageView)findViewById(R.id.presence);
  mStatusView=(TextView)findViewById(R.id.status);
  mStatusAttributionView=(TextView)findViewById(R.id.status_date);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  resetAsyncQueryHandler();
}
Program: 23183
Project: 23183
Buggy source:
public void uploadToBufferObject(){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToBufferObject(mID);
}

Fixed version (ground truth):
public void uploadToBufferObject(){
  mRS.validate();
  mRS.nAllocationUploadToBufferObject(mID);
}
Program: 23184
Project: 23184
Buggy source:
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}

Fixed version (ground truth):
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}
Program: 23185
Project: 23185
Buggy source:
public void contextBindProgramFragmentStore(ProgramStore p){
  nContextBindProgramFragmentStore(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragmentStore(ProgramStore p){
  validate();
  nContextBindProgramFragmentStore(safeID(p));
}
Program: 23186
Project: 23186
Buggy source:
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  nContextSetSurface(w,h,mSurface);
}

Fixed version (ground truth):
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  validate();
  nContextSetSurface(w,h,mSurface);
}
Program: 23187
Project: 23187
Buggy source:
public void destroy(){
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
public void destroy(){
  validate();
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 23188
Project: 23188
Buggy source:
public void contextBindProgramVertex(ProgramVertex p){
  nContextBindProgramVertex(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramVertex(ProgramVertex p){
  validate();
  nContextBindProgramVertex(safeID(p));
}
Program: 23189
Project: 23189
Buggy source:
public void contextBindProgramFragment(ProgramFragment p){
  nContextBindProgramFragment(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragment(ProgramFragment p){
  validate();
  nContextBindProgramFragment(safeID(p));
}
Program: 23190
Project: 23190
Buggy source:
void resume(){
  nContextResume();
}

Fixed version (ground truth):
void resume(){
  validate();
  nContextResume();
}
Program: 23191
Project: 23191
Buggy source:
public void contextBindRootScript(Script s){
  nContextBindRootScript(safeID(s));
}

Fixed version (ground truth):
public void contextBindRootScript(Script s){
  validate();
  nContextBindRootScript(safeID(s));
}
Program: 23192
Project: 23192
Buggy source:
public void contextDump(int bits){
  nContextDump(bits);
}

Fixed version (ground truth):
public void contextDump(int bits){
  validate();
  nContextDump(bits);
}
Program: 23193
Project: 23193
Buggy source:
void pause(){
  nContextPause();
}

Fixed version (ground truth):
void pause(){
  validate();
  nContextPause();
}
Program: 23194
Project: 23194
Buggy source:
public void contextBindProgramRaster(ProgramRaster p){
  nContextBindProgramRaster(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramRaster(ProgramRaster p){
  validate();
  nContextBindProgramRaster(safeID(p));
}
Program: 23195
Project: 23195
Buggy source:
public void contextSetPriority(Priority p){
  nContextSetPriority(p.mID);
}

Fixed version (ground truth):
public void contextSetPriority(Priority p){
  validate();
  nContextSetPriority(p.mID);
}
Program: 23200
Project: 23200
Buggy source:
public void uploadToBufferObject(){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToBufferObject(mID);
}

Fixed version (ground truth):
public void uploadToBufferObject(){
  mRS.validate();
  mRS.nAllocationUploadToBufferObject(mID);
}
Program: 23201
Project: 23201
Buggy source:
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}

Fixed version (ground truth):
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}
Program: 23202
Project: 23202
Buggy source:
public void contextBindProgramFragmentStore(ProgramStore p){
  nContextBindProgramFragmentStore(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragmentStore(ProgramStore p){
  validate();
  nContextBindProgramFragmentStore(safeID(p));
}
Program: 23203
Project: 23203
Buggy source:
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  nContextSetSurface(w,h,mSurface);
}

Fixed version (ground truth):
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  validate();
  nContextSetSurface(w,h,mSurface);
}
Program: 23204
Project: 23204
Buggy source:
public void destroy(){
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
public void destroy(){
  validate();
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 23205
Project: 23205
Buggy source:
public void contextBindProgramVertex(ProgramVertex p){
  nContextBindProgramVertex(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramVertex(ProgramVertex p){
  validate();
  nContextBindProgramVertex(safeID(p));
}
Program: 23206
Project: 23206
Buggy source:
public void contextBindProgramFragment(ProgramFragment p){
  nContextBindProgramFragment(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragment(ProgramFragment p){
  validate();
  nContextBindProgramFragment(safeID(p));
}
Program: 23207
Project: 23207
Buggy source:
void resume(){
  nContextResume();
}

Fixed version (ground truth):
void resume(){
  validate();
  nContextResume();
}
Program: 23208
Project: 23208
Buggy source:
public void contextBindRootScript(Script s){
  nContextBindRootScript(safeID(s));
}

Fixed version (ground truth):
public void contextBindRootScript(Script s){
  validate();
  nContextBindRootScript(safeID(s));
}
Program: 23209
Project: 23209
Buggy source:
public void contextDump(int bits){
  nContextDump(bits);
}

Fixed version (ground truth):
public void contextDump(int bits){
  validate();
  nContextDump(bits);
}
Program: 23210
Project: 23210
Buggy source:
void pause(){
  nContextPause();
}

Fixed version (ground truth):
void pause(){
  validate();
  nContextPause();
}
Program: 23211
Project: 23211
Buggy source:
public void contextBindProgramRaster(ProgramRaster p){
  nContextBindProgramRaster(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramRaster(ProgramRaster p){
  validate();
  nContextBindProgramRaster(safeID(p));
}
Program: 23212
Project: 23212
Buggy source:
public void contextSetPriority(Priority p){
  nContextSetPriority(p.mID);
}

Fixed version (ground truth):
public void contextSetPriority(Priority p){
  validate();
  nContextSetPriority(p.mID);
}
Program: 23214
Project: 23214
Buggy source:
private native void nativeUpdateLayers(int layer,int updates);

Fixed version (ground truth):
private native void nativeUpdateLayers(int updates);
Program: 23215
Project: 23215
Buggy source:
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode,mICallBack);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 23216
Project: 23216
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();
  mMode=AudioSystem.MODE_NORMAL;
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,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;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
}
Program: 23217
Project: 23217
Buggy source:
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}

Fixed version (ground truth):
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode,IBinder cb){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
synchronized (mSetModeDeathHandlers) {
          SetModeDeathHandler hdlr=null;
          Iterator iter=mSetModeDeathHandlers.iterator();
          while (iter.hasNext()) {
            SetModeDeathHandler h=(SetModeDeathHandler)iter.next();
            if (h.getBinder() == cb) {
              hdlr=h;
              iter.remove();
              break;
            }
          }
          if (hdlr == null) {
            hdlr=new SetModeDeathHandler(cb);
            if (cb != null) {
              try {
                cb.linkToDeath(hdlr,0);
              }
 catch (              RemoteException e) {
                Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
              }
            }
          }
          mSetModeDeathHandlers.add(0,hdlr);
          hdlr.setMode(mode);
        }
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}
Program: 23218
Project: 23218
Buggy source:
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode,mICallBack);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 23219
Project: 23219
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();
  mMode=AudioSystem.MODE_NORMAL;
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,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;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
}
Program: 23220
Project: 23220
Buggy source:
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}

Fixed version (ground truth):
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode,IBinder cb){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
synchronized (mSetModeDeathHandlers) {
          SetModeDeathHandler hdlr=null;
          Iterator iter=mSetModeDeathHandlers.iterator();
          while (iter.hasNext()) {
            SetModeDeathHandler h=(SetModeDeathHandler)iter.next();
            if (h.getBinder() == cb) {
              hdlr=h;
              iter.remove();
              break;
            }
          }
          if (hdlr == null) {
            hdlr=new SetModeDeathHandler(cb);
            if (cb != null) {
              try {
                cb.linkToDeath(hdlr,0);
              }
 catch (              RemoteException e) {
                Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
              }
            }
          }
          mSetModeDeathHandlers.add(0,hdlr);
          hdlr.setMode(mode);
        }
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}
Program: 23222
Project: 23222
Buggy source:
ArrayList<String> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<String> ret=new ArrayList<String>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(key);
    }
  }
  return ret;
}

Fixed version (ground truth):
ArrayList<PackageSetting> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<PackageSetting> ret=new ArrayList<PackageSetting>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(ps);
    }
  }
  return ret;
}
Program: 23223
Project: 23223
Buggy source:
void cleanupInstallFailedPackage(String packageName){
  if (mInstaller != null) {
    int retCode=mInstaller.remove(packageName);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(packageName);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  mSettings.removePackageLP(packageName);
}

Fixed version (ground truth):
void cleanupInstallFailedPackage(PackageSetting ps){
  Log.i(TAG,"String_Node_Str" + ps.name);
  if (mInstaller != null) {
    int retCode=mInstaller.remove(ps.name);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + ps.name + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(ps.name);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  if (ps.codePath != null) {
    if (!ps.codePath.delete()) {
      Log.w(TAG,"String_Node_Str" + ps.codePath);
    }
  }
  if (ps.resourcePath != null) {
    if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
      Log.w(TAG,"String_Node_Str" + ps.resourcePath);
    }
  }
  mSettings.removePackageLP(ps.name);
}
Program: 23225
Project: 23225
Buggy source:
ArrayList<String> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<String> ret=new ArrayList<String>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(key);
    }
  }
  return ret;
}

Fixed version (ground truth):
ArrayList<PackageSetting> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<PackageSetting> ret=new ArrayList<PackageSetting>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(ps);
    }
  }
  return ret;
}
Program: 23226
Project: 23226
Buggy source:
void cleanupInstallFailedPackage(String packageName){
  if (mInstaller != null) {
    int retCode=mInstaller.remove(packageName);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(packageName);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  mSettings.removePackageLP(packageName);
}

Fixed version (ground truth):
void cleanupInstallFailedPackage(PackageSetting ps){
  Log.i(TAG,"String_Node_Str" + ps.name);
  if (mInstaller != null) {
    int retCode=mInstaller.remove(ps.name);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + ps.name + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(ps.name);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  if (ps.codePath != null) {
    if (!ps.codePath.delete()) {
      Log.w(TAG,"String_Node_Str" + ps.codePath);
    }
  }
  if (ps.resourcePath != null) {
    if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
      Log.w(TAG,"String_Node_Str" + ps.resourcePath);
    }
  }
  mSettings.removePackageLP(ps.name);
}
Program: 23228
Project: 23228
Buggy source:
ArrayList<String> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<String> ret=new ArrayList<String>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(key);
    }
  }
  return ret;
}

Fixed version (ground truth):
ArrayList<PackageSetting> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<PackageSetting> ret=new ArrayList<PackageSetting>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(ps);
    }
  }
  return ret;
}
Program: 23229
Project: 23229
Buggy source:
void cleanupInstallFailedPackage(String packageName){
  if (mInstaller != null) {
    int retCode=mInstaller.remove(packageName);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(packageName);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  mSettings.removePackageLP(packageName);
}

Fixed version (ground truth):
void cleanupInstallFailedPackage(PackageSetting ps){
  Log.i(TAG,"String_Node_Str" + ps.name);
  if (mInstaller != null) {
    int retCode=mInstaller.remove(ps.name);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + ps.name + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(ps.name);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  if (ps.codePath != null) {
    if (!ps.codePath.delete()) {
      Log.w(TAG,"String_Node_Str" + ps.codePath);
    }
  }
  if (ps.resourcePath != null) {
    if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
      Log.w(TAG,"String_Node_Str" + ps.resourcePath);
    }
  }
  mSettings.removePackageLP(ps.name);
}
Program: 23230
Project: 23230
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),1000);
  }
 else {
    sendIntents(mHeadsetState,mPrevHeadsetState,mHeadsetName);
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  int delay=0;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    delay=1000;
  }
 else {
    if (mHandler.hasMessages(0)) {
      delay=1000;
    }
  }
  mWakeLock.acquire();
  mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),delay);
}
Program: 23231
Project: 23231
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),1000);
  }
 else {
    sendIntents(mHeadsetState,mPrevHeadsetState,mHeadsetName);
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  int delay=0;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    delay=1000;
  }
 else {
    if (mHandler.hasMessages(0)) {
      delay=1000;
    }
  }
  mWakeLock.acquire();
  mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),delay);
}
Program: 23232
Project: 23232
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),1000);
  }
 else {
    sendIntents(mHeadsetState,mPrevHeadsetState,mHeadsetName);
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  int delay=0;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    delay=1000;
  }
 else {
    if (mHandler.hasMessages(0)) {
      delay=1000;
    }
  }
  mWakeLock.acquire();
  mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),delay);
}
Program: 23234
Project: 23234
Buggy source:
public void postNotification(){
  if (foregroundId != 0 && foregroundNoti != null) {
    INotificationManager inm=NotificationManager.getService();
    if (inm != null) {
      try {
        int[] outId=new int[1];
        inm.enqueueNotification(packageName,foregroundId,foregroundNoti,outId);
      }
 catch (      RemoteException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void postNotification(){
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        INotificationManager inm=NotificationManager.getService();
        if (inm == null) {
          return;
        }
        try {
          int[] outId=new int[1];
          inm.enqueueNotification(localPackageName,localForegroundId,localForegroundNoti,outId);
        }
 catch (        RemoteException e) {
        }
      }
    }
);
  }
}
Program: 23235
Project: 23235
Buggy source:
public void cancelNotification(){
  if (foregroundId != 0) {
    INotificationManager inm=NotificationManager.getService();
    if (inm != null) {
      try {
        inm.cancelNotification(packageName,foregroundId);
      }
 catch (      RemoteException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void cancelNotification(){
  if (foregroundId != 0) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    ams.mHandler.post(new Runnable(){
      public void run(){
        INotificationManager inm=NotificationManager.getService();
        if (inm == null) {
          return;
        }
        try {
          inm.cancelNotification(localPackageName,localForegroundId);
        }
 catch (        RemoteException e) {
        }
      }
    }
);
  }
}
Program: 23236
Project: 23236
Buggy source:
ServiceRecord(BatteryStatsImpl.Uid.Pkg.Serv servStats,ComponentName name,Intent.FilterComparison intent,ServiceInfo sInfo,Runnable restarter){
  this.stats=servStats;
  this.name=name;
  shortName=name.flattenToShortString();
  this.intent=intent;
  serviceInfo=sInfo;
  appInfo=sInfo.applicationInfo;
  packageName=sInfo.applicationInfo.packageName;
  processName=sInfo.processName;
  permission=sInfo.permission;
  baseDir=sInfo.applicationInfo.sourceDir;
  resDir=sInfo.applicationInfo.publicSourceDir;
  dataDir=sInfo.applicationInfo.dataDir;
  exported=sInfo.exported;
  this.restarter=restarter;
  createTime=lastActivity=SystemClock.uptimeMillis();
}

Fixed version (ground truth):
ServiceRecord(ActivityManagerService ams,BatteryStatsImpl.Uid.Pkg.Serv servStats,ComponentName name,Intent.FilterComparison intent,ServiceInfo sInfo,Runnable restarter){
  this.ams=ams;
  this.stats=servStats;
  this.name=name;
  shortName=name.flattenToShortString();
  this.intent=intent;
  serviceInfo=sInfo;
  appInfo=sInfo.applicationInfo;
  packageName=sInfo.applicationInfo.packageName;
  processName=sInfo.processName;
  permission=sInfo.permission;
  baseDir=sInfo.applicationInfo.sourceDir;
  resDir=sInfo.applicationInfo.publicSourceDir;
  dataDir=sInfo.applicationInfo.dataDir;
  exported=sInfo.exported;
  this.restarter=restarter;
  createTime=lastActivity=SystemClock.uptimeMillis();
}
Program: 23237
Project: 23237
Buggy source:
protected void startPhotoQuery(long photoId,Uri lookupKey){
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startPhotoQuery internal method to query contact photo by photo id and uri.
 * @param photoId the photo id.
 * @param lookupKey the lookup uri.
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
 */
protected void startPhotoQuery(long photoId,Uri lookupKey,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}
Program: 23238
Project: 23238
Buggy source:
private void startContactQuery(Uri contactUri){
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startContactQuery internal method to query contact by Uri.
 * @param contactUri the contact uri
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not
 */
private void startContactQuery(Uri contactUri,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}
Program: 23239
Project: 23239
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param conatctUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  mContactUri=contactLookupUri;
  startContactQuery(contactLookupUri);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param contactLookupUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  bindFromContactUriInternal(contactLookupUri,true);
}