nus-yam/ex-repair huggingface dataset:
Program: 42335
Project: 42335
Buggy source:
public SyncAdapterType parseServiceAttributes(String packageName,AttributeSet attrs){
  TypedArray sa=mContext.getResources().obtainAttributes(attrs,com.android.internal.R.styleable.SyncAdapter);
  try {
    final String authority=sa.getString(com.android.internal.R.styleable.SyncAdapter_contentAuthority);
    final String accountType=sa.getString(com.android.internal.R.styleable.SyncAdapter_accountType);
    if (authority == null || accountType == null) {
      return null;
    }
    final boolean userVisible=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_userVisible,true);
    final boolean supportsUploading=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_supportsUploading,true);
    return new SyncAdapterType(authority,accountType,userVisible,supportsUploading);
  }
  finally {
    sa.recycle();
  }
}

Fixed version (ground truth):
public SyncAdapterType parseServiceAttributes(Resources res,String packageName,AttributeSet attrs){
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.SyncAdapter);
  try {
    final String authority=sa.getString(com.android.internal.R.styleable.SyncAdapter_contentAuthority);
    final String accountType=sa.getString(com.android.internal.R.styleable.SyncAdapter_accountType);
    if (authority == null || accountType == null) {
      return null;
    }
    final boolean userVisible=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_userVisible,true);
    final boolean supportsUploading=sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_supportsUploading,true);
    return new SyncAdapterType(authority,accountType,userVisible,supportsUploading);
  }
  finally {
    sa.recycle();
  }
}
Program: 42336
Project: 42336
Buggy source:
public abstract V parseServiceAttributes(String packageName,AttributeSet attrs);

Fixed version (ground truth):
public abstract V parseServiceAttributes(Resources res,String packageName,AttributeSet attrs);
Program: 42337
Project: 42337
Buggy source:
private ServiceInfo<V> parseServiceInfo(ResolveInfo service) throws XmlPullParserException, IOException {
  android.content.pm.ServiceInfo si=service.serviceInfo;
  ComponentName componentName=new ComponentName(si.packageName,si.name);
  PackageManager pm=mContext.getPackageManager();
  XmlResourceParser parser=null;
  try {
    parser=si.loadXmlMetaData(pm,mMetaDataName);
    if (parser == null) {
      throw new XmlPullParserException("String_Node_Str" + mMetaDataName + "String_Node_Str");
    }
    AttributeSet attrs=Xml.asAttributeSet(parser);
    int type;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
    }
    String nodeName=parser.getName();
    if (!mAttributesName.equals(nodeName)) {
      throw new XmlPullParserException("String_Node_Str" + mAttributesName + "String_Node_Str");
    }
    V v=parseServiceAttributes(si.packageName,attrs);
    if (v == null) {
      return null;
    }
    final android.content.pm.ServiceInfo serviceInfo=service.serviceInfo;
    final ApplicationInfo applicationInfo=serviceInfo.applicationInfo;
    final int uid=applicationInfo.uid;
    return new ServiceInfo<V>(v,componentName,uid);
  }
  finally {
    if (parser != null)     parser.close();
  }
}

Fixed version (ground truth):
private ServiceInfo<V> parseServiceInfo(ResolveInfo service) throws XmlPullParserException, IOException {
  android.content.pm.ServiceInfo si=service.serviceInfo;
  ComponentName componentName=new ComponentName(si.packageName,si.name);
  PackageManager pm=mContext.getPackageManager();
  XmlResourceParser parser=null;
  try {
    parser=si.loadXmlMetaData(pm,mMetaDataName);
    if (parser == null) {
      throw new XmlPullParserException("String_Node_Str" + mMetaDataName + "String_Node_Str");
    }
    AttributeSet attrs=Xml.asAttributeSet(parser);
    int type;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
    }
    String nodeName=parser.getName();
    if (!mAttributesName.equals(nodeName)) {
      throw new XmlPullParserException("String_Node_Str" + mAttributesName + "String_Node_Str");
    }
    V v=parseServiceAttributes(pm.getResourcesForApplication(si.applicationInfo),si.packageName,attrs);
    if (v == null) {
      return null;
    }
    final android.content.pm.ServiceInfo serviceInfo=service.serviceInfo;
    final ApplicationInfo applicationInfo=serviceInfo.applicationInfo;
    final int uid=applicationInfo.uid;
    return new ServiceInfo<V>(v,componentName,uid);
  }
 catch (  NameNotFoundException e) {
    throw new XmlPullParserException("String_Node_Str" + si.packageName);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
Program: 42338
Project: 42338
Buggy source:
private void setSystemVolume(VolumeStreamState streamState){
  setStreamVolumeIndex(streamState.mStreamType,streamState.mIndex);
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
    if (streamType != streamState.mStreamType && STREAM_VOLUME_ALIAS[streamType] == streamState.mStreamType) {
      setStreamVolumeIndex(streamType,mStreamStates[streamType].mIndex);
    }
  }
  sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,streamState.mStreamType,SENDMSG_REPLACE,0,0,streamState,PERSIST_DELAY);
}

