shadows/framework/src/main/java/org/robolectric/shadows/ShadowPackageManager.java
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);
    }
  }
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);
    }
  }
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 ) ; } }
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)}).
Installs a package with its stats with the { @link PackageManager } .