nus-yam/ex-repair huggingface dataset:
Program: 2989
Project: 2989
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: 2990
Project: 2990
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: 2994
Project: 2994
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: 2995
Project: 2995
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: 2998
Project: 2998
Buggy source:
/** 
 * Called when this view wants to give up focus. If focus is cleared  {@link #onFocusChanged(boolean,int,android.graphics.Rect)} is called.<p> <strong>Note:</strong> When a View clears focus the framework is trying to give focus to the first focusable View from the top. Hence, if this View is the first from the top that can take focus, then all callbacks related to clearing focus will be invoked after wich the framework will give focus to this view. </p>
 */
public void clearFocus(){
  if (DBG) {
    System.out.println(this + "String_Node_Str");
  }
  if ((mPrivateFlags & PFLAG_FOCUSED) != 0) {
    mPrivateFlags&=~PFLAG_FOCUSED;
    if (mParent != null) {
      mParent.clearChildFocus(this);
    }
    onFocusChanged(false,0,null);
    refreshDrawableState();
    ensureInputFocusOnFirstFocusable();
    if (AccessibilityManager.getInstance(mContext).isEnabled()) {
      notifyAccessibilityStateChanged();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when this view wants to give up focus. If focus is cleared  {@link #onFocusChanged(boolean,int,android.graphics.Rect)} is called.<p> <strong>Note:</strong> When a View clears focus the framework is trying to give focus to the first focusable View from the top. Hence, if this View is the first from the top that can take focus, then all callbacks related to clearing focus will be invoked after wich the framework will give focus to this view. </p>
 */
public void clearFocus(){
  if (DBG) {
    System.out.println(this + "String_Node_Str");
  }
  if ((mPrivateFlags & PFLAG_FOCUSED) != 0) {
    mPrivateFlags&=~PFLAG_FOCUSED;
    if (mParent != null) {
      mParent.clearChildFocus(this);
    }
    onFocusChanged(false,0,null);
    refreshDrawableState();
    if (!rootViewRequestFocus()) {
      notifyGlobalFocusCleared(this);
    }
    if (AccessibilityManager.getInstance(mContext).isEnabled()) {
      notifyAccessibilityStateChanged();
    }
  }
}
Program: 2999
Project: 2999
Buggy source:
/** 
 * Give this view focus. This will cause  {@link #onFocusChanged(boolean,int,android.graphics.Rect)} to be called.Note: this does not check whether this  {@link View} should get focus, it justgives it focus no matter what.  It should only be called internally by framework code that knows what it is doing, namely  {@link #requestFocus(int,Rect)}.
 * @param direction values are {@link View#FOCUS_UP},   {@link View#FOCUS_DOWN},  {@link View#FOCUS_LEFT} or {@link View#FOCUS_RIGHT}. This is the direction which focus moved when requestFocus() is called. It may not always apply, in which case use the default View.FOCUS_DOWN.
 * @param previouslyFocusedRect The rectangle of the view that had focusprior in this View's coordinate system.
 */
void handleFocusGainInternal(int direction,Rect previouslyFocusedRect){
  if (DBG) {
    System.out.println(this + "String_Node_Str");
  }
  if ((mPrivateFlags & PFLAG_FOCUSED) == 0) {
    mPrivateFlags|=PFLAG_FOCUSED;
    if (mParent != null) {
      mParent.requestChildFocus(this,this);
    }
    onFocusChanged(true,direction,previouslyFocusedRect);
    refreshDrawableState();
    if (AccessibilityManager.getInstance(mContext).isEnabled()) {
      notifyAccessibilityStateChanged();
    }
  }
}

Fixed version (ground truth):
/** 
 * Give this view focus. This will cause  {@link #onFocusChanged(boolean,int,android.graphics.Rect)} to be called.Note: this does not check whether this  {@link View} should get focus, it justgives it focus no matter what.  It should only be called internally by framework code that knows what it is doing, namely  {@link #requestFocus(int,Rect)}.
 * @param direction values are {@link View#FOCUS_UP},   {@link View#FOCUS_DOWN},  {@link View#FOCUS_LEFT} or {@link View#FOCUS_RIGHT}. This is the direction which focus moved when requestFocus() is called. It may not always apply, in which case use the default View.FOCUS_DOWN.
 * @param previouslyFocusedRect The rectangle of the view that had focusprior in this View's coordinate system.
 */
void handleFocusGainInternal(int direction,Rect previouslyFocusedRect){
  if (DBG) {
    System.out.println(this + "String_Node_Str");
  }
  if ((mPrivateFlags & PFLAG_FOCUSED) == 0) {
    mPrivateFlags|=PFLAG_FOCUSED;
    View oldFocus=(mAttachInfo != null) ? getRootView().findFocus() : null;
    if (mParent != null) {
      mParent.requestChildFocus(this,this);
    }
    if (mAttachInfo != null) {
      mAttachInfo.mTreeObserver.dispatchOnGlobalFocusChange(oldFocus,this);
    }
    onFocusChanged(true,direction,previouslyFocusedRect);
    refreshDrawableState();
    if (AccessibilityManager.getInstance(mContext).isEnabled()) {
      notifyAccessibilityStateChanged();
    }
  }
}
Program: 3000
Project: 3000
Buggy source:
private void removeViewInternal(int index,View view){
  if (mTransition != null) {
    mTransition.removeChild(this,view);
  }
  boolean clearChildFocus=false;
  if (view == mFocused) {
    view.unFocus();
    clearChildFocus=true;
  }
  view.clearAccessibilityFocus();
  cancelTouchTarget(view);
  cancelHoverTarget(view);
  if (view.getAnimation() != null || (mTransitioningViews != null && mTransitioningViews.contains(view))) {
    addDisappearingView(view);
  }
 else   if (view.mAttachInfo != null) {
    view.dispatchDetachedFromWindow();
  }
  if (view.hasTransientState()) {
    childHasTransientStateChanged(view,false);
  }
  needGlobalAttributesUpdate(false);
  removeFromArray(index);
  if (clearChildFocus) {
    clearChildFocus(view);
    ensureInputFocusOnFirstFocusable();
  }
  if (view.isAccessibilityFocused()) {
    view.clearAccessibilityFocus();
  }
  onViewRemoved(view);
}

Fixed version (ground truth):
private void removeViewInternal(int index,View view){
  if (mTransition != null) {
    mTransition.removeChild(this,view);
  }
  boolean clearChildFocus=false;
  if (view == mFocused) {
    view.unFocus();
    clearChildFocus=true;
  }
  if (view.isAccessibilityFocused()) {
    view.clearAccessibilityFocus();
  }
  cancelTouchTarget(view);
  cancelHoverTarget(view);
  if (view.getAnimation() != null || (mTransitioningViews != null && mTransitioningViews.contains(view))) {
    addDisappearingView(view);
  }
 else   if (view.mAttachInfo != null) {
    view.dispatchDetachedFromWindow();
  }
  if (view.hasTransientState()) {
    childHasTransientStateChanged(view,false);
  }
  needGlobalAttributesUpdate(false);
  removeFromArray(index);
  if (clearChildFocus) {
    clearChildFocus(view);
    if (!rootViewRequestFocus()) {
      notifyGlobalFocusCleared(this);
    }
  }
  onViewRemoved(view);
}
Program: 3002
Project: 3002
Buggy source:
private void removeViewsInternal(int start,int count){
  final View focused=mFocused;
  final boolean detach=mAttachInfo != null;
  View clearChildFocus=null;
  final View[] children=mChildren;
  final int end=start + count;
  for (int i=start; i < end; i++) {
    final View view=children[i];
    if (mTransition != null) {
      mTransition.removeChild(this,view);
    }
    if (view == focused) {
      view.unFocus();
      clearChildFocus=view;
    }
    view.clearAccessibilityFocus();
    cancelTouchTarget(view);
    cancelHoverTarget(view);
    if (view.getAnimation() != null || (mTransitioningViews != null && mTransitioningViews.contains(view))) {
      addDisappearingView(view);
    }
 else     if (detach) {
      view.dispatchDetachedFromWindow();
    }
    if (view.hasTransientState()) {
      childHasTransientStateChanged(view,false);
    }
    needGlobalAttributesUpdate(false);
    onViewRemoved(view);
  }
  removeFromArray(start,count);
  if (clearChildFocus != null) {
    clearChildFocus(clearChildFocus);
    ensureInputFocusOnFirstFocusable();
  }
}

Fixed version (ground truth):
private void removeViewsInternal(int start,int count){
  final View focused=mFocused;
  final boolean detach=mAttachInfo != null;
  boolean clearChildFocus=false;
  final View[] children=mChildren;
  final int end=start + count;
  for (int i=start; i < end; i++) {
    final View view=children[i];
    if (mTransition != null) {
      mTransition.removeChild(this,view);
    }
    if (view == focused) {
      view.unFocus();
      clearChildFocus=true;
    }
    if (view.isAccessibilityFocused()) {
      view.clearAccessibilityFocus();
    }
    cancelTouchTarget(view);
    cancelHoverTarget(view);
    if (view.getAnimation() != null || (mTransitioningViews != null && mTransitioningViews.contains(view))) {
      addDisappearingView(view);
    }
 else     if (detach) {
      view.dispatchDetachedFromWindow();
    }
    if (view.hasTransientState()) {
      childHasTransientStateChanged(view,false);
    }
    needGlobalAttributesUpdate(false);
    onViewRemoved(view);
  }
  removeFromArray(start,count);
  if (clearChildFocus) {
    clearChildFocus(focused);
    if (!rootViewRequestFocus()) {
      notifyGlobalFocusCleared(focused);
    }
  }
}
Program: 3003
Project: 3003
Buggy source:
public void clearChildFocus(View child){
  checkThread();
  if (DEBUG_INPUT_RESIZE) {
    Log.v(TAG,"String_Node_Str");
  }
  mOldFocusedView=mFocusedView;
  if (focusSearch(null,View.FOCUS_FORWARD) == null) {
    mAttachInfo.mTreeObserver.dispatchOnGlobalFocusChange(mOldFocusedView,null);
  }
  mFocusedView=mRealFocusedView=null;
}

Fixed version (ground truth):
public void clearChildFocus(View child){
  if (DEBUG_INPUT_RESIZE) {
    Log.v(TAG,"String_Node_Str");
  }
  checkThread();
  scheduleTraversals();
}
Program: 3004
Project: 3004
Buggy source:
public void focusableViewAvailable(View v){
  checkThread();
  if (mView != null) {
    if (!mView.hasFocus()) {
      v.requestFocus();
    }
 else {
      mFocusedView=mView.findFocus();
      boolean descendantsHaveDibsOnFocus=(mFocusedView instanceof ViewGroup) && (((ViewGroup)mFocusedView).getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS);
      if (descendantsHaveDibsOnFocus && isViewDescendantOf(v,mFocusedView)) {
        v.requestFocus();
      }
    }
  }
}

Fixed version (ground truth):
public void focusableViewAvailable(View v){
  checkThread();
  if (mView != null) {
    if (!mView.hasFocus()) {
      v.requestFocus();
    }
 else {
      View focused=mView.findFocus();
      if (focused instanceof ViewGroup) {
        ViewGroup group=(ViewGroup)focused;
        if (group.getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS && isViewDescendantOf(v,focused)) {
          v.requestFocus();
        }
      }
    }
  }
}
Program: 3005
Project: 3005
Buggy source:
private boolean enterTouchMode(){
  if (mView != null) {
    if (mView.hasFocus()) {
      final View focused=mView.findFocus();
      if (focused != null && !focused.isFocusableInTouchMode()) {
        final ViewGroup ancestorToTakeFocus=findAncestorToTakeFocusInTouchMode(focused);
        if (ancestorToTakeFocus != null) {
          return ancestorToTakeFocus.requestFocus();
        }
 else {
          mView.unFocus();
          mAttachInfo.mTreeObserver.dispatchOnGlobalFocusChange(focused,null);
          mFocusedView=null;
          mOldFocusedView=null;
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean enterTouchMode(){
  if (mView != null) {
    if (mView.hasFocus()) {
      final View focused=mView.findFocus();
      if (focused != null && !focused.isFocusableInTouchMode()) {
        final ViewGroup ancestorToTakeFocus=findAncestorToTakeFocusInTouchMode(focused);
        if (ancestorToTakeFocus != null) {
          return ancestorToTakeFocus.requestFocus();
        }
 else {
          focused.unFocus();
          return true;
        }
      }
    }
  }
  return false;
}
Program: 3006
Project: 3006
Buggy source:
private boolean leaveTouchMode(){
  if (mView != null) {
    if (mView.hasFocus()) {
      mFocusedView=mView.findFocus();
      if (!(mFocusedView instanceof ViewGroup)) {
        return false;
      }
 else       if (((ViewGroup)mFocusedView).getDescendantFocusability() != ViewGroup.FOCUS_AFTER_DESCENDANTS) {
        return false;
      }
    }
    final View focused=focusSearch(null,View.FOCUS_DOWN);
    if (focused != null) {
      return focused.requestFocus(View.FOCUS_DOWN);
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean leaveTouchMode(){
  if (mView != null) {
    if (mView.hasFocus()) {
      View focusedView=mView.findFocus();
      if (!(focusedView instanceof ViewGroup)) {
        return false;
      }
 else       if (((ViewGroup)focusedView).getDescendantFocusability() != ViewGroup.FOCUS_AFTER_DESCENDANTS) {
        return false;
      }
    }
    final View focused=focusSearch(null,View.FOCUS_DOWN);
    if (focused != null) {
      return focused.requestFocus(View.FOCUS_DOWN);
    }
  }
  return false;
}
Program: 3009
Project: 3009
Buggy source:
public void requestChildFocus(View child,View focused){
  checkThread();
  if (DEBUG_INPUT_RESIZE) {
    Log.v(TAG,"String_Node_Str" + focused);
  }
  mAttachInfo.mTreeObserver.dispatchOnGlobalFocusChange(mOldFocusedView,focused);
  scheduleTraversals();
  mFocusedView=mRealFocusedView=focused;
}

Fixed version (ground truth):
public void requestChildFocus(View child,View focused){
  if (DEBUG_INPUT_RESIZE) {
    Log.v(TAG,"String_Node_Str" + focused);
  }
  checkThread();
  scheduleTraversals();
}
Program: 3013
Project: 3013
Buggy source:
/** 
 * Default implementation of  {@link android.view.Window.Callback#onMenuItemSelected}for activities.  This calls through to the new  {@link #onOptionsItemSelected} method for the{@link android.view.Window#FEATURE_OPTIONS_PANEL}panel, so that subclasses of Activity don't need to deal with feature codes.
 */
public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
    EventLog.writeEvent(50000,0,item.getTitleCondensed().toString());
  if (onOptionsItemSelected(item)) {
    return true;
  }
if (mFragments.dispatchOptionsItemSelected(item)) {
  return true;
}
if (item.getItemId() == android.R.id.home && mActionBar != null && (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if (mParent == null) {
  return onNavigateUp();
}
 else {
  return mParent.onNavigateUpFromChild(this);
}
}
return false;
case Window.FEATURE_CONTEXT_MENU:
EventLog.writeEvent(50000,1,item.getTitleCondensed().toString());
if (onContextItemSelected(item)) {
return true;
}
return mFragments.dispatchContextItemSelected(item);
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * Default implementation of  {@link android.view.Window.Callback#onMenuItemSelected}for activities.  This calls through to the new  {@link #onOptionsItemSelected} method for the{@link android.view.Window#FEATURE_OPTIONS_PANEL}panel, so that subclasses of Activity don't need to deal with feature codes.
 */
public boolean onMenuItemSelected(int featureId,MenuItem item){
  CharSequence titleCondensed=item.getTitleCondensed();
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
    if (titleCondensed != null) {
      EventLog.writeEvent(50000,0,titleCondensed.toString());
    }
  if (onOptionsItemSelected(item)) {
    return true;
  }
if (mFragments.dispatchOptionsItemSelected(item)) {
  return true;
}
if (item.getItemId() == android.R.id.home && mActionBar != null && (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if (mParent == null) {
  return onNavigateUp();
}
 else {
  return mParent.onNavigateUpFromChild(this);
}
}
return false;
case Window.FEATURE_CONTEXT_MENU:
if (titleCondensed != null) {
EventLog.writeEvent(50000,1,titleCondensed.toString());
}
if (onContextItemSelected(item)) {
return true;
}
return mFragments.dispatchContextItemSelected(item);
default :
return false;
}
}
Program: 3014
Project: 3014
Buggy source:
/** 
 * Default implementation of  {@link android.view.Window.Callback#onMenuItemSelected}for activities.  This calls through to the new  {@link #onOptionsItemSelected} method for the{@link android.view.Window#FEATURE_OPTIONS_PANEL}panel, so that subclasses of Activity don't need to deal with feature codes.
 */
public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
    EventLog.writeEvent(50000,0,item.getTitleCondensed().toString());
  if (onOptionsItemSelected(item)) {
    return true;
  }
if (mFragments.dispatchOptionsItemSelected(item)) {
  return true;
}
if (item.getItemId() == android.R.id.home && mActionBar != null && (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if (mParent == null) {
  return onNavigateUp();
}
 else {
  return mParent.onNavigateUpFromChild(this);
}
}
return false;
case Window.FEATURE_CONTEXT_MENU:
EventLog.writeEvent(50000,1,item.getTitleCondensed().toString());
if (onContextItemSelected(item)) {
return true;
}
return mFragments.dispatchContextItemSelected(item);
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * Default implementation of  {@link android.view.Window.Callback#onMenuItemSelected}for activities.  This calls through to the new  {@link #onOptionsItemSelected} method for the{@link android.view.Window#FEATURE_OPTIONS_PANEL}panel, so that subclasses of Activity don't need to deal with feature codes.
 */
public boolean onMenuItemSelected(int featureId,MenuItem item){
  CharSequence titleCondensed=item.getTitleCondensed();
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
    if (titleCondensed != null) {
      EventLog.writeEvent(50000,0,titleCondensed.toString());
    }
  if (onOptionsItemSelected(item)) {
    return true;
  }
if (mFragments.dispatchOptionsItemSelected(item)) {
  return true;
}
if (item.getItemId() == android.R.id.home && mActionBar != null && (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if (mParent == null) {
  return onNavigateUp();
}
 else {
  return mParent.onNavigateUpFromChild(this);
}
}
return false;
case Window.FEATURE_CONTEXT_MENU:
if (titleCondensed != null) {
EventLog.writeEvent(50000,1,titleCondensed.toString());
}
if (onContextItemSelected(item)) {
return true;
}
return mFragments.dispatchContextItemSelected(item);
default :
return false;
}
}
Program: 3015
Project: 3015
Buggy source:
/** 
 * Default implementation of  {@link android.view.Window.Callback#onMenuItemSelected}for activities.  This calls through to the new  {@link #onOptionsItemSelected} method for the{@link android.view.Window#FEATURE_OPTIONS_PANEL}panel, so that subclasses of Activity don't need to deal with feature codes.
 */
public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
    EventLog.writeEvent(50000,0,item.getTitleCondensed().toString());
  if (onOptionsItemSelected(item)) {
    return true;
  }
if (mFragments.dispatchOptionsItemSelected(item)) {
  return true;
}
if (item.getItemId() == android.R.id.home && mActionBar != null && (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if (mParent == null) {
  return onNavigateUp();
}
 else {
  return mParent.onNavigateUpFromChild(this);
}
}
return false;
case Window.FEATURE_CONTEXT_MENU:
EventLog.writeEvent(50000,1,item.getTitleCondensed().toString());
if (onContextItemSelected(item)) {
return true;
}
return mFragments.dispatchContextItemSelected(item);
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * Default implementation of  {@link android.view.Window.Callback#onMenuItemSelected}for activities.  This calls through to the new  {@link #onOptionsItemSelected} method for the{@link android.view.Window#FEATURE_OPTIONS_PANEL}panel, so that subclasses of Activity don't need to deal with feature codes.
 */
public boolean onMenuItemSelected(int featureId,MenuItem item){
  CharSequence titleCondensed=item.getTitleCondensed();
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
    if (titleCondensed != null) {
      EventLog.writeEvent(50000,0,titleCondensed.toString());
    }
  if (onOptionsItemSelected(item)) {
    return true;
  }
if (mFragments.dispatchOptionsItemSelected(item)) {
  return true;
}
if (item.getItemId() == android.R.id.home && mActionBar != null && (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if (mParent == null) {
  return onNavigateUp();
}
 else {
  return mParent.onNavigateUpFromChild(this);
}
}
return false;
case Window.FEATURE_CONTEXT_MENU:
if (titleCondensed != null) {
EventLog.writeEvent(50000,1,titleCondensed.toString());
}
if (onContextItemSelected(item)) {
return true;
}
return mFragments.dispatchContextItemSelected(item);
default :
return false;
}
}
Program: 3016
Project: 3016
Buggy source:
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;
}

Fixed version (ground truth):
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;
}
Program: 3017
Project: 3017
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 (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 (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;
    }
  }
}
Program: 3018
Project: 3018
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 3019
Project: 3019
Buggy source:
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;
}

Fixed version (ground truth):
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;
}
Program: 3020
Project: 3020
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 (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 (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;
    }
  }
}
Program: 3021
Project: 3021
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 3022
Project: 3022
Buggy source:
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;
}

Fixed version (ground truth):
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;
}
Program: 3023
Project: 3023
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 (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 (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;
    }
  }
}
Program: 3024
Project: 3024
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 3025
Project: 3025
Buggy source:
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;
}

Fixed version (ground truth):
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;
}
Program: 3026
Project: 3026
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 (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 (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;
    }
  }
}
Program: 3027
Project: 3027
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}
Program: 3028
Project: 3028
Buggy source:
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;
}

Fixed version (ground truth):
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;
}
Program: 3029
Project: 3029
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 (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 (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;
    }
  }
}
Program: 3030
Project: 3030
Buggy source:
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}

Fixed version (ground truth):
private static boolean isSystemImeThatHasEnglishSubtype(InputMethodInfo imi){
  if (!isSystemIme(imi)) {
    return false;
  }
  if (imi.isAuxiliaryIme()) {
    return false;
  }
  return containsSubtypeOf(imi,ENGLISH_LOCALE.getLanguage());
}