Fixed version (ground truth):
private void setSystemVolume(VolumeStreamState streamState){
  setStreamVolumeIndex(streamState.mStreamType,streamState.mIndex);
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
    if (streamType != streamState.mStreamType && STREAM_VOLUME_ALIAS[streamType] == streamState.mStreamType) {
      setStreamVolumeIndex(streamType,mStreamStates[streamType].mIndex);
    }
  }
  sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,streamState.mStreamType,SENDMSG_REPLACE,1,1,streamState,PERSIST_DELAY);
}
Program: 42339
Project: 42339
Buggy source:
@Override public void onChange(boolean selfChange){
  super.onChange(selfChange);
synchronized (mSettingsLock) {
    int ringerModeAffectedStreams=Settings.System.getInt(mContentResolver,Settings.System.MODE_RINGER_STREAMS_AFFECTED,0);
    if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
      mRingerModeAffectedStreams=ringerModeAffectedStreams;
      setRingerModeInt(getRingerMode(),false);
    }
    int notificationsUseRingVolume=Settings.System.getInt(mContentResolver,Settings.System.NOTIFICATIONS_USE_RING_VOLUME,1);
    if (notificationsUseRingVolume != mNotificationsUseRingVolume) {
      mNotificationsUseRingVolume=notificationsUseRingVolume;
      if (mNotificationsUseRingVolume == 1) {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_RING;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_RING]);
      }
 else {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_NOTIFICATION;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_NOTIFICATION]);
        sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,AudioSystem.STREAM_NOTIFICATION,SENDMSG_REPLACE,0,0,mStreamStates[AudioSystem.STREAM_NOTIFICATION],0);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onChange(boolean selfChange){
  super.onChange(selfChange);
synchronized (mSettingsLock) {
    int ringerModeAffectedStreams=Settings.System.getInt(mContentResolver,Settings.System.MODE_RINGER_STREAMS_AFFECTED,0);
    if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
      mRingerModeAffectedStreams=ringerModeAffectedStreams;
      setRingerModeInt(getRingerMode(),false);
    }
    int notificationsUseRingVolume=Settings.System.getInt(mContentResolver,Settings.System.NOTIFICATIONS_USE_RING_VOLUME,1);
    if (notificationsUseRingVolume != mNotificationsUseRingVolume) {
      mNotificationsUseRingVolume=notificationsUseRingVolume;
      if (mNotificationsUseRingVolume == 1) {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_RING;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_RING]);
      }
 else {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_NOTIFICATION;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_NOTIFICATION]);
        sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,AudioSystem.STREAM_NOTIFICATION,SENDMSG_REPLACE,1,1,mStreamStates[AudioSystem.STREAM_NOTIFICATION],0);
      }
    }
  }
}
Program: 42340
Project: 42340
Buggy source:
/** 
 * Sets the stream state's index, and posts a message to set system volume. This will not call out to the UI. Assumes a valid stream type.
 * @param streamType Type of the stream
 * @param index Desired volume index of the stream
 * @param force If true, set the volume even if the desired volume is sameas the current volume.
 * @param lastAudible If true, stores new index as last audible one
 */
