shadows/framework/src/main/java/org/robolectric/shadows/ShadowPackageManager.java
public void addPackageInternal(Package appPackage) {
    int flags =
        GET_ACTIVITIES
            | GET_RECEIVERS
            | GET_SERVICES
            | GET_PROVIDERS
            | GET_INSTRUMENTATION
            | GET_INTENT_FILTERS
            | GET_SIGNATURES
            | GET_RESOLVED_FILTER
            | GET_META_DATA
            | GET_GIDS
            | MATCH_DISABLED_COMPONENTS
            | GET_SHARED_LIBRARY_FILES
            | GET_URI_PERMISSION_PATTERNS
            | GET_PERMISSIONS
            | MATCH_UNINSTALLED_PACKAGES
            | GET_CONFIGURATIONS
            | MATCH_DISABLED_UNTIL_USED_COMPONENTS
            | MATCH_DIRECT_BOOT_UNAWARE
            | MATCH_DIRECT_BOOT_AWARE;

    for (PermissionGroup permissionGroup : appPackage.permissionGroups) {
      PermissionGroupInfo permissionGroupInfo =
          PackageParser.generatePermissionGroupInfo(permissionGroup, flags);
      addPermissionGroupInfo(permissionGroupInfo);
    }
    PackageInfo packageInfo =
        reflector(_PackageParser_.class)
            .generatePackageInfo(appPackage, new int[] {0}, flags, 0, 0);

    packageInfo.applicationInfo.uid = Process.myUid();
    packageInfo.applicationInfo.dataDir = createTempDir(packageInfo.packageName + "-dataDir");
    installPackage(packageInfo);
    addFilters(activityFilters, appPackage.activities);
    addFilters(serviceFilters, appPackage.services);
    addFilters(providerFilters, appPackage.providers);
    addFilters(receiverFilters, appPackage.receivers);
  }
public void addPackageInternal(Package appPackage) {
    int flags =
        GET_ACTIVITIES
            | GET_RECEIVERS
            | GET_SERVICES
            | GET_PROVIDERS
            | GET_INSTRUMENTATION
            | GET_INTENT_FILTERS
            | GET_SIGNATURES
            | GET_RESOLVED_FILTER
            | GET_META_DATA
            | GET_GIDS
            | MATCH_DISABLED_COMPONENTS
            | GET_SHARED_LIBRARY_FILES
            | GET_URI_PERMISSION_PATTERNS
            | GET_PERMISSIONS
            | MATCH_UNINSTALLED_PACKAGES
            | GET_CONFIGURATIONS
            | MATCH_DISABLED_UNTIL_USED_COMPONENTS
            | MATCH_DIRECT_BOOT_UNAWARE
            | MATCH_DIRECT_BOOT_AWARE;

    for (PermissionGroup permissionGroup : appPackage.permissionGroups) {
      PermissionGroupInfo permissionGroupInfo =
          PackageParser.generatePermissionGroupInfo(permissionGroup, flags);
      addPermissionGroupInfo(permissionGroupInfo);
    }
    PackageInfo packageInfo =
        reflector(_PackageParser_.class)
            .generatePackageInfo(appPackage, new int[] {0}, flags, 0, 0);

    packageInfo.applicationInfo.uid = Process.myUid();
    packageInfo.applicationInfo.dataDir = createTempDir(packageInfo.packageName + "-dataDir");
    installPackage(packageInfo);
    addFilters(activityFilters, appPackage.activities);
    addFilters(serviceFilters, appPackage.services);
    addFilters(providerFilters, appPackage.providers);
    addFilters(receiverFilters, appPackage.receivers);
  }
Internal use only.

@param appPackage