nus-yam/ex-repair huggingface dataset:
Program: 2936
Project: 2936
Buggy source:
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedTrackball.updateTrackballDirection(this,event);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}

Fixed version (ground truth):
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedDpad.updateTouchPad(this,event,true);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}
Program: 2938
Project: 2938
Buggy source:
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedTrackball.updateTrackballDirection(this,event);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}

Fixed version (ground truth):
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedDpad.updateTouchPad(this,event,true);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}
Program: 2939
Project: 2939
Buggy source:
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on o it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);

Fixed version (ground truth):
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on to it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);
Program: 2940
Project: 2940
Buggy source:
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on o it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);

Fixed version (ground truth):
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on to it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);
Program: 2941
Project: 2941
Buggy source:
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on o it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);

Fixed version (ground truth):
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on to it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);
Program: 2942
Project: 2942
Buggy source:
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on o it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);

Fixed version (ground truth):
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on to it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);
Program: 2943
Project: 2943
Buggy source:
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on o it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);

Fixed version (ground truth):
/** 
 * Called when sensor values have changed. <p>See   {@link android.hardware.SensorManager SensorManager}for details on possible sensor types. <p>See also   {@link android.hardware.SensorEvent SensorEvent}. <p><b>NOTE:</b> The application doesn't own the  {@link android.hardware.SensorEvent event}object passed as a parameter and therefore cannot hold on to it. The object may be part of an internal pool and may be reused by the framework.
 * @param event the {@link android.hardware.SensorEvent SensorEvent}. 
 */
public void onSensorChanged(SensorEvent event);
Program: 2944
Project: 2944
Buggy source:
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}

Fixed version (ground truth):
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}
Program: 2945
Project: 2945
Buggy source:
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (DEBUG) {
    Slog.d(TAG,(enabled ? "String_Node_Str" : "String_Node_Str") + id);
  }
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 2946
Project: 2946
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 2947
Project: 2947
Buggy source:
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}

Fixed version (ground truth):
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}
Program: 2948
Project: 2948
Buggy source:
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (DEBUG) {
    Slog.d(TAG,(enabled ? "String_Node_Str" : "String_Node_Str") + id);
  }
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 2949
Project: 2949
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 2950
Project: 2950
Buggy source:
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}

Fixed version (ground truth):
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}
Program: 2951
Project: 2951
Buggy source:
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (DEBUG) {
    Slog.d(TAG,(enabled ? "String_Node_Str" : "String_Node_Str") + id);
  }
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 2952
Project: 2952
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 2953
Project: 2953
Buggy source:
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}

Fixed version (ground truth):
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}
Program: 2954
Project: 2954
Buggy source:
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (DEBUG) {
    Slog.d(TAG,(enabled ? "String_Node_Str" : "String_Node_Str") + id);
  }
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 2955
Project: 2955
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 2956
Project: 2956
Buggy source:
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}

Fixed version (ground truth):
private boolean isValidSystemDefaultIme(InputMethodInfo imi,Context context){
  if (!mSystemReady) {
    return false;
  }
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.getIsDefaultResourceId() != 0) {
    try {
      Resources res=context.createPackageContext(imi.getPackageName(),0).getResources();
      if (res.getBoolean(imi.getIsDefaultResourceId()) && containsSubtypeOf(imi,context.getResources().getConfiguration().locale.getLanguage())) {
        return true;
      }
    }
 catch (    PackageManager.NameNotFoundException ex) {
    }
catch (    Resources.NotFoundException ex) {
    }
  }
  if (imi.getSubtypeCount() == 0) {
    Slog.w(TAG,"String_Node_Str" + imi.getPackageName());
  }
  return false;
}
Program: 2957
Project: 2957
Buggy source:
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (DEBUG) {
    Slog.d(TAG,(enabled ? "String_Node_Str" : "String_Node_Str") + id);
  }
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
boolean setInputMethodEnabledLocked(String id,boolean enabled){
  InputMethodInfo imm=mMethodMap.get(id);
  if (imm == null) {
    throw new IllegalArgumentException("String_Node_Str" + mCurMethodId);
  }
  List<Pair<String,ArrayList<String>>> enabledInputMethodsList=mSettings.getEnabledInputMethodsAndSubtypeListLocked();
  if (enabled) {
    for (    Pair<String,ArrayList<String>> pair : enabledInputMethodsList) {
      if (pair.first.equals(id)) {
        return true;
      }
    }
    mSettings.appendAndPutEnabledInputMethodLocked(id,false);
    return false;
  }
 else {
    StringBuilder builder=new StringBuilder();
    if (mSettings.buildAndPutEnabledInputMethodsStrRemovingIdLocked(builder,enabledInputMethodsList,id)) {
      final String selId=mSettings.getSelectedInputMethod();
      if (id.equals(selId) && !chooseNewDefaultIMELocked()) {
        Slog.i(TAG,"String_Node_Str");
        resetSelectedInputMethodAndSubtypeLocked("String_Node_Str");
      }
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 2958
Project: 2958
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 2960
Project: 2960
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mForcingShowNavBar=false;
  mForcingShowNavBarLayer=-1;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}
Program: 2961
Project: 2961
Buggy source:
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  final int visibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}

Fixed version (ground truth):
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  int tmpVisibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  if (mForcingShowNavBar && mFocusedWindow.getSurfaceLayer() < mForcingShowNavBarLayer) {
    tmpVisibility&=~View.SYSTEM_UI_CLEARABLE_FLAGS;
  }
  final int visibility=tmpVisibility;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}