private void setStreamVolumeInt(int streamType,int index,boolean force,boolean lastAudible){
  VolumeStreamState streamState=mStreamStates[streamType];
  if (streamState.setIndex(index,lastAudible) || force) {
    if (streamState.muteCount() == 0) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,streamType,SENDMSG_NOOP,0,0,streamState,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets the stream state's index, and posts a message to set system volume. This will not call out to the UI. Assumes a valid stream type.
 * @param streamType Type of the stream
 * @param index Desired volume index of the stream
 * @param force If true, set the volume even if the desired volume is sameas the current volume.
 * @param lastAudible If true, stores new index as last audible one
 */
private void setStreamVolumeInt(int streamType,int index,boolean force,boolean lastAudible){
  VolumeStreamState streamState=mStreamStates[streamType];
  if (streamState.setIndex(index,lastAudible) || force) {
    if (streamState.muteCount() == 0 && (mRingerMode == AudioManager.RINGER_MODE_NORMAL || !isStreamAffectedByRingerMode(streamType) || index == 0)) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,streamType,SENDMSG_NOOP,0,0,streamState,0);
    }
 else {
      sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,streamType,SENDMSG_REPLACE,0,1,streamState,PERSIST_DELAY);
    }
  }
}
Program: 42341
Project: 42341
Buggy source:
private void setRingerModeInt(int ringerMode,boolean persist){
  mRingerMode=ringerMode;
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (!isStreamAffectedByRingerMode(streamType))       continue;
      setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,false,false);
    }
  }
 else {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (isStreamAffectedByRingerMode(streamType)) {
        setStreamVolumeInt(streamType,0,false,false);
      }
 else {
        setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,false,false);
      }
    }
  }
  if (persist) {
    sendMsg(mAudioHandler,MSG_PERSIST_RINGER_MODE,SHARED_MSG,SENDMSG_REPLACE,0,0,null,PERSIST_DELAY);
  }
}

Fixed version (ground truth):
private void setRingerModeInt(int ringerMode,boolean persist){
  mRingerMode=ringerMode;
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (!isStreamAffectedByRingerMode(streamType))       continue;
      setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,true,false);
    }
  }
 else {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (isStreamAffectedByRingerMode(streamType)) {
        setStreamVolumeInt(streamType,0,false,false);
      }
 else {
        setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,true,false);
      }
    }
  }
  if (persist) {
    sendMsg(mAudioHandler,MSG_PERSIST_RINGER_MODE,SHARED_MSG,SENDMSG_REPLACE,0,0,null,PERSIST_DELAY);
  }
}
Program: 42342
Project: 42342
Buggy source:
private void persistVolume(VolumeStreamState streamState){
  System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,(streamState.mIndex + 5) / 10);
  System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,(streamState.mLastAudibleIndex + 5) / 10);
}

Fixed version (ground truth):
private void persistVolume(VolumeStreamState streamState,boolean current,boolean lastAudible){
  if (current) {
    System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,(streamState.mIndex + 5) / 10);
  }
  if (lastAudible) {
    System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,(streamState.mLastAudibleIndex + 5) / 10);
  }
}
Program: 42345
Project: 42345
Buggy source:
/** 
 * Sets the final position (Y) for this scroller.
 * @param newY The new Y offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalX(int)
 */
public void setFinalY(int newY){
  if (mScrollMode == MODE_DEFAULT) {
    mDefaultScroller.setFinalY(newY);
  }
}

Fixed version (ground truth):
/** 
 * Sets the final position (Y) for this scroller.
 * @param newY The new Y offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalX(int)
 */
public void setFinalY(int newY){
  if (mScrollMode == MODE_DEFAULT) {
    if (newY < mMinimumY) {
      mMinimumY=newY;
    }
    if (newY > mMaximumY) {
      mMaximumY=newY;
    }
    mDefaultScroller.setFinalY(newY);
  }
}
Program: 42346
Project: 42346
Buggy source:
/** 
 * Sets the final position (X) for this scroller.
 * @param newX The new X offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalY(int)
 */
public void setFinalX(int newX){
  if (mScrollMode == MODE_DEFAULT) {
    mDefaultScroller.setFinalX(newX);
  }
}

Fixed version (ground truth):
/** 
 * Sets the final position (X) for this scroller.
 * @param newX The new X offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalY(int)
 */
