nus-yam/ex-repair huggingface dataset:
Program: 22802
Project: 22802
Buggy source:
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mUserQuery=null;
}

Fixed version (ground truth):
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  getContext().unregisterReceiver(mConfChangeListener);
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mUserQuery=null;
}
Program: 22804
Project: 22804
Buggy source:
/** 
 * Constructor - fires it up and makes it look like the search UI.
 * @param context Application Context we can use for system acess
 */
public SearchDialog(Context context,SearchManager searchManager){
  super(context,com.android.internal.R.style.Theme_SearchBar);
  mVoiceWebSearchIntent=new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
  mVoiceWebSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
  mVoiceAppSearchIntent=new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mSearchManager=searchManager;
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
  context.registerReceiver(new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (intent.getAction().equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
        onConfigurationChanged();
      }
    }
  }
,filter);
}

Fixed version (ground truth):
/** 
 * Constructor - fires it up and makes it look like the search UI.
 * @param context Application Context we can use for system acess
 */
public SearchDialog(Context context,SearchManager searchManager){
  super(context,com.android.internal.R.style.Theme_SearchBar);
  mVoiceWebSearchIntent=new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
  mVoiceWebSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
  mVoiceAppSearchIntent=new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mSearchManager=searchManager;
}
Program: 22805
Project: 22805
Buggy source:
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mUserQuery=null;
}

Fixed version (ground truth):
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  getContext().unregisterReceiver(mConfChangeListener);
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mUserQuery=null;
}
Program: 22806
Project: 22806
Buggy source:
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  mMobileDataState=Phone.DataState.CONNECTING;
setDetailedState(DetailedState.CONNECTING,Phone.REASON_APN_CHANGED,null);
Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnTypeToWatchFor);
intent.putExtra(Phone.DATA_APN_KEY,mApnName);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
mEnabled=true;
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
mEnabled=false;
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}

Fixed version (ground truth):
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  mMobileDataState=Phone.DataState.CONNECTING;
setDetailedState(DetailedState.CONNECTING,Phone.REASON_APN_CHANGED,null);
Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnTypeToWatchFor);
intent.putExtra(Phone.DATA_APN_KEY,mApnName);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
mEnabled=true;
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
if (mApnType != Phone.APN_TYPE_DEFAULT) {
mEnabled=false;
}
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}
Program: 22807
Project: 22807
Buggy source:
private void recreateLockScreen(){
  if (mLockScreen.getVisibility() == View.VISIBLE) {
    ((KeyguardScreen)mLockScreen).onPause();
  }
  ((KeyguardScreen)mLockScreen).cleanUp();
  removeViewInLayout(mLockScreen);
  mLockScreen=createLockScreen();
  mLockScreen.setVisibility(View.INVISIBLE);
  addView(mLockScreen);
}

Fixed version (ground truth):
private void recreateLockScreen(){
  if (mLockScreen.getVisibility() == View.VISIBLE) {
    ((KeyguardScreen)mLockScreen).onPause();
  }
  ((KeyguardScreen)mLockScreen).cleanUp();
  removeView(mLockScreen);
  mLockScreen=createLockScreen();
  mLockScreen.setVisibility(View.INVISIBLE);
  addView(mLockScreen);
}
Program: 22808
Project: 22808
Buggy source:
private void updateScreen(final Mode mode){
  mMode=mode;
  if (mode == Mode.UnlockScreen && mCurrentUnlockMode != getUnlockMode()) {
    recreateUnlockScreen();
  }
  final View goneScreen=(mode == Mode.LockScreen) ? mUnlockScreen : mLockScreen;
  final View visibleScreen=(mode == Mode.LockScreen) ? mLockScreen : mUnlockScreen;
  mWindowController.setNeedsInput(((KeyguardScreen)visibleScreen).needsInput());
  if (mScreenOn) {
    if (goneScreen.getVisibility() == View.VISIBLE) {
      ((KeyguardScreen)goneScreen).onPause();
    }
    if (visibleScreen.getVisibility() != View.VISIBLE) {
      ((KeyguardScreen)visibleScreen).onResume();
    }
  }
  goneScreen.setVisibility(View.GONE);
  visibleScreen.setVisibility(View.VISIBLE);
  if (!visibleScreen.requestFocus()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + visibleScreen.getClass().getCanonicalName());
  }
}

