nus-yam/ex-repair huggingface dataset:
Program: 2415
Project: 2415
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  if (!(state instanceof SavedState)) {
    super.onRestoreInstanceState(state);
    return;
  }
  SavedState ss=(SavedState)state;
  super.onRestoreInstanceState(ss.getSuperState());
  mTransportState=(ss.transportState);
  mAppWidgetToShow=ss.appWidgetToShow;
  post(mSwitchPageRunnable);
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  if (!(state instanceof SavedState)) {
    super.onRestoreInstanceState(state);
    return;
  }
  SavedState ss=(SavedState)state;
  super.onRestoreInstanceState(ss.getSuperState());
  mTransportState=(ss.transportState);
  mAppWidgetToShow=ss.appWidgetToShow;
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mTransportState);
  post(mSwitchPageRunnable);
}
Program: 2416
Project: 2416
Buggy source:
protected void handleSetPlaybackState(int generationId,int playbackState,long eventTime){
  if (generationId == mDisplayClientState.clientGeneration) {
    for (int i=0; i < mCallbacks.size(); i++) {
      KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
      if (cb != null) {
        cb.onMusicPlaybackStateChanged(playbackState,eventTime);
      }
    }
  }
 else {
    Log.w(TAG,"String_Node_Str" + generationId + "String_Node_Str");
  }
}

Fixed version (ground truth):
protected void handleSetPlaybackState(int generationId,int playbackState,long eventTime){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + generationId + "String_Node_Str"+ playbackState+ "String_Node_Str"+ eventTime+ "String_Node_Str");
  mDisplayClientState.playbackState=playbackState;
  mDisplayClientState.playbackEventTime=eventTime;
  if (generationId == mDisplayClientState.clientGeneration) {
    for (int i=0; i < mCallbacks.size(); i++) {
      KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
      if (cb != null) {
        cb.onMusicPlaybackStateChanged(playbackState,eventTime);
      }
    }
  }
 else {
    Log.w(TAG,"String_Node_Str" + generationId + "String_Node_Str");
  }
}
Program: 2417
Project: 2417
Buggy source:
protected void handleSetGenerationId(int clientGeneration,boolean clearing,PendingIntent p){
  mDisplayClientState.clientGeneration=clientGeneration;
  mDisplayClientState.clearing=clearing;
  mDisplayClientState.intent=p;
  for (int i=0; i < mCallbacks.size(); i++) {
    KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
    if (cb != null) {
      cb.onMusicClientIdChanged(clientGeneration,clearing,p);
    }
  }
}

Fixed version (ground truth):
protected void handleSetGenerationId(int clientGeneration,boolean clearing,PendingIntent p){
  mDisplayClientState.clientGeneration=clientGeneration;
  mDisplayClientState.clearing=clearing;
  mDisplayClientState.intent=p;
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + clientGeneration + "String_Node_Str"+ clearing+ "String_Node_Str");
  for (int i=0; i < mCallbacks.size(); i++) {
    KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
    if (cb != null) {
      cb.onMusicClientIdChanged(clientGeneration,clearing,p);
    }
  }
}
Program: 2418
Project: 2418
Buggy source:
/** 
 * Send message to keyguard telling it to reset its state.
 * @param options options about how to show the keyguard
 * @see #handleReset()
 */
private void resetStateLocked(Bundle options){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  Message msg=mHandler.obtainMessage(RESET,options);
  mHandler.sendMessage(msg);
}

Fixed version (ground truth):
/** 
 * Send message to keyguard telling it to reset its state.
 * @param options options about how to show the keyguard
 * @see #handleReset()
 */
private void resetStateLocked(Bundle options){
  if (DEBUG)   Log.e(TAG,"String_Node_Str");
  Message msg=mHandler.obtainMessage(RESET,options);
  mHandler.sendMessage(msg);
}
Program: 2419
Project: 2419
Buggy source:
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}

Fixed version (ground truth):
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  sEnforceThreadChecking=context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2;
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}
Program: 2420
Project: 2420
Buggy source:
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
  }
}