public void setFinalX(int newX){
  if (mScrollMode == MODE_DEFAULT) {
    if (newX < mMinimumX) {
      mMinimumX=newX;
    }
    if (newX > mMaximumX) {
      mMaximumX=newX;
    }
    mDefaultScroller.setFinalX(newX);
  }
}
Program: 42347
Project: 42347
Buggy source:
public boolean isUsbRNDISStarted() throws IllegalStateException {
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,"String_Node_Str");
  ArrayList<String> rsp=mConnector.doCommand("String_Node_Str");
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == NetdResponseCode.UsbRNDISStatusResult) {
      if (tok[2].equals("String_Node_Str"))       return true;
      return false;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
public boolean isUsbRNDISStarted() throws IllegalStateException {
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,"String_Node_Str");
  ArrayList<String> rsp=mConnector.doCommand("String_Node_Str");
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == NetdResponseCode.UsbRNDISStatusResult) {
      if (tok[3].equals("String_Node_Str"))       return true;
      return false;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 42348
Project: 42348
Buggy source:
public boolean isUsbRNDISStarted() throws IllegalStateException {
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,"String_Node_Str");
  ArrayList<String> rsp=mConnector.doCommand("String_Node_Str");
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == NetdResponseCode.UsbRNDISStatusResult) {
      if (tok[2].equals("String_Node_Str"))       return true;
      return false;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
public boolean isUsbRNDISStarted() throws IllegalStateException {
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,"String_Node_Str");
  ArrayList<String> rsp=mConnector.doCommand("String_Node_Str");
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == NetdResponseCode.UsbRNDISStatusResult) {
      if (tok[3].equals("String_Node_Str"))       return true;
      return false;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 42350
Project: 42350
Buggy source:
private void setSystemVolume(VolumeStreamState streamState){
  setStreamVolumeIndex(streamState.mStreamType,streamState.mIndex);
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
    if (streamType != streamState.mStreamType && STREAM_VOLUME_ALIAS[streamType] == streamState.mStreamType) {
      setStreamVolumeIndex(streamType,mStreamStates[streamType].mIndex);
    }
  }
  sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,streamState.mStreamType,SENDMSG_REPLACE,0,0,streamState,PERSIST_DELAY);
}

Fixed version (ground truth):
private void setSystemVolume(VolumeStreamState streamState){
  setStreamVolumeIndex(streamState.mStreamType,streamState.mIndex);
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
    if (streamType != streamState.mStreamType && STREAM_VOLUME_ALIAS[streamType] == streamState.mStreamType) {
      setStreamVolumeIndex(streamType,mStreamStates[streamType].mIndex);
    }
  }
  sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,streamState.mStreamType,SENDMSG_REPLACE,1,1,streamState,PERSIST_DELAY);
}
Program: 42351
Project: 42351
Buggy source:
@Override public void onChange(boolean selfChange){
  super.onChange(selfChange);
synchronized (mSettingsLock) {
    int ringerModeAffectedStreams=Settings.System.getInt(mContentResolver,Settings.System.MODE_RINGER_STREAMS_AFFECTED,0);
    if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
      mRingerModeAffectedStreams=ringerModeAffectedStreams;
      setRingerModeInt(getRingerMode(),false);
    }
    int notificationsUseRingVolume=Settings.System.getInt(mContentResolver,Settings.System.NOTIFICATIONS_USE_RING_VOLUME,1);
    if (notificationsUseRingVolume != mNotificationsUseRingVolume) {
      mNotificationsUseRingVolume=notificationsUseRingVolume;
      if (mNotificationsUseRingVolume == 1) {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_RING;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_RING]);
      }
 else {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_NOTIFICATION;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_NOTIFICATION]);
        sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,AudioSystem.STREAM_NOTIFICATION,SENDMSG_REPLACE,0,0,mStreamStates[AudioSystem.STREAM_NOTIFICATION],0);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onChange(boolean selfChange){
  super.onChange(selfChange);
synchronized (mSettingsLock) {
    int ringerModeAffectedStreams=Settings.System.getInt(mContentResolver,Settings.System.MODE_RINGER_STREAMS_AFFECTED,0);
    if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
      mRingerModeAffectedStreams=ringerModeAffectedStreams;
      setRingerModeInt(getRingerMode(),false);
    }
    int notificationsUseRingVolume=Settings.System.getInt(mContentResolver,Settings.System.NOTIFICATIONS_USE_RING_VOLUME,1);
    if (notificationsUseRingVolume != mNotificationsUseRingVolume) {
      mNotificationsUseRingVolume=notificationsUseRingVolume;
      if (mNotificationsUseRingVolume == 1) {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_RING;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_RING]);
      }
 else {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_NOTIFICATION;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_NOTIFICATION]);
        sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,AudioSystem.STREAM_NOTIFICATION,SENDMSG_REPLACE,1,1,mStreamStates[AudioSystem.STREAM_NOTIFICATION],0);
      }
    }
  }
}
Program: 42352
Project: 42352
Buggy source:
/** 
 * Sets the stream state's index, and posts a message to set system volume. This will not call out to the UI. Assumes a valid stream type.
 * @param streamType Type of the stream
 * @param index Desired volume index of the stream
 * @param force If true, set the volume even if the desired volume is sameas the current volume.
 * @param lastAudible If true, stores new index as last audible one
 */
