Program: 22509
Project: 22509
Buggy source:
public PackageManagerService(Context context,boolean factoryTest){
  EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_START,SystemClock.uptimeMillis());
  if (mSdkVersion <= 0) {
    Slog.w(TAG,"String_Node_Str");
  }
  mContext=context;
  mFactoryTest=factoryTest;
  mNoDexOpt="String_Node_Str".equals(SystemProperties.get("String_Node_Str"));
  mMetrics=new DisplayMetrics();
  mSettings=new Settings();
  mSettings.addSharedUserLP("String_Node_Str",Process.SYSTEM_UID,ApplicationInfo.FLAG_SYSTEM);
  mSettings.addSharedUserLP("String_Node_Str",MULTIPLE_APPLICATION_UIDS ? RADIO_UID : FIRST_APPLICATION_UID,ApplicationInfo.FLAG_SYSTEM);
  mSettings.addSharedUserLP("String_Node_Str",MULTIPLE_APPLICATION_UIDS ? LOG_UID : FIRST_APPLICATION_UID,ApplicationInfo.FLAG_SYSTEM);
  String separateProcesses=SystemProperties.get("String_Node_Str");
  if (separateProcesses != null && separateProcesses.length() > 0) {
    if ("String_Node_Str".equals(separateProcesses)) {
      mDefParseFlags=PackageParser.PARSE_IGNORE_PROCESSES;
      mSeparateProcesses=null;
      Slog.w(TAG,"String_Node_Str");
    }
 else {
      mDefParseFlags=0;
      mSeparateProcesses=separateProcesses.split("String_Node_Str");
      Slog.w(TAG,"String_Node_Str" + separateProcesses);
    }
  }
 else {
    mDefParseFlags=0;
    mSeparateProcesses=null;
  }
  Installer installer=new Installer();
  if (installer.ping() && Process.supportsProcesses()) {
    mInstaller=installer;
  }
 else {
    mInstaller=null;
  }
  WindowManager wm=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  Display d=wm.getDefaultDisplay();
  d.getMetrics(mMetrics);