Fixed version (ground truth):
private void updateScreen(final Mode mode){
  if (DEBUG_CONFIGURATION)   Log.v(TAG,"String_Node_Str" + mode + "String_Node_Str"+ mMode,new RuntimeException());
  mMode=mode;
  if (mode == Mode.UnlockScreen && mCurrentUnlockMode != getUnlockMode()) {
    recreateUnlockScreen();
  }
  final View goneScreen=(mode == Mode.LockScreen) ? mUnlockScreen : mLockScreen;
  final View visibleScreen=(mode == Mode.LockScreen) ? mLockScreen : mUnlockScreen;
  mWindowController.setNeedsInput(((KeyguardScreen)visibleScreen).needsInput());
  if (DEBUG_CONFIGURATION) {
    Log.v(TAG,"String_Node_Str" + goneScreen);
    Log.v(TAG,"String_Node_Str" + visibleScreen);
  }
  if (mScreenOn) {
    if (goneScreen.getVisibility() == View.VISIBLE) {
      ((KeyguardScreen)goneScreen).onPause();
    }
    if (visibleScreen.getVisibility() != View.VISIBLE) {
      ((KeyguardScreen)visibleScreen).onResume();
    }
  }
  goneScreen.setVisibility(View.GONE);
  visibleScreen.setVisibility(View.VISIBLE);
  requestLayout();
  if (!visibleScreen.requestFocus()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + visibleScreen.getClass().getCanonicalName());
  }
}
Program: 22809
Project: 22809
Buggy source:
private void recreateUnlockScreen(){
  if (mUnlockScreen.getVisibility() == View.VISIBLE) {
    ((KeyguardScreen)mUnlockScreen).onPause();
  }
  ((KeyguardScreen)mUnlockScreen).cleanUp();
  removeViewInLayout(mUnlockScreen);
  final UnlockMode unlockMode=getUnlockMode();
  mUnlockScreen=createUnlockScreenFor(unlockMode);
  mUnlockScreen.setVisibility(View.INVISIBLE);
  mUnlockScreenMode=unlockMode;
  addView(mUnlockScreen);
}