private void setStreamVolumeInt(int streamType,int index,boolean force,boolean lastAudible){
  VolumeStreamState streamState=mStreamStates[streamType];
  if (streamState.setIndex(index,lastAudible) || force) {
    if (streamState.muteCount() == 0) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,streamType,SENDMSG_NOOP,0,0,streamState,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets the stream state's index, and posts a message to set system volume. This will not call out to the UI. Assumes a valid stream type.
 * @param streamType Type of the stream
 * @param index Desired volume index of the stream
 * @param force If true, set the volume even if the desired volume is sameas the current volume.
 * @param lastAudible If true, stores new index as last audible one
 */
private void setStreamVolumeInt(int streamType,int index,boolean force,boolean lastAudible){
  VolumeStreamState streamState=mStreamStates[streamType];
  if (streamState.setIndex(index,lastAudible) || force) {
    if (streamState.muteCount() == 0 && (mRingerMode == AudioManager.RINGER_MODE_NORMAL || !isStreamAffectedByRingerMode(streamType) || index == 0)) {
      sendMsg(mAudioHandler,MSG_SET_SYSTEM_VOLUME,streamType,SENDMSG_NOOP,0,0,streamState,0);
    }
 else {
      sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,streamType,SENDMSG_REPLACE,0,1,streamState,PERSIST_DELAY);
    }
  }
}
Program: 42353
Project: 42353
Buggy source:
private void setRingerModeInt(int ringerMode,boolean persist){
  mRingerMode=ringerMode;
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (!isStreamAffectedByRingerMode(streamType))       continue;
      setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,false,false);
    }
  }
 else {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (isStreamAffectedByRingerMode(streamType)) {
        setStreamVolumeInt(streamType,0,false,false);
      }
 else {
        setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,false,false);
      }
    }
  }
  if (persist) {
    sendMsg(mAudioHandler,MSG_PERSIST_RINGER_MODE,SHARED_MSG,SENDMSG_REPLACE,0,0,null,PERSIST_DELAY);
  }
}

Fixed version (ground truth):
private void setRingerModeInt(int ringerMode,boolean persist){
  mRingerMode=ringerMode;
  int numStreamTypes=AudioSystem.getNumStreamTypes();
  if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (!isStreamAffectedByRingerMode(streamType))       continue;
      setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,true,false);
    }
  }
 else {
    for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
      if (isStreamAffectedByRingerMode(streamType)) {
        setStreamVolumeInt(streamType,0,false,false);
      }
 else {
        setStreamVolumeInt(streamType,mStreamStates[streamType].mLastAudibleIndex,true,false);
      }
    }
  }
  if (persist) {
    sendMsg(mAudioHandler,MSG_PERSIST_RINGER_MODE,SHARED_MSG,SENDMSG_REPLACE,0,0,null,PERSIST_DELAY);
  }
}
Program: 42354
Project: 42354
Buggy source:
private void persistVolume(VolumeStreamState streamState){
  System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,(streamState.mIndex + 5) / 10);
  System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,(streamState.mLastAudibleIndex + 5) / 10);
}

Fixed version (ground truth):
private void persistVolume(VolumeStreamState streamState,boolean current,boolean lastAudible){
  if (current) {
    System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,(streamState.mIndex + 5) / 10);
  }
  if (lastAudible) {
    System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,(streamState.mLastAudibleIndex + 5) / 10);
  }
}
Program: 42356
Project: 42356
Buggy source:
/** 
 * Sets the final position (Y) for this scroller.
 * @param newY The new Y offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalX(int)
 */
public void setFinalY(int newY){
  if (mScrollMode == MODE_DEFAULT) {
    mDefaultScroller.setFinalY(newY);
  }
}

Fixed version (ground truth):
/** 
 * Sets the final position (Y) for this scroller.
 * @param newY The new Y offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalX(int)
 */
public void setFinalY(int newY){
  if (mScrollMode == MODE_DEFAULT) {
    if (newY < mMinimumY) {
      mMinimumY=newY;
    }
    if (newY > mMaximumY) {
      mMaximumY=newY;
    }
    mDefaultScroller.setFinalY(newY);
  }
}
Program: 42357
Project: 42357
Buggy source:
/** 
 * Sets the final position (X) for this scroller.
 * @param newX The new X offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalY(int)
 */
public void setFinalX(int newX){
  if (mScrollMode == MODE_DEFAULT) {
    mDefaultScroller.setFinalX(newX);
  }
}