synchronized (mInstallLock) {
synchronized (mPackages) {
      mHandlerThread.start();
      mHandler=new PackageHandler(mHandlerThread.getLooper());
      File dataDir=Environment.getDataDirectory();
      mAppDataDir=new File(dataDir,"String_Node_Str");
      mSecureAppDataDir=new File(dataDir,"String_Node_Str");
      mDrmAppPrivateInstallDir=new File(dataDir,"String_Node_Str");
      if (mInstaller == null) {
        File miscDir=new File(dataDir,"String_Node_Str");
        miscDir.mkdirs();
        mAppDataDir.mkdirs();
        mSecureAppDataDir.mkdirs();
        mDrmAppPrivateInstallDir.mkdirs();
      }
      readPermissions();
      mRestoredSettings=mSettings.readLP();
      long startTime=SystemClock.uptimeMillis();
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SYSTEM_SCAN_START,startTime);
      int scanMode=SCAN_MONITOR | SCAN_NO_PATHS;
      if (mNoDexOpt) {
        Slog.w(TAG,"String_Node_Str");
        scanMode|=SCAN_NO_DEX;
      }
      final HashSet<String> libFiles=new HashSet<String>();
      mFrameworkDir=new File(Environment.getRootDirectory(),"String_Node_Str");
      mDalvikCacheDir=new File(dataDir,"String_Node_Str");
      if (mInstaller != null) {
        boolean didDexOpt=false;
        String bootClassPath=System.getProperty("String_Node_Str");
        if (bootClassPath != null) {
          String[] paths=splitString(bootClassPath,':');
          for (int i=0; i < paths.length; i++) {
            try {
              if (dalvik.system.DexFile.isDexOptNeeded(paths[i])) {
                libFiles.add(paths[i]);
                mInstaller.dexopt(paths[i],Process.SYSTEM_UID,true);
                didDexOpt=true;
              }
            }
 catch (            FileNotFoundException e) {
              Slog.w(TAG,"String_Node_Str" + paths[i]);
            }
catch (            IOException e) {
              Slog.w(TAG,"String_Node_Str" + paths[i],e);
            }
          }
        }
 else {
          Slog.w(TAG,"String_Node_Str");
        }
        if (mSharedLibraries.size() > 0) {
          Iterator<String> libs=mSharedLibraries.values().iterator();
          while (libs.hasNext()) {
            String lib=libs.next();
            try {
              if (dalvik.system.DexFile.isDexOptNeeded(lib)) {
                libFiles.add(lib);
                mInstaller.dexopt(lib,Process.SYSTEM_UID,true);
                didDexOpt=true;
              }
            }
 catch (            FileNotFoundException e) {
              Slog.w(TAG,"String_Node_Str" + lib);
            }
catch (            IOException e) {
              Slog.w(TAG,"String_Node_Str" + lib,e);
            }
          }
        }
        libFiles.add(mFrameworkDir.getPath() + "String_Node_Str");
        String[] frameworkFiles=mFrameworkDir.list();
        if (frameworkFiles != null) {
          for (int i=0; i < frameworkFiles.length; i++) {
            File libPath=new File(mFrameworkDir,frameworkFiles[i]);
            String path=libPath.getPath();
            if (libFiles.contains(path)) {
              continue;
            }
            if (!path.endsWith("String_Node_Str") && !path.endsWith("String_Node_Str")) {
              continue;
            }
            try {
              if (dalvik.system.DexFile.isDexOptNeeded(path)) {
                mInstaller.dexopt(path,Process.SYSTEM_UID,true);
                didDexOpt=true;
              }
            }
 catch (            FileNotFoundException e) {
              Slog.w(TAG,"String_Node_Str" + path);
            }
catch (            IOException e) {
              Slog.w(TAG,"String_Node_Str" + path,e);
            }
          }
        }
        if (didDexOpt) {
          String[] files=mDalvikCacheDir.list();
          if (files != null) {
            for (int i=0; i < files.length; i++) {
              String fn=files[i];
              if (fn.startsWith("String_Node_Str") || fn.startsWith("String_Node_Str")) {
                Slog.i(TAG,"String_Node_Str" + fn);
                (new File(mDalvikCacheDir,fn)).delete();
              }
            }
          }
        }
      }
      mFrameworkInstallObserver=new AppDirObserver(mFrameworkDir.getPath(),OBSERVER_EVENTS,true);
      mFrameworkInstallObserver.startWatching();
      scanDirLI(mFrameworkDir,PackageParser.PARSE_IS_SYSTEM | PackageParser.PARSE_IS_SYSTEM_DIR,scanMode | SCAN_NO_DEX);
      mSystemAppDir=new File(Environment.getRootDirectory(),"String_Node_Str");
      mSystemInstallObserver=new AppDirObserver(mSystemAppDir.getPath(),OBSERVER_EVENTS,true);
      mSystemInstallObserver.startWatching();
      scanDirLI(mSystemAppDir,PackageParser.PARSE_IS_SYSTEM | PackageParser.PARSE_IS_SYSTEM_DIR,scanMode);
      if (mInstaller != null) {
        if (DEBUG_UPGRADE)         Log.v(TAG,"String_Node_Str");
        mInstaller.moveFiles();
      }
      Iterator<PackageSetting> psit=mSettings.mPackages.values().iterator();
      while (psit.hasNext()) {
        PackageSetting ps=psit.next();
        if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0 && !mPackages.containsKey(ps.name) && !mSettings.mDisabledSysPackages.containsKey(ps.name)) {
          psit.remove();
          String msg="String_Node_Str" + ps.name + "String_Node_Str";
          reportSettingsProblem(Log.WARN,msg);
          if (mInstaller != null) {
            mInstaller.remove(ps.name,true);
          }
        }
      }
      mAppInstallDir=new File(dataDir,"String_Node_Str");
      if (mInstaller == null) {
        mAppInstallDir.mkdirs();
      }
      ArrayList<PackageSetting> deletePkgsList=mSettings.getListOfIncompleteInstallPackages();
      for (int i=0; i < deletePkgsList.size(); i++) {
        cleanupInstallFailedPackage(deletePkgsList.get(i));
      }
      deleteTempPackageFiles();
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,SystemClock.uptimeMillis());
      mAppInstallObserver=new AppDirObserver(mAppInstallDir.getPath(),OBSERVER_EVENTS,false);
      mAppInstallObserver.startWatching();
      scanDirLI(mAppInstallDir,0,scanMode);
      mDrmAppInstallObserver=new AppDirObserver(mDrmAppPrivateInstallDir.getPath(),OBSERVER_EVENTS,false);
      mDrmAppInstallObserver.startWatching();
      scanDirLI(mDrmAppPrivateInstallDir,PackageParser.PARSE_FORWARD_LOCK,scanMode);
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SCAN_END,SystemClock.uptimeMillis());
      Slog.i(TAG,"String_Node_Str" + ((SystemClock.uptimeMillis() - startTime) / 1000f) + "String_Node_Str");
      updatePermissionsLP(null,null,true,false);
      mSettings.writeLP();
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_READY,SystemClock.uptimeMillis());
      Runtime.getRuntime().gc();
    }
  }
}