Fixed version (ground truth):
private void recreateUnlockScreen(){
  if (mUnlockScreen.getVisibility() == View.VISIBLE) {
    ((KeyguardScreen)mUnlockScreen).onPause();
  }
  ((KeyguardScreen)mUnlockScreen).cleanUp();
  removeView(mUnlockScreen);
  final UnlockMode unlockMode=getUnlockMode();
  mUnlockScreen=createUnlockScreenFor(unlockMode);
  mUnlockScreen.setVisibility(View.INVISIBLE);
  mUnlockScreenMode=unlockMode;
  addView(mUnlockScreen);
}
Program: 22811
Project: 22811
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  if (DBG) {
    Log.v(TAG,"String_Node_Str" + SystemClock.elapsedRealtime());
    if (getResources().getConfiguration().orientation != newConfig.orientation) {
      Log.e(TAG,"String_Node_Str",new Exception("String_Node_Str"));
    }
  }
  if (newConfig.orientation != mCreationOrientation) {
    mCallback.recreateMe(newConfig);
  }
 else   if (newConfig.hardKeyboardHidden != mKeyboardHidden) {
    mKeyboardHidden=newConfig.hardKeyboardHidden;
    final boolean isKeyboardOpen=mKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
    if (mUpdateMonitor.isKeyguardBypassEnabled() && isKeyboardOpen) {
      mCallback.goToUnlockScreen();
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  if (LockPatternKeyguardView.DEBUG_CONFIGURATION) {
    Log.w(TAG,"String_Node_Str",new RuntimeException());
    Log.v(TAG,"String_Node_Str" + mCreationOrientation + "String_Node_Str"+ newConfig);
  }
  updateConfiguration();
}
Program: 22812
Project: 22812
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  if (newConfig.orientation != mCreationOrientation) {
    mCallback.recreateMe(newConfig);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  if (LockPatternKeyguardView.DEBUG_CONFIGURATION) {
    Log.v(TAG,"String_Node_Str");
    Log.v(TAG,"String_Node_Str" + mCreationOrientation + "String_Node_Str"+ getResources().getConfiguration());
  }
  if (newConfig.orientation != mCreationOrientation) {
    mCallback.recreateMe(newConfig);
  }
}
Program: 22813
Project: 22813
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  if (newConfig.orientation != mCreationOrientation) {
    mCallback.recreateMe(newConfig);
  }
 else   if (newConfig.hardKeyboardHidden != mKeyboardHidden) {
    mKeyboardHidden=newConfig.hardKeyboardHidden;
    final boolean isKeyboardOpen=mKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
    if (mUpdateMonitor.isKeyguardBypassEnabled() && isKeyboardOpen) {
      mCallback.goToUnlockScreen();
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  updateConfiguration();
}
Program: 22816
Project: 22816
Buggy source:
/** 
 * Register a listener for audio focus updates.
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
  if (l == null) {
    return;
  }
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}

Fixed version (ground truth):
/** 
 * Register a listener for audio focus updates.
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}
Program: 22817
Project: 22817
Buggy source:
private String getIdForAudioFocusListener(OnAudioFocusChangeListener l){
  if (l == null) {
    return new String();
  }
 else {
    return new String(this.toString() + l.toString());
  }
}

Fixed version (ground truth):
private String getIdForAudioFocusListener(OnAudioFocusChangeListener l){
  if (l == null) {
    return new String(this.toString());
  }
 else {
    return new String(this.toString() + l.toString());
  }
}
Program: 22818
Project: 22818
Buggy source:
/** 
 * Register a listener for audio focus updates.
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
  if (l == null) {
    return;
  }
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}

Fixed version (ground truth):
/** 
 * Register a listener for audio focus updates.
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}
Program: 22819
Project: 22819
Buggy source:
private String getIdForAudioFocusListener(OnAudioFocusChangeListener l){
  if (l == null) {
    return new String();
  }
 else {
    return new String(this.toString() + l.toString());
  }
}

Fixed version (ground truth):
private String getIdForAudioFocusListener(OnAudioFocusChangeListener l){
  if (l == null) {
    return new String(this.toString());
  }
 else {
    return new String(this.toString() + l.toString());
  }
}
Program: 22821
Project: 22821
Buggy source:
/** 
 * AccountUnlockScreen constructor.
 */
public AccountUnlockScreen(Context context,KeyguardScreenCallback callback,LockPatternUtils lockPatternUtils){
  super(context);
  mCallback=callback;
  mLockPatternUtils=lockPatternUtils;
  LayoutInflater.from(context).inflate(R.layout.keyguard_screen_glogin_unlock,this,true);
  mTopHeader=(TextView)findViewById(R.id.topHeader);
  mTopHeader.setText(mLockPatternUtils.isPermanentlyLocked() ? R.string.lockscreen_glogin_too_many_attempts : R.string.lockscreen_glogin_forgot_pattern);
  mInstructions=(TextView)findViewById(R.id.instructions);
  mLogin=(EditText)findViewById(R.id.login);
  mLogin.setFilters(new InputFilter[]{new LoginFilter.UsernameFilterGeneric()});
  mLogin.addTextChangedListener(this);
  mPassword=(EditText)findViewById(R.id.password);
  mPassword.addTextChangedListener(this);
  mOk=(Button)findViewById(R.id.ok);
  mOk.setOnClickListener(this);
  mEmergencyCall=(Button)findViewById(R.id.emergencyCall);
  mEmergencyCall.setOnClickListener(this);
  mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
}

Fixed version (ground truth):
/** 
 * AccountUnlockScreen constructor.
 * @param configuration
 */
public AccountUnlockScreen(Context context,Configuration configuration,KeyguardScreenCallback callback,LockPatternUtils lockPatternUtils){
  super(context);
  mCallback=callback;
  mLockPatternUtils=lockPatternUtils;
  LayoutInflater.from(context).inflate(R.layout.keyguard_screen_glogin_unlock,this,true);
  mTopHeader=(TextView)findViewById(R.id.topHeader);
  mTopHeader.setText(mLockPatternUtils.isPermanentlyLocked() ? R.string.lockscreen_glogin_too_many_attempts : R.string.lockscreen_glogin_forgot_pattern);
  mInstructions=(TextView)findViewById(R.id.instructions);
  mLogin=(EditText)findViewById(R.id.login);
  mLogin.setFilters(new InputFilter[]{new LoginFilter.UsernameFilterGeneric()});
  mLogin.addTextChangedListener(this);
  mPassword=(EditText)findViewById(R.id.password);
  mPassword.addTextChangedListener(this);
  mOk=(Button)findViewById(R.id.ok);
  mOk.setOnClickListener(this);
  mEmergencyCall=(Button)findViewById(R.id.emergencyCall);
  mEmergencyCall.setOnClickListener(this);
  mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
}
Program: 22822
Project: 22822
Buggy source:
/** 
 * Stay on me, but recreate me (so I can use a different layout).
 */
void recreateMe();

Fixed version (ground truth):
/** 
 * Stay on me, but recreate me (so I can use a different layout).
 */
void recreateMe(Configuration config);
Program: 22823
Project: 22823
Buggy source:
/** 
 * Remove the given observer from being registered from any of the kinds of callbacks.
 * @param observer The observer to remove (an instance of {@link ConfigurationChangeCallback},  {@link InfoCallback} or {@link SimStateCallback}
 */
public void removeCallback(Object observer){
  mConfigurationChangeCallbacks.remove(observer);
  mInfoCallbacks.remove(observer);
  mSimStateCallbacks.remove(observer);
}

Fixed version (ground truth):
/** 
 * Remove the given observer from being registered from any of the kinds of callbacks.
 * @param observer The observer to remove (an instance of {@link ConfigurationChangeCallback},  {@link InfoCallback} or {@link SimStateCallback}
 */
public void removeCallback(Object observer){
  mInfoCallbacks.remove(observer);
  mSimStateCallbacks.remove(observer);
}
Program: 22825
Project: 22825
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_CONFIGURATION_CHANGED:
    handleConfigurationChange();
  break;
case MSG_TIME_UPDATE:
handleTimeUpdate();
break;
case MSG_BATTERY_UPDATE:
handleBatteryUpdate(msg.arg1,msg.arg2);
break;
case MSG_CARRIER_INFO_UPDATE:
handleCarrierInfoUpdate();
break;
case MSG_SIM_STATE_CHANGE:
handleSimStateChange((SimArgs)msg.obj);
break;
case MSG_RINGER_MODE_CHANGED:
handleRingerModeChange(msg.arg1);
break;
case MSG_PHONE_STATE_CHANGED:
handlePhoneStateChanged((String)msg.obj);
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_TIME_UPDATE:
    handleTimeUpdate();
  break;
case MSG_BATTERY_UPDATE:
handleBatteryUpdate(msg.arg1,msg.arg2);
break;
case MSG_CARRIER_INFO_UPDATE:
handleCarrierInfoUpdate();
break;
case MSG_SIM_STATE_CHANGE:
handleSimStateChange((SimArgs)msg.obj);
break;
case MSG_RINGER_MODE_CHANGED:
handleRingerModeChange(msg.arg1);
break;
case MSG_PHONE_STATE_CHANGED:
handlePhoneStateChanged((String)msg.obj);
break;
}
}
Program: 22827
Project: 22827
Buggy source:
View createLockScreen(){
  return new LockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback);
}

