use of com.android.tools.build.bundletool.device.PackagesParser in project bundletool by google.
the class InstallMultiApksCommand method getPackagesInstalledOnDevice.
private static ImmutableMap<String, InstalledPackageInfo> getPackagesInstalledOnDevice(Device device) {
// List standard packages (excluding apex)
ImmutableList<String> listPackagesOutput = new AdbShellCommandTask(device, "pm list packages --show-versioncode").execute();
// List .apex packages.
ImmutableList<String> listApexPackagesOutput = new AdbShellCommandTask(device, "pm list packages --apex-only --show-versioncode").execute();
ImmutableSet<InstalledPackageInfo> installedApks = new PackagesParser(/* isApex= */
false).parse(listPackagesOutput);
ImmutableSet<InstalledPackageInfo> installedApexPackages = new PackagesParser(/* isApex= */
true).parse(listApexPackagesOutput);
return Streams.concat(installedApks.stream(), installedApexPackages.stream()).collect(toImmutableMap(InstalledPackageInfo::getPackageName, installedPackageInfo -> installedPackageInfo));
}
Aggregations