Fixed version (ground truth):
public PackageManagerService(Context context,boolean factoryTest){
  EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_START,SystemClock.uptimeMillis());
  if (mSdkVersion <= 0) {
    Slog.w(TAG,"String_Node_Str");
  }
  mContext=context;
  mFactoryTest=factoryTest;
  mNoDexOpt="String_Node_Str".equals(SystemProperties.get("String_Node_Str"));
  mMetrics=new DisplayMetrics();
  mSettings=new Settings();
  mSettings.addSharedUserLP("String_Node_Str",Process.SYSTEM_UID,ApplicationInfo.FLAG_SYSTEM);
  mSettings.addSharedUserLP("String_Node_Str",MULTIPLE_APPLICATION_UIDS ? RADIO_UID : FIRST_APPLICATION_UID,ApplicationInfo.FLAG_SYSTEM);
  mSettings.addSharedUserLP("String_Node_Str",MULTIPLE_APPLICATION_UIDS ? LOG_UID : FIRST_APPLICATION_UID,ApplicationInfo.FLAG_SYSTEM);
  String separateProcesses=SystemProperties.get("String_Node_Str");
  if (separateProcesses != null && separateProcesses.length() > 0) {
    if ("String_Node_Str".equals(separateProcesses)) {
      mDefParseFlags=PackageParser.PARSE_IGNORE_PROCESSES;
      mSeparateProcesses=null;
      Slog.w(TAG,"String_Node_Str");
    }
 else {
      mDefParseFlags=0;
      mSeparateProcesses=separateProcesses.split("String_Node_Str");
      Slog.w(TAG,"String_Node_Str" + separateProcesses);
    }
  }
 else {
    mDefParseFlags=0;
    mSeparateProcesses=null;
  }
  Installer installer=new Installer();
  if (installer.ping() && Process.supportsProcesses()) {
    mInstaller=installer;
  }
 else {
    mInstaller=null;
  }
  WindowManager wm=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  Display d=wm.getDefaultDisplay();
  d.getMetrics(mMetrics);