Program: 2966
Project: 2966
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mForcingShowNavBar=false;
  mForcingShowNavBarLayer=-1;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}
Program: 2967
Project: 2967
Buggy source:
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  final int visibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}

Fixed version (ground truth):
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  int tmpVisibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  if (mForcingShowNavBar && mFocusedWindow.getSurfaceLayer() < mForcingShowNavBarLayer) {
    tmpVisibility&=~View.SYSTEM_UI_CLEARABLE_FLAGS;
  }
  final int visibility=tmpVisibility;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}
Program: 2972
Project: 2972
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mForcingShowNavBar=false;
  mForcingShowNavBarLayer=-1;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}
Program: 2973
Project: 2973
Buggy source:
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  final int visibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}

Fixed version (ground truth):
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  int tmpVisibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  if (mForcingShowNavBar && mFocusedWindow.getSurfaceLayer() < mForcingShowNavBarLayer) {
    tmpVisibility&=~View.SYSTEM_UI_CLEARABLE_FLAGS;
  }
  final int visibility=tmpVisibility;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}
Program: 2978
Project: 2978
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mForcingShowNavBar=false;
  mForcingShowNavBarLayer=-1;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}
Program: 2979
Project: 2979
Buggy source:
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  final int visibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}

Fixed version (ground truth):
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  int tmpVisibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  if (mForcingShowNavBar && mFocusedWindow.getSurfaceLayer() < mForcingShowNavBarLayer) {
    tmpVisibility&=~View.SYSTEM_UI_CLEARABLE_FLAGS;
  }
  final int visibility=tmpVisibility;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}
Program: 2984
Project: 2984
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mForcingShowNavBar=false;
  mForcingShowNavBarLayer=-1;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
}
Program: 2985
Project: 2985
Buggy source:
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  final int visibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}

Fixed version (ground truth):
private int updateSystemUiVisibilityLw(){
  if (mFocusedWindow == null) {
    return 0;
  }
  if (mFocusedWindow.getAttrs().type == TYPE_KEYGUARD && mHideLockScreen == true) {
    return 0;
  }
  int tmpVisibility=mFocusedWindow.getSystemUiVisibility() & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
  if (mForcingShowNavBar && mFocusedWindow.getSurfaceLayer() < mForcingShowNavBarLayer) {
    tmpVisibility&=~View.SYSTEM_UI_CLEARABLE_FLAGS;
  }
  final int visibility=tmpVisibility;
  int diff=visibility ^ mLastSystemUiFlags;
  final boolean needsMenu=mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
  if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) {
    return 0;
  }
  mLastSystemUiFlags=visibility;
  mLastFocusNeedsMenu=needsMenu;
  mFocusedApp=mFocusedWindow.getAppToken();
  mHandler.post(new Runnable(){
    public void run(){
      try {
        IStatusBarService statusbar=getStatusBarService();
        if (statusbar != null) {
          statusbar.setSystemUiVisibility(visibility,0xffffffff);
          statusbar.topAppWindowChanged(needsMenu);
        }
      }
 catch (      RemoteException e) {
        mStatusBarService=null;
      }
    }
  }
);
  return diff;
}