Search in sources :

Example 1 with ResourceAnalyzer

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);
}
Also used : ResourceAnalyzer(com.android.tools.build.bundletool.splitters.ResourceAnalyzer) ResourceTableEntry(com.android.tools.build.bundletool.model.ResourceTableEntry) ResourceId(com.android.tools.build.bundletool.model.ResourceId) ResourceTable(com.android.aapt.Resources.ResourceTable)

Aggregations

ResourceTable (com.android.aapt.Resources.ResourceTable)1 ResourceId (com.android.tools.build.bundletool.model.ResourceId)1 ResourceTableEntry (com.android.tools.build.bundletool.model.ResourceTableEntry)1 ResourceAnalyzer (com.android.tools.build.bundletool.splitters.ResourceAnalyzer)1