Fixed version (ground truth):
View createLockScreen(){
  return new LockScreen(mContext,mConfiguration,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback);
}
Program: 22829
Project: 22829
Buggy source:
View createUnlockScreenFor(UnlockMode unlockMode){
  mIsPortrait=getResources().getBoolean(R.bool.lockscreen_isPortrait);
  View unlockView=null;
  if (unlockMode == UnlockMode.Pattern) {
    PatternUnlockScreen view=new PatternUnlockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback,mUpdateMonitor.getFailedAttempts());
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + unlockMode + "String_Node_Str"+ mEnableFallback);
    view.setEnableFallback(mEnableFallback);
    unlockView=view;
  }
 else   if (unlockMode == UnlockMode.SimPin) {
    unlockView=new SimUnlockScreen(mContext,mUpdateMonitor,mKeyguardScreenCallback,mLockPatternUtils);
  }
 else   if (unlockMode == UnlockMode.Account) {
    try {
      unlockView=new AccountUnlockScreen(mContext,mKeyguardScreenCallback,mLockPatternUtils);
    }
 catch (    IllegalStateException e) {
      Log.i(TAG,"String_Node_Str" + "String_Node_Str");
      unlockView=createUnlockScreenFor(UnlockMode.Pattern);
    }
  }
 else   if (unlockMode == UnlockMode.Password) {
    unlockView=new PasswordUnlockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + unlockMode);
  }
  mCurrentUnlockMode=unlockMode;
  return unlockView;
}

Fixed version (ground truth):
View createUnlockScreenFor(UnlockMode unlockMode){
  View unlockView=null;
  if (unlockMode == UnlockMode.Pattern) {
    PatternUnlockScreen view=new PatternUnlockScreen(mContext,mConfiguration,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback,mUpdateMonitor.getFailedAttempts());
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + unlockMode + "String_Node_Str"+ mEnableFallback);
    view.setEnableFallback(mEnableFallback);
    unlockView=view;
  }
 else   if (unlockMode == UnlockMode.SimPin) {
    unlockView=new SimUnlockScreen(mContext,mConfiguration,mUpdateMonitor,mKeyguardScreenCallback,mLockPatternUtils);
  }
 else   if (unlockMode == UnlockMode.Account) {
    try {
      unlockView=new AccountUnlockScreen(mContext,mConfiguration,mKeyguardScreenCallback,mLockPatternUtils);
    }
 catch (    IllegalStateException e) {
      Log.i(TAG,"String_Node_Str" + "String_Node_Str");
      unlockView=createUnlockScreenFor(UnlockMode.Pattern);
    }
  }
 else   if (unlockMode == UnlockMode.Password) {
    unlockView=new PasswordUnlockScreen(mContext,mConfiguration,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + unlockMode);
  }
  mCurrentUnlockMode=unlockMode;
  return unlockView;
}
Program: 22830
Project: 22830
Buggy source:
@Override protected void dispatchDraw(Canvas canvas){
  final int orientation=getResources().getConfiguration().orientation;
  if (mIsPortrait && Configuration.ORIENTATION_PORTRAIT != orientation || getResources().getBoolean(R.bool.lockscreen_isPortrait) != mIsPortrait) {
    postInvalidate();
    ViewGroup view=(ViewGroup)(mMode == Mode.LockScreen ? mLockScreen : mUnlockScreen);
    if (view != null && view.getChildAt(0) != null) {
      Drawable background=view.getChildAt(0).getBackground();
      if (background != null) {
        background.draw(canvas);
      }
    }
    return;
  }
  super.dispatchDraw(canvas);
}

Fixed version (ground truth):
@Override protected void dispatchDraw(Canvas canvas){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + SystemClock.elapsedRealtime());
  super.dispatchDraw(canvas);
}
Program: 22831
Project: 22831
Buggy source:
public void recreateMe(){
  recreateScreens();
}

Fixed version (ground truth):
public void recreateMe(Configuration config){
  mConfiguration=config;
  recreateScreens();
}
Program: 22832
Project: 22832
Buggy source:
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
      }
      if (mScrollY != 0) {
        mScrollY=0;
        invalidate();
      }
    }
  }
  mLastTouchMode=isInTouchMode ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
}

Fixed version (ground truth):
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
      }
      if (mScrollY != 0) {
        mScrollY=0;
        invalidate();
      }
    }
  }
}
Program: 22833
Project: 22833
Buggy source:
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
      }
      if (mScrollY != 0) {
        mScrollY=0;
        invalidate();
      }
    }
  }
  mLastTouchMode=isInTouchMode ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
}

Fixed version (ground truth):
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
      }
      if (mScrollY != 0) {
        mScrollY=0;
        invalidate();
      }
    }
  }
}
Program: 22834
Project: 22834
Buggy source:
/** 
 * @param contentResolver Used to look up and save settings.
 */
