use of com.android.tools.build.bundletool.splitters.ResourceAnalyzer in project bundletool by google.
the class ArchivedApksGenerator method getArchivedResourceTable.
private Optional<ResourceTable> getArchivedResourceTable(AppBundle appBundle, BundleModule bundleModule, AndroidManifest archivedManifest) throws IOException {
if (!bundleModule.getResourceTable().isPresent()) {
return Optional.empty();
}
ImmutableSet<ResourceId> referredResources = new ResourceAnalyzer(appBundle).findAllAppResourcesReachableFromManifest(archivedManifest);
ResourceTable archivedResourceTable = ResourcesUtils.filterResourceTable(bundleModule.getResourceTable().get(), /* removeEntryPredicate= */
entry -> !referredResources.contains(entry.getResourceId()), /* configValuesFilterFn= */
ResourceTableEntry::getEntry);
return Optional.of(archivedResourceTable);
}
Aggregations