Note that all resolve infos will have ResolveInfo.isDefault field set to true to allow their resolution for implicit intents. If this is not what you want, then you still have the reference to those ResolveInfos, and you can set the field back to false.

installPackage

In order to create PackageInfo objects in a valid state please use androidx.test.core.content.pm.PackageInfoBuilder.

This method automatically simulates instalation of a package in the system, so it adds a flag ApplicationInfo.FLAG_INSTALLED to the application info and makes sure it exits. It will update applicationInfo in package components as well.

addPermissionGroupInfo

Allows overriding or adding permission-group elements. These would be otherwise specified by either (the system)[https://developer.android.com/guide/topics/permissions/requesting.html#perm-groups] or by (the app itself)[https://developer.android.com/guide/topics/manifest/permission-group-element.html], as part of its manifest

PackageParser.PermissionGroups added through this method have precedence over those specified with the same name by one of the aforementioned methods.