Program: 193036
Project: 193036
Buggy source:
final void stopActivityLocked(ActivityRecord r){
  if (DEBUG_SWITCH)   Slog.d(TAG_SWITCH,"String_Node_Str" + r);
  if ((r.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_HISTORY) != 0 || (r.info.flags & ActivityInfo.FLAG_NO_HISTORY) != 0) {
    if (!r.finishing) {
      if (!mService.isSleeping()) {
        if (DEBUG_STATES)         Slog.d(TAG_STATES,"String_Node_Str" + r);
        if (requestFinishActivityLocked(r.appToken,Activity.RESULT_CANCELED,null,"String_Node_Str",false)) {
          adjustFocusedActivityLocked(r,"String_Node_Str");
          r.resumeKeyDispatchingLocked();
          return;
        }
      }
 else {
        if (DEBUG_STATES)         Slog.d(TAG_STATES,"String_Node_Str" + r + "String_Node_Str");
      }
    }
  }
  if (r.app != null && r.app.thread != null) {
    adjustFocusedActivityLocked(r,"String_Node_Str");
    r.resumeKeyDispatchingLocked();
    try {
      r.stopped=false;
      if (DEBUG_STATES)       Slog.v(TAG_STATES,"String_Node_Str" + r + "String_Node_Str");
      r.state=ActivityState.STOPPING;
      if (DEBUG_VISIBILITY)       Slog.v(TAG_VISIBILITY,"String_Node_Str" + r.visible + "String_Node_Str"+ r);
      if (!r.visible) {
        mWindowManager.setAppVisibility(r.appToken,false);
      }
      r.app.thread.scheduleStopActivity(r.appToken,r.visible,r.configChangeFlags);
      if (mService.isSleepingOrShuttingDown()) {
        r.setSleeping(true);
      }
      Message msg=mHandler.obtainMessage(STOP_TIMEOUT_MSG,r);
      mHandler.sendMessageDelayed(msg,STOP_TIMEOUT);
    }
 catch (    Exception e) {
      Slog.w(TAG,"String_Node_Str",e);
      r.stopped=true;
      if (DEBUG_STATES)       Slog.v(TAG_STATES,"String_Node_Str" + r);
      r.state=ActivityState.STOPPED;
      if (r.configDestroy) {
        destroyActivityLocked(r,true,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
final void stopActivityLocked(ActivityRecord r){
  if (DEBUG_SWITCH)   Slog.d(TAG_SWITCH,"String_Node_Str" + r);
  if ((r.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_HISTORY) != 0 || (r.info.flags & ActivityInfo.FLAG_NO_HISTORY) != 0) {
    if (!r.finishing) {
      if (!mService.isSleeping()) {
        if (DEBUG_STATES)         Slog.d(TAG_STATES,"String_Node_Str" + r);
        if (requestFinishActivityLocked(r.appToken,Activity.RESULT_CANCELED,null,"String_Node_Str",false)) {
          adjustFocusedActivityLocked(r,"String_Node_Str");
          r.resumeKeyDispatchingLocked();
          return;
        }
      }
 else {
        if (DEBUG_STATES)         Slog.d(TAG_STATES,"String_Node_Str" + r + "String_Node_Str");
      }
    }
  }
  if (r.app != null && r.app.thread != null) {
    adjustFocusedActivityLocked(r,"String_Node_Str");
    r.resumeKeyDispatchingLocked();
    try {
      r.stopped=false;
      if (DEBUG_STATES)       Slog.v(TAG_STATES,"String_Node_Str" + r + "String_Node_Str");
      r.state=ActivityState.STOPPING;
      if (DEBUG_VISIBILITY)       Slog.v(TAG_VISIBILITY,"String_Node_Str" + r.visible + "String_Node_Str"+ r);
      if (!r.visible) {
        mWindowManager.setAppVisibility(r.appToken,false);
      }
      r.app.thread.scheduleStopActivity(r.appToken,r.visible,r.configChangeFlags);
      if (mService.isSleepingOrShuttingDown()) {
        r.setSleeping(true);
      }
      Message msg=mHandler.obtainMessage(STOP_TIMEOUT_MSG,r);
      mHandler.sendMessageDelayed(msg,STOP_TIMEOUT);
    }
 catch (    Exception e) {
      Slog.w(TAG,"String_Node_Str",e);
      r.stopped=true;
      if (DEBUG_STATES)       Slog.v(TAG_STATES,"String_Node_Str" + r);
      r.state=ActivityState.STOPPED;
      if (r.deferRelaunchUntilPaused) {
        destroyActivityLocked(r,true,"String_Node_Str");
      }
    }
  }
}