Fixed version (ground truth):
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
    if (sEnforceThreadChecking) {
      throw new RuntimeException(throwable);
    }
  }
}
Program: 2422
Project: 2422
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}
Program: 2423
Project: 2423
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}
Program: 2424
Project: 2424
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}
Program: 2425
Project: 2425
Buggy source:
public KeyguardHostView(Context context,AttributeSet attrs){
  super(context,attrs);
  mLockPatternUtils=new LockPatternUtils(context);
  mUserId=mLockPatternUtils.getCurrentUser();
  DevicePolicyManager dpm=(DevicePolicyManager)mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
  if (dpm != null) {
    mDisabledFeatures=getDisabledFeatures(dpm);
    mCameraDisabled=dpm.getCameraDisabled(null);
  }
  mSafeModeEnabled=LockPatternUtils.isSafeModeEnabled();
  Context userContext=null;
  try {
    final String packageName="String_Node_Str";
    userContext=mContext.createPackageContextAsUser(packageName,0,new UserHandle(mUserId));
  }
 catch (  NameNotFoundException e) {
    e.printStackTrace();
    userContext=context;
  }
  mAppWidgetHost=new AppWidgetHost(userContext,APPWIDGET_HOST_ID,mOnClickHandler,Looper.myLooper());
  cleanupAppWidgetIds();
  mAppWidgetManager=AppWidgetManager.getInstance(userContext);
  mSecurityModel=new KeyguardSecurityModel(context);
  mViewStateManager=new KeyguardViewStateManager(this);
  mUserSetupCompleted=Settings.Secure.getIntForUser(mContext.getContentResolver(),Settings.Secure.USER_SETUP_COMPLETE,0,UserHandle.USER_CURRENT) != 0;
  getInitialTransportState();
  if (mSafeModeEnabled) {
    Log.v(TAG,"String_Node_Str");
  }
  if ((mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL) != 0) {
    Log.v(TAG,"String_Node_Str");
  }
  if ((mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0) {
    Log.v(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
public KeyguardHostView(Context context,AttributeSet attrs){
  super(context,attrs);
  if (DEBUG)   Log.e(TAG,"String_Node_Str");
  mLockPatternUtils=new LockPatternUtils(context);
  mUserId=mLockPatternUtils.getCurrentUser();
  DevicePolicyManager dpm=(DevicePolicyManager)mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
  if (dpm != null) {
    mDisabledFeatures=getDisabledFeatures(dpm);
    mCameraDisabled=dpm.getCameraDisabled(null);
  }
  mSafeModeEnabled=LockPatternUtils.isSafeModeEnabled();
  Context userContext=null;
  try {
    final String packageName="String_Node_Str";
    userContext=mContext.createPackageContextAsUser(packageName,0,new UserHandle(mUserId));
  }
 catch (  NameNotFoundException e) {
    e.printStackTrace();
    userContext=context;
  }
  mAppWidgetHost=new AppWidgetHost(userContext,APPWIDGET_HOST_ID,mOnClickHandler,Looper.myLooper());
  cleanupAppWidgetIds();
  mAppWidgetManager=AppWidgetManager.getInstance(userContext);
  mSecurityModel=new KeyguardSecurityModel(context);
  mViewStateManager=new KeyguardViewStateManager(this);
  mUserSetupCompleted=Settings.Secure.getIntForUser(mContext.getContentResolver(),Settings.Secure.USER_SETUP_COMPLETE,0,UserHandle.USER_CURRENT) != 0;
  getInitialTransportState();
  if (mSafeModeEnabled) {
    Log.v(TAG,"String_Node_Str");
  }
  if ((mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL) != 0) {
    Log.v(TAG,"String_Node_Str");
  }
  if ((mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0) {
    Log.v(TAG,"String_Node_Str");
  }
}
Program: 2426
Project: 2426
Buggy source:
private void ensureTransportPresentOrRemoved(int state){
  int page=getWidgetPosition(R.id.keyguard_transport_control);
  if (state == TRANSPORT_INVISIBLE || state == TRANSPORT_VISIBLE) {
    if (page == -1) {
      if (DEBUGXPORT)       Log.v(TAG,"String_Node_Str");
      int lastWidget=mAppWidgetContainer.getChildCount() - 1;
      int position=0;
      if (lastWidget >= 0) {
        position=mAppWidgetContainer.isCameraPage(lastWidget) ? lastWidget : lastWidget + 1;
      }
      mAppWidgetContainer.addWidget(getTransportControlView(),position);
    }
  }
 else   if (page != -1) {
    if (DEBUGXPORT)     Log.v(TAG,"String_Node_Str");
    mAppWidgetContainer.removeWidget(getTransportControlView());
    mTransportControl=null;
  }
}

Fixed version (ground truth):
/** 
 * Examines the current state and adds the transport to the widget pager when the state changes. Showing the initial transport and keeping it around is a bit tricky because the signals coming from music players aren't always clear. Here's how the states are handled:  {@link TRANSPORT_GONE} means we have no reason to show the transport - remove it if present.{@link TRANSPORT_INVISIBLE} means we have potential to show the transport because a musicplayer is registered but not currently playing music (or we don't know the state yet). The code adds it conditionally on play state. {@link #TRANSPORT_VISIBLE} means a music player is active and transport should be showing.Once the transport is showing, we always show it until keyguard is dismissed. This state is maintained by onSave/RestoreInstanceState(). This state is cleared in {@link KeyguardViewManager#hide} when keyguard is dismissed, which causes the transport to begone when keyguard is restarted until we get an update with the current state.
 * @param state
 */
private void ensureTransportPresentOrRemoved(int state){
  final boolean showing=getWidgetPosition(R.id.keyguard_transport_control) != -1;
  final boolean visible=state == TRANSPORT_VISIBLE;
  final boolean shouldBeVisible=state == TRANSPORT_INVISIBLE && isMusicPlaying(state);
  if (!showing && (visible || shouldBeVisible)) {
    if (DEBUGXPORT)     Log.v(TAG,"String_Node_Str");
    int lastWidget=mAppWidgetContainer.getChildCount() - 1;
    int position=0;
    if (lastWidget >= 0) {
      position=mAppWidgetContainer.isCameraPage(lastWidget) ? lastWidget : lastWidget + 1;
    }
    mAppWidgetContainer.addWidget(getOrCreateTransportControl(),position);
  }
 else   if (showing && state == TRANSPORT_GONE) {
    if (DEBUGXPORT)     Log.v(TAG,"String_Node_Str");
    mAppWidgetContainer.removeWidget(getOrCreateTransportControl());
    mTransportControl=null;
  }
}
Program: 2427
Project: 2427
Buggy source:
private void getInitialTransportState(){
  DisplayClientState dcs=KeyguardUpdateMonitor.getInstance(mContext).getCachedDisplayClientState();
  mTransportState=(dcs.clearing ? TRANSPORT_GONE : (isMusicPlaying(dcs.playbackState) ? TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE));
  mPlaybackState=dcs.playbackState;
}

Fixed version (ground truth):
private void getInitialTransportState(){
  DisplayClientState dcs=KeyguardUpdateMonitor.getInstance(mContext).getCachedDisplayClientState();
  mTransportState=(dcs.clearing ? TRANSPORT_GONE : (isMusicPlaying(dcs.playbackState) ? TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE));
  mPlaybackState=dcs.playbackState;
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + mTransportState + "String_Node_Str"+ mPlaybackState);
}
Program: 2428
Project: 2428
Buggy source:
@Override public Parcelable onSaveInstanceState(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  ss.transportState=mTransportState;
  ss.appWidgetToShow=mAppWidgetToShow;
  return ss;
}

Fixed version (ground truth):
@Override public Parcelable onSaveInstanceState(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mTransportState);
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  final boolean showing=mTransportControl != null && mAppWidgetContainer.getWidgetPageIndex(mTransportControl) >= 0;
  ss.transportState=showing ? TRANSPORT_VISIBLE : mTransportState;
  ss.appWidgetToShow=mAppWidgetToShow;
  return ss;
}
Program: 2429
Project: 2429
Buggy source:
private int getAppropriateWidgetPage(int musicTransportState){
  if (mAppWidgetToShow != AppWidgetManager.INVALID_APPWIDGET_ID) {
    final int childCount=mAppWidgetContainer.getChildCount();
    for (int i=0; i < childCount; i++) {
      if (mAppWidgetContainer.getWidgetPageAt(i).getContentAppWidgetId() == mAppWidgetToShow) {
        return i;
      }
    }
    mAppWidgetToShow=AppWidgetManager.INVALID_APPWIDGET_ID;
  }
  if (musicTransportState == TRANSPORT_VISIBLE) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    return mAppWidgetContainer.getWidgetPageIndex(getTransportControlView());
  }
  int rightMost=mAppWidgetContainer.getChildCount() - 1;
  if (mAppWidgetContainer.isCameraPage(rightMost)) {
    rightMost--;
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + rightMost);
  return rightMost;
}

Fixed version (ground truth):
private int getAppropriateWidgetPage(int musicTransportState){
  if (mAppWidgetToShow != AppWidgetManager.INVALID_APPWIDGET_ID) {
    final int childCount=mAppWidgetContainer.getChildCount();
    for (int i=0; i < childCount; i++) {
      if (mAppWidgetContainer.getWidgetPageAt(i).getContentAppWidgetId() == mAppWidgetToShow) {
        return i;
      }
    }
    mAppWidgetToShow=AppWidgetManager.INVALID_APPWIDGET_ID;
  }
  if (musicTransportState == TRANSPORT_VISIBLE) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    return mAppWidgetContainer.getWidgetPageIndex(getOrCreateTransportControl());
  }
  int rightMost=mAppWidgetContainer.getChildCount() - 1;
  if (mAppWidgetContainer.isCameraPage(rightMost)) {
    rightMost--;
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + rightMost);
  return rightMost;
}
Program: 2430
Project: 2430
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  if (!(state instanceof SavedState)) {
    super.onRestoreInstanceState(state);
    return;
  }
  SavedState ss=(SavedState)state;
  super.onRestoreInstanceState(ss.getSuperState());
  mTransportState=(ss.transportState);
  mAppWidgetToShow=ss.appWidgetToShow;
  post(mSwitchPageRunnable);
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  if (!(state instanceof SavedState)) {
    super.onRestoreInstanceState(state);
    return;
  }
  SavedState ss=(SavedState)state;
  super.onRestoreInstanceState(ss.getSuperState());
  mTransportState=(ss.transportState);
  mAppWidgetToShow=ss.appWidgetToShow;
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mTransportState);
  post(mSwitchPageRunnable);
}
Program: 2431
Project: 2431
Buggy source:
protected void handleSetPlaybackState(int generationId,int playbackState,long eventTime){
  if (generationId == mDisplayClientState.clientGeneration) {
    for (int i=0; i < mCallbacks.size(); i++) {
      KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
      if (cb != null) {
        cb.onMusicPlaybackStateChanged(playbackState,eventTime);
      }
    }
  }
 else {
    Log.w(TAG,"String_Node_Str" + generationId + "String_Node_Str");
  }
}

