Search in sources :

Example 1 with ShadowPackageParser._PackageParser_

use of org.robolectric.shadows.ShadowPackageParser._PackageParser_ in project robolectric by robolectric.

the class ShadowPackageManager method addPackageInternal.

/**
 * Internal use only.
 *
 * @param appPackage
 */
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);
}
Also used : PackageInfo(android.content.pm.PackageInfo) PermissionGroupInfo(android.content.pm.PermissionGroupInfo) PermissionGroup(android.content.pm.PackageParser.PermissionGroup) ShadowPackageParser._PackageParser_(org.robolectric.shadows.ShadowPackageParser._PackageParser_)

Aggregations

PackageInfo (android.content.pm.PackageInfo)1 PermissionGroup (android.content.pm.PackageParser.PermissionGroup)1 PermissionGroupInfo (android.content.pm.PermissionGroupInfo)1 ShadowPackageParser._PackageParser_ (org.robolectric.shadows.ShadowPackageParser._PackageParser_)1