synchronized (mInstallLock) {
synchronized (mPackages) {
      mHandlerThread.start();
      mHandler=new PackageHandler(mHandlerThread.getLooper());
      File dataDir=Environment.getDataDirectory();
      mAppDataDir=new File(dataDir,"String_Node_Str");
      mSecureAppDataDir=new File(dataDir,"String_Node_Str");
      mDrmAppPrivateInstallDir=new File(dataDir,"String_Node_Str");
      if (mInstaller == null) {
        File miscDir=new File(dataDir,"String_Node_Str");
        miscDir.mkdirs();
        mAppDataDir.mkdirs();
        mSecureAppDataDir.mkdirs();
        mDrmAppPrivateInstallDir.mkdirs();
      }
      readPermissions();
      mRestoredSettings=mSettings.readLP();
      long startTime=SystemClock.uptimeMillis();
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SYSTEM_SCAN_START,startTime);
      int scanMode=SCAN_MONITOR | SCAN_NO_PATHS;
      if (mNoDexOpt) {
        Slog.w(TAG,"String_Node_Str");
        scanMode|=SCAN_NO_DEX;
      }
      final HashSet<String> libFiles=new HashSet<String>();
      mFrameworkDir=new File(Environment.getRootDirectory(),"String_Node_Str");
      mDalvikCacheDir=new File(dataDir,"String_Node_Str");
      if (mInstaller != null) {
        boolean didDexOpt=false;
        String bootClassPath=System.getProperty("String_Node_Str");
        if (bootClassPath != null) {
          String[] paths=splitString(bootClassPath,':');
          for (int i=0; i < paths.length; i++) {
            try {
              if (dalvik.system.DexFile.isDexOptNeeded(paths[i])) {
                libFiles.add(paths[i]);
                mInstaller.dexopt(paths[i],Process.SYSTEM_UID,true);
                didDexOpt=true;
              }
            }
 catch (            FileNotFoundException e) {
              Slog.w(TAG,"String_Node_Str" + paths[i]);
            }
catch (            IOException e) {
              Slog.w(TAG,"String_Node_Str" + paths[i],e);
            }
          }
        }
 else {
          Slog.w(TAG,"String_Node_Str");
        }
        if (mSharedLibraries.size() > 0) {
          Iterator<String> libs=mSharedLibraries.values().iterator();
          while (libs.hasNext()) {
            String lib=libs.next();
            try {
              if (dalvik.system.DexFile.isDexOptNeeded(lib)) {
                libFiles.add(lib);
                mInstaller.dexopt(lib,Process.SYSTEM_UID,true);
                didDexOpt=true;
              }
            }
 catch (            FileNotFoundException e) {
              Slog.w(TAG,"String_Node_Str" + lib);
            }
catch (            IOException e) {
              Slog.w(TAG,"String_Node_Str" + lib,e);
            }
          }
        }
        libFiles.add(mFrameworkDir.getPath() + "String_Node_Str");
        String[] frameworkFiles=mFrameworkDir.list();
        if (frameworkFiles != null) {
          for (int i=0; i < frameworkFiles.length; i++) {
            File libPath=new File(mFrameworkDir,frameworkFiles[i]);
            String path=libPath.getPath();
            if (libFiles.contains(path)) {
              continue;
            }
            if (!path.endsWith("String_Node_Str") && !path.endsWith("String_Node_Str")) {
              continue;
            }
            try {
              if (dalvik.system.DexFile.isDexOptNeeded(path)) {
                mInstaller.dexopt(path,Process.SYSTEM_UID,true);
                didDexOpt=true;
              }
            }
 catch (            FileNotFoundException e) {
              Slog.w(TAG,"String_Node_Str" + path);
            }
catch (            IOException e) {
              Slog.w(TAG,"String_Node_Str" + path,e);
            }
          }
        }
        if (didDexOpt) {
          String[] files=mDalvikCacheDir.list();
          if (files != null) {
            for (int i=0; i < files.length; i++) {
              String fn=files[i];
              if (fn.startsWith("String_Node_Str") || fn.startsWith("String_Node_Str")) {
                Slog.i(TAG,"String_Node_Str" + fn);
                (new File(mDalvikCacheDir,fn)).delete();
              }
            }
          }
        }
      }
      mFrameworkInstallObserver=new AppDirObserver(mFrameworkDir.getPath(),OBSERVER_EVENTS,true);
      mFrameworkInstallObserver.startWatching();
      scanDirLI(mFrameworkDir,PackageParser.PARSE_IS_SYSTEM | PackageParser.PARSE_IS_SYSTEM_DIR,scanMode | SCAN_NO_DEX);
      mSystemAppDir=new File(Environment.getRootDirectory(),"String_Node_Str");
      mSystemInstallObserver=new AppDirObserver(mSystemAppDir.getPath(),OBSERVER_EVENTS,true);
      mSystemInstallObserver.startWatching();
      scanDirLI(mSystemAppDir,PackageParser.PARSE_IS_SYSTEM | PackageParser.PARSE_IS_SYSTEM_DIR,scanMode);
      if (mInstaller != null) {
        if (DEBUG_UPGRADE)         Log.v(TAG,"String_Node_Str");
        mInstaller.moveFiles();
      }
      Iterator<PackageSetting> psit=mSettings.mPackages.values().iterator();
      while (psit.hasNext()) {
        PackageSetting ps=psit.next();
        if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0 && !mPackages.containsKey(ps.name) && !mSettings.mDisabledSysPackages.containsKey(ps.name)) {
          psit.remove();
          String msg="String_Node_Str" + ps.name + "String_Node_Str";
          reportSettingsProblem(Log.WARN,msg);
          if (mInstaller != null) {
            mInstaller.remove(ps.name,true);
          }
        }
      }
      mAppInstallDir=new File(dataDir,"String_Node_Str");
      if (mInstaller == null) {
        mAppInstallDir.mkdirs();
      }
      ArrayList<PackageSetting> deletePkgsList=mSettings.getListOfIncompleteInstallPackages();
      for (int i=0; i < deletePkgsList.size(); i++) {
        cleanupInstallFailedPackage(deletePkgsList.get(i));
      }
      deleteTempPackageFiles();
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,SystemClock.uptimeMillis());
      mAppInstallObserver=new AppDirObserver(mAppInstallDir.getPath(),OBSERVER_EVENTS,false);
      mAppInstallObserver.startWatching();
      scanDirLI(mAppInstallDir,0,scanMode);
      mDrmAppInstallObserver=new AppDirObserver(mDrmAppPrivateInstallDir.getPath(),OBSERVER_EVENTS,false);
      mDrmAppInstallObserver.startWatching();
      scanDirLI(mDrmAppPrivateInstallDir,PackageParser.PARSE_FORWARD_LOCK,scanMode);
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SCAN_END,SystemClock.uptimeMillis());
      Slog.i(TAG,"String_Node_Str" + ((SystemClock.uptimeMillis() - startTime) / 1000f) + "String_Node_Str");
      final boolean regrantPermissions=mSettings.mInternalSdkPlatform != mSdkVersion;
      if (regrantPermissions)       Slog.i(TAG,"String_Node_Str" + mSettings.mInternalSdkPlatform + "String_Node_Str"+ mSdkVersion+ "String_Node_Str");
      mSettings.mInternalSdkPlatform=mSdkVersion;
      updatePermissionsLP(null,null,true,regrantPermissions);
      mSettings.writeLP();
      EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_READY,SystemClock.uptimeMillis());
      Runtime.getRuntime().gc();
    }
  }
}