Fixed version (ground truth):
protected void handleSetPlaybackState(int generationId,int playbackState,long eventTime){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + generationId + "String_Node_Str"+ playbackState+ "String_Node_Str"+ eventTime+ "String_Node_Str");
  mDisplayClientState.playbackState=playbackState;
  mDisplayClientState.playbackEventTime=eventTime;
  if (generationId == mDisplayClientState.clientGeneration) {
    for (int i=0; i < mCallbacks.size(); i++) {
      KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
      if (cb != null) {
        cb.onMusicPlaybackStateChanged(playbackState,eventTime);
      }
    }
  }
 else {
    Log.w(TAG,"String_Node_Str" + generationId + "String_Node_Str");
  }
}
Program: 2432
Project: 2432
Buggy source:
protected void handleSetGenerationId(int clientGeneration,boolean clearing,PendingIntent p){
  mDisplayClientState.clientGeneration=clientGeneration;
  mDisplayClientState.clearing=clearing;
  mDisplayClientState.intent=p;
  for (int i=0; i < mCallbacks.size(); i++) {
    KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
    if (cb != null) {
      cb.onMusicClientIdChanged(clientGeneration,clearing,p);
    }
  }
}

Fixed version (ground truth):
protected void handleSetGenerationId(int clientGeneration,boolean clearing,PendingIntent p){
  mDisplayClientState.clientGeneration=clientGeneration;
  mDisplayClientState.clearing=clearing;
  mDisplayClientState.intent=p;
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + clientGeneration + "String_Node_Str"+ clearing+ "String_Node_Str");
  for (int i=0; i < mCallbacks.size(); i++) {
    KeyguardUpdateMonitorCallback cb=mCallbacks.get(i).get();
    if (cb != null) {
      cb.onMusicClientIdChanged(clientGeneration,clearing,p);
    }
  }
}
Program: 2433
Project: 2433
Buggy source:
/** 
 * Send message to keyguard telling it to reset its state.
 * @param options options about how to show the keyguard
 * @see #handleReset()
 */
