Program: 182324
Project: 182324
Buggy source:
final void appNotRespondingLocked(ProcessRecord app,HistoryRecord activity,HistoryRecord parent,final String annotation){
  if (app.notResponding || app.crashing) {
    return;
  }
  EventLog.writeEvent(EventLogTags.AM_ANR,app.pid,app.processName,app.info.flags,annotation);
  ArrayList<Integer> pids=new ArrayList<Integer>(20);
  pids.add(app.pid);
  int parentPid=app.pid;
  if (parent != null && parent.app != null && parent.app.pid > 0)   parentPid=parent.app.pid;
  if (parentPid != app.pid)   pids.add(parentPid);
  if (MY_PID != app.pid && MY_PID != parentPid)   pids.add(MY_PID);
  for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
    ProcessRecord r=mLruProcesses.get(i);
    if (r != null && r.thread != null) {
      int pid=r.pid;
      if (pid > 0 && pid != app.pid && pid != parentPid && pid != MY_PID)       pids.add(pid);
    }
  }
  File tracesFile=dumpStackTraces(pids);
  StringBuilder info=mStringBuilder;
  info.setLength(0);
  info.append("String_Node_Str").append(app.processName);
  if (activity != null && activity.shortComponentName != null) {
    info.append("String_Node_Str").append(activity.shortComponentName).append("String_Node_Str");
  }
  info.append("String_Node_Str");
  if (annotation != null) {
    info.append("String_Node_Str").append(annotation).append("String_Node_Str");
  }
  if (parent != null && parent != activity) {
    info.append("String_Node_Str").append(parent.shortComponentName).append("String_Node_Str");
  }
  String cpuInfo=null;
  if (MONITOR_CPU_USAGE) {
    updateCpuStatsNow();
synchronized (mProcessStatsThread) {
      cpuInfo=mProcessStats.printCurrentState();
    }
    info.append(cpuInfo);
  }
  Slog.e(TAG,info.toString());
  if (tracesFile == null) {
    Process.sendSignal(app.pid,Process.SIGNAL_QUIT);
  }
  addErrorToDropBox("String_Node_Str",app,activity,parent,annotation,cpuInfo,tracesFile,null);
  if (mController != null) {
    try {
      int res=mController.appNotResponding(app.processName,app.pid,info.toString());
      if (res != 0) {
        if (res < 0 && app.pid != MY_PID)         Process.killProcess(app.pid);
        return;
      }
    }
 catch (    RemoteException e) {
      mController=null;
    }
  }
  boolean showBackground=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.ANR_SHOW_BACKGROUND,0) != 0;
  if (!showBackground && !app.isInterestingToUserLocked() && app.pid != MY_PID) {
    Process.killProcess(app.pid);
    return;
  }
  makeAppNotRespondingLocked(app,activity != null ? activity.shortComponentName : null,annotation != null ? "String_Node_Str" + annotation : "String_Node_Str",info.toString());
  Message msg=Message.obtain();
  HashMap map=new HashMap();
  msg.what=SHOW_NOT_RESPONDING_MSG;
  msg.obj=map;
  map.put("String_Node_Str",app);
  if (activity != null) {
    map.put("String_Node_Str",activity);
  }
  mHandler.sendMessage(msg);
  return;
}

Fixed version (ground truth):
final void appNotRespondingLocked(ProcessRecord app,HistoryRecord activity,HistoryRecord parent,final String annotation){
  if (mShuttingDown || app.notResponding || app.crashing) {
    return;
  }
  EventLog.writeEvent(EventLogTags.AM_ANR,app.pid,app.processName,app.info.flags,annotation);
  ArrayList<Integer> pids=new ArrayList<Integer>(20);
  pids.add(app.pid);
  int parentPid=app.pid;
  if (parent != null && parent.app != null && parent.app.pid > 0)   parentPid=parent.app.pid;
  if (parentPid != app.pid)   pids.add(parentPid);
  if (MY_PID != app.pid && MY_PID != parentPid)   pids.add(MY_PID);
  for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
    ProcessRecord r=mLruProcesses.get(i);
    if (r != null && r.thread != null) {
      int pid=r.pid;
      if (pid > 0 && pid != app.pid && pid != parentPid && pid != MY_PID)       pids.add(pid);
    }
  }
  File tracesFile=dumpStackTraces(pids);
  StringBuilder info=mStringBuilder;
  info.setLength(0);
  info.append("String_Node_Str").append(app.processName);
  if (activity != null && activity.shortComponentName != null) {
    info.append("String_Node_Str").append(activity.shortComponentName).append("String_Node_Str");
  }
  info.append("String_Node_Str");
  if (annotation != null) {
    info.append("String_Node_Str").append(annotation).append("String_Node_Str");
  }
  if (parent != null && parent != activity) {
    info.append("String_Node_Str").append(parent.shortComponentName).append("String_Node_Str");
  }
  String cpuInfo=null;
  if (MONITOR_CPU_USAGE) {
    updateCpuStatsNow();
synchronized (mProcessStatsThread) {
      cpuInfo=mProcessStats.printCurrentState();
    }
    info.append(cpuInfo);
  }
  Slog.e(TAG,info.toString());
  if (tracesFile == null) {
    Process.sendSignal(app.pid,Process.SIGNAL_QUIT);
  }
  addErrorToDropBox("String_Node_Str",app,activity,parent,annotation,cpuInfo,tracesFile,null);
  if (mController != null) {
    try {
      int res=mController.appNotResponding(app.processName,app.pid,info.toString());
      if (res != 0) {
        if (res < 0 && app.pid != MY_PID)         Process.killProcess(app.pid);
        return;
      }
    }
 catch (    RemoteException e) {
      mController=null;
    }
  }
  boolean showBackground=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.ANR_SHOW_BACKGROUND,0) != 0;
  if (!showBackground && !app.isInterestingToUserLocked() && app.pid != MY_PID) {
    Process.killProcess(app.pid);
    return;
  }
  makeAppNotRespondingLocked(app,activity != null ? activity.shortComponentName : null,annotation != null ? "String_Node_Str" + annotation : "String_Node_Str",info.toString());
  Message msg=Message.obtain();
  HashMap map=new HashMap();
  msg.what=SHOW_NOT_RESPONDING_MSG;
  msg.obj=map;
  map.put("String_Node_Str",app);
  if (activity != null) {
    map.put("String_Node_Str",activity);
  }
  mHandler.sendMessage(msg);
  return;
}