code: public synchronized void addPackage(PackageInfo packageInfo, PackageStats packageStats) {
      if (packageInfo.applicationInfo != null
          && (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
        Log.w(TAG, "Adding not installed package: " + packageInfo.packageName);
      }
      Preconditions.checkArgument(packageInfo.packageName.equals(packageStats.packageName));
  
      packageInfos.put(packageInfo.packageName, packageInfo);
      packageStatsMap.put(packageInfo.packageName, packageStats);
  
      packageSettings.put(packageInfo.packageName, new PackageSetting());
  
      applicationEnabledSettingMap.put(
          packageInfo.packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
      if (packageInfo.applicationInfo != null) {
        namesForUid.put(packageInfo.applicationInfo.uid, packageInfo.packageName);
      }
    }
docs: Installs a package with its stats with the {@link PackageManager}.
  
  This method doesn't add any defaults to the {@code packageInfo} parameters. You should make
  sure it is valid (see {@link #installPackage(PackageInfo)}).