private void resetStateLocked(Bundle options){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  Message msg=mHandler.obtainMessage(RESET,options);
  mHandler.sendMessage(msg);
}

Fixed version (ground truth):
/** 
 * Send message to keyguard telling it to reset its state.
 * @param options options about how to show the keyguard
 * @see #handleReset()
 */
private void resetStateLocked(Bundle options){
  if (DEBUG)   Log.e(TAG,"String_Node_Str");
  Message msg=mHandler.obtainMessage(RESET,options);
  mHandler.sendMessage(msg);
}
Program: 2434
Project: 2434
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}
Program: 2441
Project: 2441
Buggy source:
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. Setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a negative pitch shift. The valid sample rate range is from 1Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState == STATE_UNINITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}

Fixed version (ground truth):
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. Setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a negative pitch shift. The valid sample rate range is from 1Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState != STATE_INITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}
Program: 2442
Project: 2442
Buggy source:
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. Setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a negative pitch shift. The valid sample rate range is from 1Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState == STATE_UNINITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}

Fixed version (ground truth):
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. Setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a negative pitch shift. The valid sample rate range is from 1Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState != STATE_INITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}
Program: 2445
Project: 2445
Buggy source:
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. For example, setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a pitch shift down by one octave. The valid sample rate range is from 1 Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState == STATE_UNINITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}