public LockPatternUtils(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  mDevicePolicyManager=getDevicePolicyManager();
  if (sLockPatternFilename == null) {
    sLockPatternFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PATTERN_FILE;
    sLockPasswordFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PASSWORD_FILE;
  }
}

Fixed version (ground truth):
/** 
 * @param contentResolver Used to look up and save settings.
 */
public LockPatternUtils(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  if (sLockPatternFilename == null) {
    sLockPatternFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PATTERN_FILE;
    sLockPasswordFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PASSWORD_FILE;
  }
}
Program: 22835
Project: 22835
Buggy source:
public void testScreenRequestsRecreation(){
  mLPKV.wakeWhenReadyTq(0);
  mLPKV.onScreenTurnedOn();
  assertEquals(1,mLPKV.getInjectedLockScreens().size());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().size());
  MockKeyguardScreen lockScreen=mLPKV.getInjectedLockScreens().get(0);
  assertEquals(0,lockScreen.getOnPauseCount());
  assertEquals(1,lockScreen.getOnResumeCount());
  mLPKV.mKeyguardScreenCallback.recreateMe();
  assertEquals(2,mLPKV.getInjectedLockScreens().size());
  assertEquals(2,mLPKV.getInjectedUnlockScreens().size());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getOnPauseCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(0).getOnPauseCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(1).getOnResumeCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(1).getOnResumeCount());
}

Fixed version (ground truth):
public void testScreenRequestsRecreation(){
  mLPKV.wakeWhenReadyTq(0);
  mLPKV.onScreenTurnedOn();
  assertEquals(1,mLPKV.getInjectedLockScreens().size());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().size());
  MockKeyguardScreen lockScreen=mLPKV.getInjectedLockScreens().get(0);
  assertEquals(0,lockScreen.getOnPauseCount());
  assertEquals(1,lockScreen.getOnResumeCount());
  mLPKV.mKeyguardScreenCallback.recreateMe(new Configuration());
  assertEquals(2,mLPKV.getInjectedLockScreens().size());
  assertEquals(2,mLPKV.getInjectedUnlockScreens().size());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getOnPauseCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(0).getOnPauseCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(1).getOnResumeCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(1).getOnResumeCount());
}
Program: 22836
Project: 22836
Buggy source:
/** 
 * Figures out the layout for the menu items.
 * @param width The available width for the icon menu.
 */
private void layoutItems(int width){
  int numItems=getChildCount();
  int curNumRows=Math.min((int)Math.ceil(numItems / (float)mMaxItemsPerRow),mMaxRows);
  for (; curNumRows <= mMaxRows; curNumRows++) {
    layoutItemsUsingGravity(curNumRows,numItems);
    if (curNumRows >= numItems) {
      break;
    }
    if (doItemsFit()) {
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Figures out the layout for the menu items.
 * @param width The available width for the icon menu.
 */
private void layoutItems(int width){
  int numItems=getChildCount();
  if (numItems == 0) {
    mLayoutNumRows=0;
    return;
  }
  int curNumRows=Math.min((int)Math.ceil(numItems / (float)mMaxItemsPerRow),mMaxRows);
  for (; curNumRows <= mMaxRows; curNumRows++) {
    layoutItemsUsingGravity(curNumRows,numItems);
    if (curNumRows >= numItems) {
      break;
    }
    if (doItemsFit()) {
      break;
    }
  }
}
Program: 22837
Project: 22837
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mHasStaleChildren) {
    mHasStaleChildren=false;
    updateChildren(false);
  }
  int measuredWidth=resolveSize(Integer.MAX_VALUE,widthMeasureSpec);
  calculateItemFittingMetadata(measuredWidth);
  layoutItems(measuredWidth);
  final int desiredHeight=(mRowHeight + mHorizontalDividerHeight) * mLayoutNumRows - mHorizontalDividerHeight;
  setMeasuredDimension(measuredWidth,resolveSize(desiredHeight,heightMeasureSpec));
  positionChildren(mMeasuredWidth,mMeasuredHeight);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mHasStaleChildren) {
    mHasStaleChildren=false;
    updateChildren(false);
  }
  int measuredWidth=resolveSize(Integer.MAX_VALUE,widthMeasureSpec);
  calculateItemFittingMetadata(measuredWidth);
  layoutItems(measuredWidth);
  final int layoutNumRows=mLayoutNumRows;
  final int desiredHeight=(mRowHeight + mHorizontalDividerHeight) * layoutNumRows - mHorizontalDividerHeight;
  setMeasuredDimension(measuredWidth,resolveSize(desiredHeight,heightMeasureSpec));
  if (layoutNumRows > 0) {
    positionChildren(mMeasuredWidth,mMeasuredHeight);
  }
}
Program: 22838
Project: 22838
Buggy source:
/** 
 * Figures out the layout for the menu items.
 * @param width The available width for the icon menu.
 */
