Search in sources :

Example 1 with ScreenDensityTargeting

use of com.android.bundle.Targeting.ScreenDensityTargeting in project bundletool by google.

the class AbstractSizeAggregator method getSizesPerConfiguration.

protected ConfigurationSizes getSizesPerConfiguration(ImmutableSet<SdkVersionTargeting> sdkTargetingOptions, ImmutableSet<AbiTargeting> abiTargetingOptions, ImmutableSet<LanguageTargeting> languageTargetingOptions, ImmutableSet<ScreenDensityTargeting> screenDensityTargetingOptions, ImmutableSet<TextureCompressionFormatTargeting> textureCompressionFormatTargetingOptions, ImmutableSet<DeviceTierTargeting> deviceTierTargetingOptions) {
    Map<SizeConfiguration, Long> minSizeByConfiguration = new HashMap<>();
    Map<SizeConfiguration, Long> maxSizeByConfiguration = new HashMap<>();
    for (SdkVersionTargeting sdkVersionTargeting : sdkTargetingOptions) {
        for (AbiTargeting abiTargeting : abiTargetingOptions) {
            for (ScreenDensityTargeting screenDensityTargeting : screenDensityTargetingOptions) {
                for (LanguageTargeting languageTargeting : languageTargetingOptions) {
                    for (TextureCompressionFormatTargeting textureCompressionFormatTargeting : textureCompressionFormatTargetingOptions) {
                        for (DeviceTierTargeting deviceTierTargeting : deviceTierTargetingOptions) {
                            SizeConfiguration configuration = mergeWithDeviceSpec(getSizeConfiguration(sdkVersionTargeting, abiTargeting, screenDensityTargeting, languageTargeting, textureCompressionFormatTargeting, deviceTierTargeting), getSizeRequest.getDeviceSpec());
                            long compressedSize = getCompressedSize(getMatchingApks(sdkVersionTargeting, abiTargeting, screenDensityTargeting, languageTargeting, textureCompressionFormatTargeting, deviceTierTargeting));
                            minSizeByConfiguration.merge(configuration, compressedSize, Math::min);
                            maxSizeByConfiguration.merge(configuration, compressedSize, Math::max);
                        }
                    }
                }
            }
        }
    }
    return ConfigurationSizes.create(/* minSizeConfigurationMap= */
    ImmutableMap.copyOf(minSizeByConfiguration), /* maxSizeConfigurationMap= */
    ImmutableMap.copyOf(maxSizeByConfiguration));
}
Also used : LanguageTargeting(com.android.bundle.Targeting.LanguageTargeting) DeviceTierTargeting(com.android.bundle.Targeting.DeviceTierTargeting) HashMap(java.util.HashMap) AbiTargeting(com.android.bundle.Targeting.AbiTargeting) SdkVersionTargeting(com.android.bundle.Targeting.SdkVersionTargeting) TextureCompressionFormatTargeting(com.android.bundle.Targeting.TextureCompressionFormatTargeting) SizeConfiguration(com.android.tools.build.bundletool.model.SizeConfiguration) ScreenDensityTargeting(com.android.bundle.Targeting.ScreenDensityTargeting)

Aggregations

AbiTargeting (com.android.bundle.Targeting.AbiTargeting)1 DeviceTierTargeting (com.android.bundle.Targeting.DeviceTierTargeting)1 LanguageTargeting (com.android.bundle.Targeting.LanguageTargeting)1 ScreenDensityTargeting (com.android.bundle.Targeting.ScreenDensityTargeting)1 SdkVersionTargeting (com.android.bundle.Targeting.SdkVersionTargeting)1 TextureCompressionFormatTargeting (com.android.bundle.Targeting.TextureCompressionFormatTargeting)1 SizeConfiguration (com.android.tools.build.bundletool.model.SizeConfiguration)1 HashMap (java.util.HashMap)1