Fixed version (ground truth):
/** 
 * Sets the final position (X) for this scroller.
 * @param newX The new X offset as an absolute distance from the origin.
 * @see #extendDuration(int)
 * @see #setFinalY(int)
 */
public void setFinalX(int newX){
  if (mScrollMode == MODE_DEFAULT) {
    if (newX < mMinimumX) {
      mMinimumX=newX;
    }
    if (newX > mMaximumX) {
      mMaximumX=newX;
    }
    mDefaultScroller.setFinalX(newX);
  }
}
Program: 42360
Project: 42360
Buggy source:
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}
Program: 42361
Project: 42361
Buggy source:
public void prepareAppTransition(int transit){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (DEBUG_APP_TRANSITIONS)     Slog.v(TAG,"String_Node_Str" + transit + "String_Node_Str"+ mNextAppTransition);
    if (!mDisplayFrozen) {
      if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET || mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_TASK_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_TASK_CLOSE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE) {
        mNextAppTransition=transit;
      }
      mAppTransitionReady=false;
      mAppTransitionTimeout=false;
      mStartingIconInTransition=false;
      mSkipAppTransitionAnimation=false;
      mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
      mH.sendMessageDelayed(mH.obtainMessage(H.APP_TRANSITION_TIMEOUT),5000);
    }
  }
}

Fixed version (ground truth):
public void prepareAppTransition(int transit){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (DEBUG_APP_TRANSITIONS)     Slog.v(TAG,"String_Node_Str" + transit + "String_Node_Str"+ mNextAppTransition);
    if (!mDisplayFrozen && mPolicy.isScreenOn()) {
      if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET || mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_TASK_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_TASK_CLOSE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE) {
        mNextAppTransition=transit;
      }
      mAppTransitionReady=false;
      mAppTransitionTimeout=false;
      mStartingIconInTransition=false;
      mSkipAppTransitionAnimation=false;
      mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
      mH.sendMessageDelayed(mH.obtainMessage(H.APP_TRANSITION_TIMEOUT),5000);
    }
  }
}
Program: 42363
Project: 42363
Buggy source:
boolean hideLw(boolean doAnimation,boolean requestAnim){
  boolean current=doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility;
  if (!current) {
    return false;
  }
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_EXIT,false);
    if (mAnimation == null) {
      doAnimation=false;
    }
  }
  if (doAnimation) {
    mPolicyVisibilityAfterAnim=false;
  }
 else {
    mPolicyVisibilityAfterAnim=false;
    mPolicyVisibility=false;
    enableScreenIfNeededLocked();
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}

Fixed version (ground truth):
boolean hideLw(boolean doAnimation,boolean requestAnim){
  boolean current=doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility;
  if (!current) {
    return false;
  }
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_EXIT,false);
    if (mAnimation == null) {
      doAnimation=false;
    }
  }
  if (doAnimation) {
    mPolicyVisibilityAfterAnim=false;
  }
 else {
    if (DEBUG_VISIBILITY)     Slog.v(TAG,"String_Node_Str" + this);
    mPolicyVisibilityAfterAnim=false;
    mPolicyVisibility=false;
    enableScreenIfNeededLocked();
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}
Program: 42364
Project: 42364
Buggy source:
boolean showLw(boolean doAnimation,boolean requestAnim){
  if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
    return false;
  }
  mPolicyVisibility=true;
  mPolicyVisibilityAfterAnim=true;
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_ENTER,true);
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}

Fixed version (ground truth):
boolean showLw(boolean doAnimation,boolean requestAnim){
  if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
    return false;
  }
  if (DEBUG_VISIBILITY)   Slog.v(TAG,"String_Node_Str" + this);
  mPolicyVisibility=true;
  mPolicyVisibilityAfterAnim=true;
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_ENTER,true);
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}
Program: 42365
Project: 42365
Buggy source:
public void startAppFreezingScreen(IBinder token,int configChanges){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (configChanges == 0 && !mDisplayFrozen) {
      if (DEBUG_ORIENTATION)       Slog.v(TAG,"String_Node_Str" + token);
      return;
    }
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null || wtoken.appToken == null) {
      Slog.w(TAG,"String_Node_Str" + wtoken);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    startAppFreezingScreenLocked(wtoken,configChanges);
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
public void startAppFreezingScreen(IBinder token,int configChanges){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (configChanges == 0 && !mDisplayFrozen && mPolicy.isScreenOn()) {
      if (DEBUG_ORIENTATION)       Slog.v(TAG,"String_Node_Str" + token);
      return;
    }
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null || wtoken.appToken == null) {
      Slog.w(TAG,"String_Node_Str" + wtoken);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    startAppFreezingScreenLocked(wtoken,configChanges);
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 42368
Project: 42368
Buggy source:
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}
Program: 42369
Project: 42369
Buggy source:
public void prepareAppTransition(int transit){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (DEBUG_APP_TRANSITIONS)     Slog.v(TAG,"String_Node_Str" + transit + "String_Node_Str"+ mNextAppTransition);
    if (!mDisplayFrozen) {
      if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET || mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_TASK_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_TASK_CLOSE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE) {
        mNextAppTransition=transit;
      }
      mAppTransitionReady=false;
      mAppTransitionTimeout=false;
      mStartingIconInTransition=false;
      mSkipAppTransitionAnimation=false;
      mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
      mH.sendMessageDelayed(mH.obtainMessage(H.APP_TRANSITION_TIMEOUT),5000);
    }
  }
}

