Program: 183714
Project: 183714
Buggy source:
public void systemReady(){
  if (!Process.supportsProcesses()) {
    mStartRunning=true;
    mTopAction=Intent.ACTION_MAIN;
  }
synchronized (this) {
    if (mSystemReady) {
      return;
    }
    mSystemReady=true;
    if (!mStartRunning) {
      return;
    }
  }
  if (Config.LOGD)   Log.d(TAG,"String_Node_Str");
  EventLog.writeEvent(LOG_BOOT_PROGRESS_AMS_READY,SystemClock.uptimeMillis());
synchronized (this) {
    if (mFactoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL) {
      ResolveInfo ri=mContext.getPackageManager().resolveActivity(new Intent(Intent.ACTION_FACTORY_TEST),0);
      CharSequence errorMsg=null;
      if (ri != null) {
        ActivityInfo ai=ri.activityInfo;
        ApplicationInfo app=ai.applicationInfo;
        if ((app.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          mTopAction=Intent.ACTION_FACTORY_TEST;
          mTopData=null;
          mTopComponent=new ComponentName(app.packageName,ai.name);
        }
 else {
          errorMsg=mContext.getResources().getText(com.android.internal.R.string.factorytest_not_system);
        }
      }
 else {
        errorMsg=mContext.getResources().getText(com.android.internal.R.string.factorytest_no_action);
      }
      if (errorMsg != null) {
        mTopAction=null;
        mTopData=null;
        mTopComponent=null;
        Message msg=Message.obtain();
        msg.what=SHOW_FACTORY_ERROR_MSG;
        msg.getData().putCharSequence("String_Node_Str",errorMsg);
        mHandler.sendMessage(msg);
      }
    }
  }
  retrieveSettings();
synchronized (this) {
    if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
      try {
        List apps=ActivityThread.getPackageManager().getPersistentApplications(PackageManager.GET_SHARED_LIBRARY_FILES);
        if (apps != null) {
          int N=apps.size();
          int i;
          for (i=0; i < N; i++) {
            ApplicationInfo info=(ApplicationInfo)apps.get(i);
            if (info != null && !info.packageName.equals("String_Node_Str")) {
              addAppLocked(info);
            }
          }
        }
      }
 catch (      RemoteException ex) {
      }
    }
    try {
      if (ActivityThread.getPackageManager().hasSystemUidErrors()) {
        Message msg=Message.obtain();
        msg.what=SHOW_UID_ERROR_MSG;
        mHandler.sendMessage(msg);
      }
    }
 catch (    RemoteException e) {
    }
    mBooting=true;
    resumeTopActivityLocked(null);
  }
}

Fixed version (ground truth):
public void systemReady(){
  if (!Process.supportsProcesses()) {
    mStartRunning=true;
    mTopAction=Intent.ACTION_MAIN;
  }
synchronized (this) {
    if (mSystemReady) {
      return;
    }
    mSystemReady=true;
    if (!mStartRunning) {
      return;
    }
  }
  if (Config.LOGD)   Log.d(TAG,"String_Node_Str");
  EventLog.writeEvent(LOG_BOOT_PROGRESS_AMS_READY,SystemClock.uptimeMillis());
synchronized (this) {
    if (mFactoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL) {
      ResolveInfo ri=mContext.getPackageManager().resolveActivity(new Intent(Intent.ACTION_FACTORY_TEST),STOCK_PM_FLAGS);
      CharSequence errorMsg=null;
      if (ri != null) {
        ActivityInfo ai=ri.activityInfo;
        ApplicationInfo app=ai.applicationInfo;
        if ((app.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          mTopAction=Intent.ACTION_FACTORY_TEST;
          mTopData=null;
          mTopComponent=new ComponentName(app.packageName,ai.name);
        }
 else {
          errorMsg=mContext.getResources().getText(com.android.internal.R.string.factorytest_not_system);
        }
      }
 else {
        errorMsg=mContext.getResources().getText(com.android.internal.R.string.factorytest_no_action);
      }
      if (errorMsg != null) {
        mTopAction=null;
        mTopData=null;
        mTopComponent=null;
        Message msg=Message.obtain();
        msg.what=SHOW_FACTORY_ERROR_MSG;
        msg.getData().putCharSequence("String_Node_Str",errorMsg);
        mHandler.sendMessage(msg);
      }
    }
  }
  retrieveSettings();
synchronized (this) {
    if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
      try {
        List apps=ActivityThread.getPackageManager().getPersistentApplications(STOCK_PM_FLAGS);
        if (apps != null) {
          int N=apps.size();
          int i;
          for (i=0; i < N; i++) {
            ApplicationInfo info=(ApplicationInfo)apps.get(i);
            if (info != null && !info.packageName.equals("String_Node_Str")) {
              addAppLocked(info);
            }
          }
        }
      }
 catch (      RemoteException ex) {
      }
    }
    try {
      if (ActivityThread.getPackageManager().hasSystemUidErrors()) {
        Message msg=Message.obtain();
        msg.what=SHOW_UID_ERROR_MSG;
        mHandler.sendMessage(msg);
      }
    }
 catch (    RemoteException e) {
    }
    mBooting=true;
    resumeTopActivityLocked(null);
  }
}