private void layoutItems(int width){
  int numItems=getChildCount();
  int curNumRows=Math.min((int)Math.ceil(numItems / (float)mMaxItemsPerRow),mMaxRows);
  for (; curNumRows <= mMaxRows; curNumRows++) {
    layoutItemsUsingGravity(curNumRows,numItems);
    if (curNumRows >= numItems) {
      break;
    }
    if (doItemsFit()) {
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Figures out the layout for the menu items.
 * @param width The available width for the icon menu.
 */
private void layoutItems(int width){
  int numItems=getChildCount();
  if (numItems == 0) {
    mLayoutNumRows=0;
    return;
  }
  int curNumRows=Math.min((int)Math.ceil(numItems / (float)mMaxItemsPerRow),mMaxRows);
  for (; curNumRows <= mMaxRows; curNumRows++) {
    layoutItemsUsingGravity(curNumRows,numItems);
    if (curNumRows >= numItems) {
      break;
    }
    if (doItemsFit()) {
      break;
    }
  }
}
Program: 22839
Project: 22839
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mHasStaleChildren) {
    mHasStaleChildren=false;
    updateChildren(false);
  }
  int measuredWidth=resolveSize(Integer.MAX_VALUE,widthMeasureSpec);
  calculateItemFittingMetadata(measuredWidth);
  layoutItems(measuredWidth);
  final int desiredHeight=(mRowHeight + mHorizontalDividerHeight) * mLayoutNumRows - mHorizontalDividerHeight;
  setMeasuredDimension(measuredWidth,resolveSize(desiredHeight,heightMeasureSpec));
  positionChildren(mMeasuredWidth,mMeasuredHeight);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mHasStaleChildren) {
    mHasStaleChildren=false;
    updateChildren(false);
  }
  int measuredWidth=resolveSize(Integer.MAX_VALUE,widthMeasureSpec);
  calculateItemFittingMetadata(measuredWidth);
  layoutItems(measuredWidth);
  final int layoutNumRows=mLayoutNumRows;
  final int desiredHeight=(mRowHeight + mHorizontalDividerHeight) * layoutNumRows - mHorizontalDividerHeight;
  setMeasuredDimension(measuredWidth,resolveSize(desiredHeight,heightMeasureSpec));
  if (layoutNumRows > 0) {
    positionChildren(mMeasuredWidth,mMeasuredHeight);
  }
}
Program: 22840
Project: 22840
Buggy source:
/** 
 * See if the key event means we should leave touch mode (and leave touch mode if so).
 * @param event The key event.
 * @return Whether this key event should be consumed (meaning the act ofleaving touch mode alone is considered the event).
 */
private boolean checkForLeavingTouchModeAndConsume(KeyEvent event){
  if (event.getAction() != KeyEvent.ACTION_DOWN) {
    return false;
  }
  if ((event.getFlags() & KeyEvent.FLAG_KEEP_TOUCH_MODE) != 0) {
    return false;
  }
  if (!mAttachInfo.mInTouchMode) {
    return false;
  }
  if (isKeyboardKey(event) && mView != null && mView.hasFocus()) {
    mFocusedView=mView.findFocus();
    if ((mFocusedView instanceof ViewGroup) && ((ViewGroup)mFocusedView).getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS) {
      return false;
    }
    if (ensureTouchMode(false)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
    return false;
  }
  if (isDirectional(event.getKeyCode())) {
    return ensureTouchMode(false);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * See if the key event means we should leave touch mode (and leave touch mode if so).
 * @param event The key event.
 * @return Whether this key event should be consumed (meaning the act ofleaving touch mode alone is considered the event).
 */
private boolean checkForLeavingTouchModeAndConsume(KeyEvent event){
  final int action=event.getAction();
  if (action != KeyEvent.ACTION_DOWN && action != KeyEvent.ACTION_MULTIPLE) {
    return false;
  }
  if ((event.getFlags() & KeyEvent.FLAG_KEEP_TOUCH_MODE) != 0) {
    return false;
  }
  if (!mAttachInfo.mInTouchMode) {
    return false;
  }
  if (isKeyboardKey(event) && mView != null && mView.hasFocus()) {
    mFocusedView=mView.findFocus();
    if ((mFocusedView instanceof ViewGroup) && ((ViewGroup)mFocusedView).getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS) {
      return false;
    }
    if (ensureTouchMode(false)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
    return false;
  }
  if (isDirectional(event.getKeyCode())) {
    return ensureTouchMode(false);
  }
  return false;
}
Program: 22841
Project: 22841
Buggy source:
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
        if (mScrollY != 0) {
          mScrollY=0;
          invalidate();
        }
      }
    }
  }
  mLastTouchMode=isInTouchMode ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
}

Fixed version (ground truth):
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
      }
      if (mScrollY != 0) {
        mScrollY=0;
        invalidate();
      }
    }
  }
  mLastTouchMode=isInTouchMode ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
}
Program: 22844
Project: 22844
Buggy source:
/** 
 * See if the key event means we should leave touch mode (and leave touch mode if so).
 * @param event The key event.
 * @return Whether this key event should be consumed (meaning the act ofleaving touch mode alone is considered the event).
 */