Fixed version (ground truth):
public void prepareAppTransition(int transit){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (DEBUG_APP_TRANSITIONS)     Slog.v(TAG,"String_Node_Str" + transit + "String_Node_Str"+ mNextAppTransition);
    if (!mDisplayFrozen && mPolicy.isScreenOn()) {
      if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET || mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_TASK_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_TASK_CLOSE) {
        mNextAppTransition=transit;
      }
 else       if (transit == WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN && mNextAppTransition == WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE) {
        mNextAppTransition=transit;
      }
      mAppTransitionReady=false;
      mAppTransitionTimeout=false;
      mStartingIconInTransition=false;
      mSkipAppTransitionAnimation=false;
      mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
      mH.sendMessageDelayed(mH.obtainMessage(H.APP_TRANSITION_TIMEOUT),5000);
    }
  }
}
Program: 42371
Project: 42371
Buggy source:
boolean hideLw(boolean doAnimation,boolean requestAnim){
  boolean current=doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility;
  if (!current) {
    return false;
  }
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_EXIT,false);
    if (mAnimation == null) {
      doAnimation=false;
    }
  }
  if (doAnimation) {
    mPolicyVisibilityAfterAnim=false;
  }
 else {
    mPolicyVisibilityAfterAnim=false;
    mPolicyVisibility=false;
    enableScreenIfNeededLocked();
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}

Fixed version (ground truth):
boolean hideLw(boolean doAnimation,boolean requestAnim){
  boolean current=doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility;
  if (!current) {
    return false;
  }
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_EXIT,false);
    if (mAnimation == null) {
      doAnimation=false;
    }
  }
  if (doAnimation) {
    mPolicyVisibilityAfterAnim=false;
  }
 else {
    if (DEBUG_VISIBILITY)     Slog.v(TAG,"String_Node_Str" + this);
    mPolicyVisibilityAfterAnim=false;
    mPolicyVisibility=false;
    enableScreenIfNeededLocked();
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}
Program: 42372
Project: 42372
Buggy source:
boolean showLw(boolean doAnimation,boolean requestAnim){
  if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
    return false;
  }
  mPolicyVisibility=true;
  mPolicyVisibilityAfterAnim=true;
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_ENTER,true);
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}

Fixed version (ground truth):
boolean showLw(boolean doAnimation,boolean requestAnim){
  if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
    return false;
  }
  if (DEBUG_VISIBILITY)   Slog.v(TAG,"String_Node_Str" + this);
  mPolicyVisibility=true;
  mPolicyVisibilityAfterAnim=true;
  if (doAnimation) {
    applyAnimationLocked(this,WindowManagerPolicy.TRANSIT_ENTER,true);
  }
  if (requestAnim) {
    requestAnimationLocked(0);
  }
  return true;
}
Program: 42373
Project: 42373
Buggy source:
public void startAppFreezingScreen(IBinder token,int configChanges){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (configChanges == 0 && !mDisplayFrozen) {
      if (DEBUG_ORIENTATION)       Slog.v(TAG,"String_Node_Str" + token);
      return;
    }
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null || wtoken.appToken == null) {
      Slog.w(TAG,"String_Node_Str" + wtoken);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    startAppFreezingScreenLocked(wtoken,configChanges);
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
public void startAppFreezingScreen(IBinder token,int configChanges){
  if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,"String_Node_Str")) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mWindowMap) {
    if (configChanges == 0 && !mDisplayFrozen && mPolicy.isScreenOn()) {
      if (DEBUG_ORIENTATION)       Slog.v(TAG,"String_Node_Str" + token);
      return;
    }
    AppWindowToken wtoken=findAppWindowToken(token);
    if (wtoken == null || wtoken.appToken == null) {
      Slog.w(TAG,"String_Node_Str" + wtoken);
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    startAppFreezingScreenLocked(wtoken,configChanges);
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 42374
Project: 42374
Buggy source:
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}

Fixed version (ground truth):
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  if (mAuthHeader != null)   return;
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}
Program: 42375
Project: 42375
Buggy source:
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}