Fixed version (ground truth):
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. For example, setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a pitch shift down by one octave. The valid sample rate range is from 1 Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState != STATE_INITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}
Program: 2447
Project: 2447
Buggy source:
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. Setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a negative pitch shift. The valid sample rate range is from 1Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState == STATE_UNINITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}

Fixed version (ground truth):
/** 
 * Sets the playback sample rate for this track. This sets the sampling rate at which the audio data will be consumed and played back, not the original sampling rate of the content. Setting it to half the sample rate of the content will cause the playback to last twice as long, but will also result in a negative pitch shift. The valid sample rate range is from 1Hz to twice the value returned by  {@link #getNativeOutputSampleRate(int)}.
 * @param sampleRateInHz the sample rate expressed in Hz
 * @return error code or success, see {@link #SUCCESS},   {@link #ERROR_BAD_VALUE},  {@link #ERROR_INVALID_OPERATION}
 */
public int setPlaybackRate(int sampleRateInHz){
  if (mState != STATE_INITIALIZED) {
    return ERROR_INVALID_OPERATION;
  }
  if (sampleRateInHz <= 0) {
    return ERROR_BAD_VALUE;
  }
  return native_set_playback_rate(sampleRateInHz);
}
Program: 2451
Project: 2451
Buggy source:
public void closeSystemDialogs(String reason){
  enforceNotIsolatedCaller("String_Node_Str");
  final int pid=Binder.getCallingPid();
  final int uid=Binder.getCallingUid();
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      if (uid >= Process.FIRST_APPLICATION_UID) {
        ProcessRecord proc;
synchronized (mPidsSelfLocked) {
          proc=mPidsSelfLocked.get(pid);
        }
        if (proc.curRawAdj > ProcessList.PERCEPTIBLE_APP_ADJ) {
          Slog.w(TAG,"String_Node_Str" + reason + "String_Node_Str"+ proc);
          return;
        }
      }
      closeSystemDialogsLocked(reason);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
@Override public void closeSystemDialogs(String reason){
  enforceNotIsolatedCaller("String_Node_Str");
  final int pid=Binder.getCallingPid();
  final int uid=Binder.getCallingUid();
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      if (uid >= Process.FIRST_APPLICATION_UID) {
        ProcessRecord proc;
synchronized (mPidsSelfLocked) {
          proc=mPidsSelfLocked.get(pid);
        }
        if (proc.curRawAdj > ProcessList.PERCEPTIBLE_APP_ADJ) {
          Slog.w(TAG,"String_Node_Str" + reason + "String_Node_Str"+ proc);
          return;
        }
      }
      closeSystemDialogsLocked(reason);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 2452
Project: 2452
Buggy source:
public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) throws RemoteException {
  enforceNotIsolatedCaller("String_Node_Str");
  Debug.MemoryInfo[] infos=new Debug.MemoryInfo[pids.length];
  for (int i=pids.length - 1; i >= 0; i--) {
    infos[i]=new Debug.MemoryInfo();
    Debug.getMemoryInfo(pids[i],infos[i]);
  }
  return infos;
}

Fixed version (ground truth):
@Override public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids){
  enforceNotIsolatedCaller("String_Node_Str");
  Debug.MemoryInfo[] infos=new Debug.MemoryInfo[pids.length];
  for (int i=pids.length - 1; i >= 0; i--) {
    infos[i]=new Debug.MemoryInfo();
    Debug.getMemoryInfo(pids[i],infos[i]);
  }
  return infos;
}
Program: 2453
Project: 2453
Buggy source:
public void forceStopPackage(final String packageName,int userId){
  if (checkCallingPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) != PackageManager.PERMISSION_GRANTED) {
    String msg="String_Node_Str" + Binder.getCallingPid() + "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ android.Manifest.permission.FORCE_STOP_PACKAGES;
    Slog.w(TAG,msg);
    throw new SecurityException(msg);
  }
  userId=handleIncomingUser(Binder.getCallingPid(),Binder.getCallingUid(),userId,true,true,"String_Node_Str",null);
  long callingId=Binder.clearCallingIdentity();
  try {
    IPackageManager pm=AppGlobals.getPackageManager();
synchronized (this) {
      int[] users=userId == UserHandle.USER_ALL ? getUsersLocked() : new int[]{userId};
      for (      int user : users) {
        int pkgUid=-1;
        try {
          pkgUid=pm.getPackageUid(packageName,user);
        }
 catch (        RemoteException e) {
        }
        if (pkgUid == -1) {
          Slog.w(TAG,"String_Node_Str" + packageName);
          continue;
        }
        try {
          pm.setPackageStoppedState(packageName,true,user);
        }
 catch (        RemoteException e) {
        }
catch (        IllegalArgumentException e) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ e);
        }
        if (isUserRunningLocked(user,false)) {
          forceStopPackageLocked(packageName,pkgUid);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(callingId);
  }
}