private boolean checkForLeavingTouchModeAndConsume(KeyEvent event){
  if (event.getAction() != KeyEvent.ACTION_DOWN) {
    return false;
  }
  if ((event.getFlags() & KeyEvent.FLAG_KEEP_TOUCH_MODE) != 0) {
    return false;
  }
  if (!mAttachInfo.mInTouchMode) {
    return false;
  }
  if (isKeyboardKey(event) && mView != null && mView.hasFocus()) {
    mFocusedView=mView.findFocus();
    if ((mFocusedView instanceof ViewGroup) && ((ViewGroup)mFocusedView).getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS) {
      return false;
    }
    if (ensureTouchMode(false)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
    return false;
  }
  if (isDirectional(event.getKeyCode())) {
    return ensureTouchMode(false);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * See if the key event means we should leave touch mode (and leave touch mode if so).
 * @param event The key event.
 * @return Whether this key event should be consumed (meaning the act ofleaving touch mode alone is considered the event).
 */
private boolean checkForLeavingTouchModeAndConsume(KeyEvent event){
  final int action=event.getAction();
  if (action != KeyEvent.ACTION_DOWN && action != KeyEvent.ACTION_MULTIPLE) {
    return false;
  }
  if ((event.getFlags() & KeyEvent.FLAG_KEEP_TOUCH_MODE) != 0) {
    return false;
  }
  if (!mAttachInfo.mInTouchMode) {
    return false;
  }
  if (isKeyboardKey(event) && mView != null && mView.hasFocus()) {
    mFocusedView=mView.findFocus();
    if ((mFocusedView instanceof ViewGroup) && ((ViewGroup)mFocusedView).getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS) {
      return false;
    }
    if (ensureTouchMode(false)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
    return false;
  }
  if (isDirectional(event.getKeyCode())) {
    return ensureTouchMode(false);
  }
  return false;
}
Program: 22845
Project: 22845
Buggy source:
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
        if (mScrollY != 0) {
          mScrollY=0;
          invalidate();
        }
      }
    }
  }
  mLastTouchMode=isInTouchMode ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
}

Fixed version (ground truth):
public void onTouchModeChanged(boolean isInTouchMode){
  if (isInTouchMode) {
    hideSelector();
    if (getHeight() > 0 && getChildCount() > 0) {
      layoutChildren();
    }
  }
 else {
    int touchMode=mTouchMode;
    if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
      if (mFlingRunnable != null) {
        mFlingRunnable.endFling();
      }
      if (mScrollY != 0) {
        mScrollY=0;
        invalidate();
      }
    }
  }
  mLastTouchMode=isInTouchMode ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
}
Program: 22846
Project: 22846
Buggy source:
/** 
 * @param contentResolver Used to look up and save settings.
 */
public LockPatternUtils(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  mDevicePolicyManager=getDevicePolicyManager();
  if (sLockPatternFilename == null) {
    sLockPatternFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PATTERN_FILE;
    sLockPasswordFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PASSWORD_FILE;
  }
}

Fixed version (ground truth):
/** 
 * @param contentResolver Used to look up and save settings.
 */
public LockPatternUtils(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  if (sLockPatternFilename == null) {
    sLockPatternFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PATTERN_FILE;
    sLockPasswordFilename=android.os.Environment.getDataDirectory().getAbsolutePath() + LOCK_PASSWORD_FILE;
  }
}
Program: 22847
Project: 22847
Buggy source:
public void testScreenRequestsRecreation(){
  mLPKV.wakeWhenReadyTq(0);
  mLPKV.onScreenTurnedOn();
  assertEquals(1,mLPKV.getInjectedLockScreens().size());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().size());
  MockKeyguardScreen lockScreen=mLPKV.getInjectedLockScreens().get(0);
  assertEquals(0,lockScreen.getOnPauseCount());
  assertEquals(1,lockScreen.getOnResumeCount());
  mLPKV.mKeyguardScreenCallback.recreateMe();
  assertEquals(2,mLPKV.getInjectedLockScreens().size());
  assertEquals(2,mLPKV.getInjectedUnlockScreens().size());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getOnPauseCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(0).getOnPauseCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(1).getOnResumeCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(1).getOnResumeCount());
}

Fixed version (ground truth):
public void testScreenRequestsRecreation(){
  mLPKV.wakeWhenReadyTq(0);
  mLPKV.onScreenTurnedOn();
  assertEquals(1,mLPKV.getInjectedLockScreens().size());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().size());
  MockKeyguardScreen lockScreen=mLPKV.getInjectedLockScreens().get(0);
  assertEquals(0,lockScreen.getOnPauseCount());
  assertEquals(1,lockScreen.getOnResumeCount());
  mLPKV.mKeyguardScreenCallback.recreateMe(new Configuration());
  assertEquals(2,mLPKV.getInjectedLockScreens().size());
  assertEquals(2,mLPKV.getInjectedUnlockScreens().size());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedUnlockScreens().get(0).getCleanupCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(0).getOnPauseCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(0).getOnPauseCount());
  assertEquals(1,mLPKV.getInjectedLockScreens().get(1).getOnResumeCount());
  assertEquals(0,mLPKV.getInjectedUnlockScreens().get(1).getOnResumeCount());
}
Program: 22848
Project: 22848
Buggy source:
/** 
 * AccountUnlockScreen constructor.
 */