Fixed version (ground truth):
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  if (mAuthHeader != null)   return;
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}
Program: 42376
Project: 42376
Buggy source:
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}

Fixed version (ground truth):
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  if (mAuthHeader != null)   return;
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}
Program: 42377
Project: 42377
Buggy source:
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}

Fixed version (ground truth):
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  if (mAuthHeader != null)   return;
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}
Program: 42378
Project: 42378
Buggy source:
Listener(IBinder token){
  mToken=token;
}

Fixed version (ground truth):
Listener(IBinder token,int uid){
  mToken=token;
  mUid=uid;
}
Program: 42379
Project: 42379
Buggy source:
public boolean enableSensor(IBinder binder,String name,int sensor,int enable) throws RemoteException {
  if (localLOGV)   Slog.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str"+ enable);
  int uid=Binder.getCallingUid();
  long identity=Binder.clearCallingIdentity();
  if (enable == SENSOR_DISABLE) {
    mBatteryStats.noteStopSensor(uid,sensor);
  }
 else {
    mBatteryStats.noteStartSensor(uid,sensor);
  }
  Binder.restoreCallingIdentity(identity);
  if (binder == null) {
    Slog.w(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str");
    return false;
  }
synchronized (mListeners) {
    if (enable != SENSOR_DISABLE && !_sensors_control_activate(sensor,true)) {
      Slog.w(TAG,"String_Node_Str" + sensor);
      return false;
    }
    Listener l=null;
    int minDelay=enable;
    for (    Listener listener : mListeners) {
      if (binder == listener.mToken) {
        l=listener;
      }
      if (minDelay > listener.mDelay)       minDelay=listener.mDelay;
    }
    if (l == null && enable != SENSOR_DISABLE) {
      l=new Listener(binder);
      binder.linkToDeath(l,0);
      mListeners.add(l);
      mListeners.notify();
    }
    if (l == null) {
      Slog.w(TAG,"String_Node_Str" + binder + "String_Node_Str"+ name+ "String_Node_Str"+ sensor+ "String_Node_Str");
      return false;
    }
    if (minDelay >= 0) {
      _sensors_control_set_delay(minDelay);
    }
    if (enable != SENSOR_DISABLE) {
      l.addSensor(sensor,enable);
    }
 else {
      l.removeSensor(sensor);
      deactivateIfUnusedLocked(sensor);
      if (l.mSensors == 0) {
        mListeners.remove(l);
        binder.unlinkToDeath(l,0);
        mListeners.notify();
      }
    }
    if (mListeners.size() == 0) {
      _sensors_control_wake();
      _sensors_control_close();
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean enableSensor(IBinder binder,String name,int sensor,int enable) throws RemoteException {
  if (localLOGV)   Slog.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str"+ enable);
  if (binder == null) {
    Slog.e(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str");
    return false;
  }
  if (enable < 0 && (enable != SENSOR_DISABLE)) {
    Slog.e(TAG,"String_Node_Str" + enable + "String_Node_Str"+ name+ "String_Node_Str"+ sensor+ "String_Node_Str");
    return false;
  }
  boolean res;
  int uid=Binder.getCallingUid();
synchronized (mListeners) {
    res=enableSensorInternalLocked(binder,uid,name,sensor,enable);
    if (res == true) {
      long identity=Binder.clearCallingIdentity();
      if (enable == SENSOR_DISABLE) {
        mBatteryStats.noteStopSensor(uid,sensor);
      }
 else {
        mBatteryStats.noteStartSensor(uid,sensor);
      }
      Binder.restoreCallingIdentity(identity);
    }
  }
  return res;
}
Program: 42380
Project: 42380
Buggy source:
void addSensor(int sensor,int delay){
  mSensors|=(1 << sensor);
  if (mDelay > delay)   mDelay=delay;
}

Fixed version (ground truth):
void addSensor(int sensor,int delay){
  mSensors|=(1 << sensor);
  if (delay < mDelay)   mDelay=delay;
}