nus-yam/ex-repair huggingface dataset:
Program: 22933
Project: 22933
Buggy source:
public void onPatternDetected(List<LockPatternView.Cell> pattern){
  if (mLockPatternUtils.checkPattern(pattern)) {
    mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct);
    mInstructions="String_Node_Str";
    updateStatusLines();
    mCallback.keyguardDone(true);
    mCallback.reportSuccessfulUnlockAttempt();
  }
 else {
    if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) {
      mCallback.pokeWakelock(UNLOCK_PATTERN_WAKE_INTERVAL_MS);
    }
    mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong);
    if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) {
      mTotalFailedPatternAttempts++;
      mFailedPatternAttemptsSinceLastTimeout++;
    }
    if (mFailedPatternAttemptsSinceLastTimeout >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
      long deadline=mLockPatternUtils.setLockoutAttemptDeadline();
      handleAttemptLockout(deadline);
    }
 else {
      mInstructions=getContext().getString(R.string.lockscreen_pattern_wrong);
      updateStatusLines();
      mLockPatternView.postDelayed(mCancelPatternRunnable,PATTERN_CLEAR_TIMEOUT_MS);
    }
    if (pattern.size() > MIN_PATTERN_BEFORE_REPORT) {
      mCallback.reportFailedUnlockAttempt();
    }
  }
}

Fixed version (ground truth):
public void onPatternDetected(List<LockPatternView.Cell> pattern){
  if (mLockPatternUtils.checkPattern(pattern)) {
    mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct);
    mInstructions="String_Node_Str";
    updateStatusLines();
    mCallback.keyguardDone(true);
    mCallback.reportSuccessfulUnlockAttempt();
  }
 else {
    if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) {
      mCallback.pokeWakelock(UNLOCK_PATTERN_WAKE_INTERVAL_MS);
    }
    mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong);
    if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) {
      mTotalFailedPatternAttempts++;
      mFailedPatternAttemptsSinceLastTimeout++;
      mCallback.reportFailedUnlockAttempt();
    }
    if (mFailedPatternAttemptsSinceLastTimeout >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
      long deadline=mLockPatternUtils.setLockoutAttemptDeadline();
      handleAttemptLockout(deadline);
    }
 else {
      mInstructions=getContext().getString(R.string.lockscreen_pattern_wrong);
      updateStatusLines();
      mLockPatternView.postDelayed(mCancelPatternRunnable,PATTERN_CLEAR_TIMEOUT_MS);
    }
  }
}
Program: 22934
Project: 22934
Buggy source:
public AuthenticatorDescription parseServiceAttributes(String packageName,AttributeSet attrs){
  TypedArray sa=mContext.getResources().obtainAttributes(attrs,com.android.internal.R.styleable.AccountAuthenticator);
  try {
    final String accountType=sa.getString(com.android.internal.R.styleable.AccountAuthenticator_accountType);
    final int labelId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_label,0);
    final int iconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_icon,0);
    final int smallIconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_smallIcon,0);
    final int prefId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_accountPreferences,0);
    if (TextUtils.isEmpty(accountType)) {
      return null;
    }
    return new AuthenticatorDescription(accountType,packageName,labelId,iconId,smallIconId,prefId);
  }
  finally {
    sa.recycle();
  }
}

Fixed version (ground truth):
public AuthenticatorDescription parseServiceAttributes(Resources res,String packageName,AttributeSet attrs){
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AccountAuthenticator);
  try {
    final String accountType=sa.getString(com.android.internal.R.styleable.AccountAuthenticator_accountType);
    final int labelId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_label,0);
    final int iconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_icon,0);
    final int smallIconId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_smallIcon,0);
    final int prefId=sa.getResourceId(com.android.internal.R.styleable.AccountAuthenticator_accountPreferences,0);
    if (TextUtils.isEmpty(accountType)) {
      return null;
    }
    return new AuthenticatorDescription(accountType,packageName,labelId,iconId,smallIconId,prefId);
  }
  finally {
    sa.recycle();
  }
}
Program: 22935
Project: 22935
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: 22936
Project: 22936
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: 22937
Project: 22937
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: 22938
Project: 22938
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: 22939
Project: 22939
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: 22940
Project: 22940
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: 22941
Project: 22941
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: 22942
Project: 22942
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: 22943
Project: 22943
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: 22946
Project: 22946
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: 22947
Project: 22947
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: 22949
Project: 22949
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: 22950
Project: 22950
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: 22951
Project: 22951
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: 22952
Project: 22952
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: 22953
Project: 22953
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: 22955
Project: 22955
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: 22956
Project: 22956
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: 22957
Project: 22957
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: 22960
Project: 22960
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: 22961
Project: 22961
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: 22963
Project: 22963
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: 22964
Project: 22964
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: 22965
Project: 22965
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: 22968
Project: 22968
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: 22969
Project: 22969
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: 22971
Project: 22971
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: 22972
Project: 22972
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: 22973
Project: 22973
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: 22974
Project: 22974
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);
}