Fixed version (ground truth):
@Override public void forceStopPackage(final String packageName,int userId){
  if (checkCallingPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) != PackageManager.PERMISSION_GRANTED) {
    String msg="String_Node_Str" + Binder.getCallingPid() + "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ android.Manifest.permission.FORCE_STOP_PACKAGES;
    Slog.w(TAG,msg);
    throw new SecurityException(msg);
  }
  userId=handleIncomingUser(Binder.getCallingPid(),Binder.getCallingUid(),userId,true,true,"String_Node_Str",null);
  long callingId=Binder.clearCallingIdentity();
  try {
    IPackageManager pm=AppGlobals.getPackageManager();
synchronized (this) {
      int[] users=userId == UserHandle.USER_ALL ? getUsersLocked() : new int[]{userId};
      for (      int user : users) {
        int pkgUid=-1;
        try {
          pkgUid=pm.getPackageUid(packageName,user);
        }
 catch (        RemoteException e) {
        }
        if (pkgUid == -1) {
          Slog.w(TAG,"String_Node_Str" + packageName);
          continue;
        }
        try {
          pm.setPackageStoppedState(packageName,true,user);
        }
 catch (        RemoteException e) {
        }
catch (        IllegalArgumentException e) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ e);
        }
        if (isUserRunningLocked(user,false)) {
          forceStopPackageLocked(packageName,pkgUid);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(callingId);
  }
}
Program: 2454
Project: 2454
Buggy source:
public void killApplicationWithAppId(String pkg,int appid){
  if (pkg == null) {
    return;
  }
  if (appid < 0) {
    Slog.w(TAG,"String_Node_Str" + pkg);
    return;
  }
  int callerUid=Binder.getCallingUid();
  if (callerUid == Process.SYSTEM_UID) {
    Message msg=mHandler.obtainMessage(KILL_APPLICATION_MSG);
    msg.arg1=appid;
    msg.arg2=0;
    msg.obj=pkg;
    mHandler.sendMessage(msg);
  }
 else {
    throw new SecurityException(callerUid + "String_Node_Str" + pkg);
  }
}