public AccountUnlockScreen(Context context,KeyguardScreenCallback callback,LockPatternUtils lockPatternUtils){
  super(context);
  mCallback=callback;
  mLockPatternUtils=lockPatternUtils;
  LayoutInflater.from(context).inflate(R.layout.keyguard_screen_glogin_unlock,this,true);
  mTopHeader=(TextView)findViewById(R.id.topHeader);
  mTopHeader.setText(mLockPatternUtils.isPermanentlyLocked() ? R.string.lockscreen_glogin_too_many_attempts : R.string.lockscreen_glogin_forgot_pattern);
  mInstructions=(TextView)findViewById(R.id.instructions);
  mLogin=(EditText)findViewById(R.id.login);
  mLogin.setFilters(new InputFilter[]{new LoginFilter.UsernameFilterGeneric()});
  mLogin.addTextChangedListener(this);
  mPassword=(EditText)findViewById(R.id.password);
  mPassword.addTextChangedListener(this);
  mOk=(Button)findViewById(R.id.ok);
  mOk.setOnClickListener(this);
  mEmergencyCall=(Button)findViewById(R.id.emergencyCall);
  mEmergencyCall.setOnClickListener(this);
  mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
}

Fixed version (ground truth):
/** 
 * AccountUnlockScreen constructor.
 * @param configuration
 */
public AccountUnlockScreen(Context context,Configuration configuration,KeyguardScreenCallback callback,LockPatternUtils lockPatternUtils){
  super(context);
  mCallback=callback;
  mLockPatternUtils=lockPatternUtils;
  LayoutInflater.from(context).inflate(R.layout.keyguard_screen_glogin_unlock,this,true);
  mTopHeader=(TextView)findViewById(R.id.topHeader);
  mTopHeader.setText(mLockPatternUtils.isPermanentlyLocked() ? R.string.lockscreen_glogin_too_many_attempts : R.string.lockscreen_glogin_forgot_pattern);
  mInstructions=(TextView)findViewById(R.id.instructions);
  mLogin=(EditText)findViewById(R.id.login);
  mLogin.setFilters(new InputFilter[]{new LoginFilter.UsernameFilterGeneric()});
  mLogin.addTextChangedListener(this);
  mPassword=(EditText)findViewById(R.id.password);
  mPassword.addTextChangedListener(this);
  mOk=(Button)findViewById(R.id.ok);
  mOk.setOnClickListener(this);
  mEmergencyCall=(Button)findViewById(R.id.emergencyCall);
  mEmergencyCall.setOnClickListener(this);
  mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
}
Program: 22849
Project: 22849
Buggy source:
/** 
 * Stay on me, but recreate me (so I can use a different layout).
 */
void recreateMe();

Fixed version (ground truth):
/** 
 * Stay on me, but recreate me (so I can use a different layout).
 */
void recreateMe(Configuration config);
Program: 22850
Project: 22850
Buggy source:
/** 
 * Remove the given observer from being registered from any of the kinds of callbacks.
 * @param observer The observer to remove (an instance of {@link ConfigurationChangeCallback},  {@link InfoCallback} or {@link SimStateCallback}
 */
public void removeCallback(Object observer){
  mConfigurationChangeCallbacks.remove(observer);
  mInfoCallbacks.remove(observer);
  mSimStateCallbacks.remove(observer);
}

Fixed version (ground truth):
/** 
 * Remove the given observer from being registered from any of the kinds of callbacks.
 * @param observer The observer to remove (an instance of {@link ConfigurationChangeCallback},  {@link InfoCallback} or {@link SimStateCallback}
 */
public void removeCallback(Object observer){
  mInfoCallbacks.remove(observer);
  mSimStateCallbacks.remove(observer);
}
Program: 22852
Project: 22852
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_CONFIGURATION_CHANGED:
    handleConfigurationChange();
  break;
case MSG_TIME_UPDATE:
handleTimeUpdate();
break;
case MSG_BATTERY_UPDATE:
handleBatteryUpdate(msg.arg1,msg.arg2);
break;
case MSG_CARRIER_INFO_UPDATE:
handleCarrierInfoUpdate();
break;
case MSG_SIM_STATE_CHANGE:
handleSimStateChange((SimArgs)msg.obj);
break;
case MSG_RINGER_MODE_CHANGED:
handleRingerModeChange(msg.arg1);
break;
case MSG_PHONE_STATE_CHANGED:
handlePhoneStateChanged((String)msg.obj);
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_TIME_UPDATE:
    handleTimeUpdate();
  break;
case MSG_BATTERY_UPDATE:
handleBatteryUpdate(msg.arg1,msg.arg2);
break;
case MSG_CARRIER_INFO_UPDATE:
handleCarrierInfoUpdate();
break;
case MSG_SIM_STATE_CHANGE:
handleSimStateChange((SimArgs)msg.obj);
break;
case MSG_RINGER_MODE_CHANGED:
handleRingerModeChange(msg.arg1);
break;
case MSG_PHONE_STATE_CHANGED:
handlePhoneStateChanged((String)msg.obj);
break;
}
}
Program: 22854
Project: 22854
Buggy source:
View createLockScreen(){
  return new LockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback);
}

Fixed version (ground truth):
View createLockScreen(){
  return new LockScreen(mContext,mConfiguration,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback);
}