Fixed version (ground truth):
@Override public void killApplicationWithAppId(String pkg,int appid){
  if (pkg == null) {
    return;
  }
  if (appid < 0) {
    Slog.w(TAG,"String_Node_Str" + pkg);
    return;
  }
  int callerUid=Binder.getCallingUid();
  if (callerUid == Process.SYSTEM_UID) {
    Message msg=mHandler.obtainMessage(KILL_APPLICATION_MSG);
    msg.arg1=appid;
    msg.arg2=0;
    msg.obj=pkg;
    mHandler.sendMessage(msg);
  }
 else {
    throw new SecurityException(callerUid + "String_Node_Str" + pkg);
  }
}
Program: 2456
Project: 2456
Buggy source:
void resumeTopActivityLocked(){
  final int start, end;
  if (isHomeStackMain()) {
    start=0;
    end=1;
  }
 else {
    start=1;
    end=mStacks.size();
  }
  for (int stackNdx=start; stackNdx < end; ++stackNdx) {
    mStacks.get(stackNdx).resumeTopActivityLocked(null);
  }
}

Fixed version (ground truth):
void resumeTopActivityLocked(){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    mStacks.get(stackNdx).resumeTopActivityLocked(null);
  }
}
Program: 2457
Project: 2457
Buggy source:
boolean allResumedActivitiesIdle(){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    if (mStacks.get(stackNdx).mResumedActivity == null || !mStacks.get(stackNdx).mResumedActivity.idle) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
boolean allResumedActivitiesIdle(){
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    final ActivityRecord resumedActivity=mStacks.get(stackNdx).mResumedActivity;
    if (resumedActivity == null || !resumedActivity.idle) {
      return false;
    }
  }
  return true;
}
Program: 2462
Project: 2462
Buggy source:
public void closeSystemDialogs(String reason){
  enforceNotIsolatedCaller("String_Node_Str");
  final int pid=Binder.getCallingPid();
  final int uid=Binder.getCallingUid();
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      if (uid >= Process.FIRST_APPLICATION_UID) {
        ProcessRecord proc;
synchronized (mPidsSelfLocked) {
          proc=mPidsSelfLocked.get(pid);
        }
        if (proc.curRawAdj > ProcessList.PERCEPTIBLE_APP_ADJ) {
          Slog.w(TAG,"String_Node_Str" + reason + "String_Node_Str"+ proc);
          return;
        }
      }
      closeSystemDialogsLocked(reason);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
@Override public void closeSystemDialogs(String reason){
  enforceNotIsolatedCaller("String_Node_Str");
  final int pid=Binder.getCallingPid();
  final int uid=Binder.getCallingUid();
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      if (uid >= Process.FIRST_APPLICATION_UID) {
        ProcessRecord proc;
synchronized (mPidsSelfLocked) {
          proc=mPidsSelfLocked.get(pid);
        }
        if (proc.curRawAdj > ProcessList.PERCEPTIBLE_APP_ADJ) {
          Slog.w(TAG,"String_Node_Str" + reason + "String_Node_Str"+ proc);
          return;
        }
      }
      closeSystemDialogsLocked(reason);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 2463
Project: 2463
Buggy source:
public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) throws RemoteException {
  enforceNotIsolatedCaller("String_Node_Str");
  Debug.MemoryInfo[] infos=new Debug.MemoryInfo[pids.length];
  for (int i=pids.length - 1; i >= 0; i--) {
    infos[i]=new Debug.MemoryInfo();
    Debug.getMemoryInfo(pids[i],infos[i]);
  }
  return infos;
}

Fixed version (ground truth):
@Override public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids){
  enforceNotIsolatedCaller("String_Node_Str");
  Debug.MemoryInfo[] infos=new Debug.MemoryInfo[pids.length];
  for (int i=pids.length - 1; i >= 0; i--) {
    infos[i]=new Debug.MemoryInfo();
    Debug.getMemoryInfo(pids[i],infos[i]);
  }
  return infos;
}