public class SplitOutputMatcher
extends java.lang.Object
Constructor and Description |
---|
SplitOutputMatcher() |
Modifier and Type | Method and Description |
---|---|
static <T extends com.android.build.VariantOutput> |
computeBestOutput(java.util.Collection<? extends T> outputs,
java.util.Collection<java.lang.String> variantAbiFilters,
int deviceDensity,
java.util.List<java.lang.String> deviceAbis)
Determines and return the list of APKs to use based on given device density and abis.
|
static java.util.List<java.io.File> |
computeBestOutput(ProcessExecutor processExecutor,
java.io.File splitSelectExe,
com.android.builder.testing.api.DeviceConfigProvider deviceConfigProvider,
java.util.Collection<com.android.build.OutputFile> outputs,
java.util.Collection<java.lang.String> variantAbiFilters)
Determines and return the list of APKs to use based on given device density and abis.
|
static java.util.List<java.io.File> |
computeBestOutput(ProcessExecutor processExecutor,
java.io.File splitSelectExe,
com.android.builder.testing.api.DeviceConfigProvider deviceConfigProvider,
java.io.File mainApk,
java.util.Collection<java.lang.String> splitApksPath)
Determines and return the list of APKs to use based on given device density and abis.
|
static java.lang.String |
prepareConfigFormatMccMnc(java.lang.String deviceConfig)
Preparing the configuration string according to the format expected by the split-select
tool.
|
@NonNull public static java.util.List<java.io.File> computeBestOutput(@NonNull ProcessExecutor processExecutor, @Nullable java.io.File splitSelectExe, @NonNull com.android.builder.testing.api.DeviceConfigProvider deviceConfigProvider, @NonNull java.util.Collection<com.android.build.OutputFile> outputs, @Nullable java.util.Collection<java.lang.String> variantAbiFilters) throws ProcessException
if there are pure splits, use the split-select tool otherwise revert to store logic.
processExecutor
- an executor to execute native processes.splitSelectExe
- the split select tool optionally.deviceConfigProvider
- the device configuration.outputs
- the tested variant outpts.variantAbiFilters
- a list of abi filters applied to the variant. This is used in place
of the outputs, if there is a single output with no abi filters. If the list is null or
empty, then the variant does not restrict ABI packaging.ProcessException
- when the splitSelect executable failed to execute.@NonNull public static java.util.List<java.io.File> computeBestOutput(@NonNull ProcessExecutor processExecutor, @NonNull java.io.File splitSelectExe, @NonNull com.android.builder.testing.api.DeviceConfigProvider deviceConfigProvider, @NonNull java.io.File mainApk, @NonNull java.util.Collection<java.lang.String> splitApksPath) throws ProcessException
if there are pure splits, use the split-select tool otherwise revert to store logic.
processExecutor
- an executor to execute native processes.splitSelectExe
- the split select tool optionally.deviceConfigProvider
- the device configuration.mainApk
- the main apk file.splitApksPath
- the list of split apks path.ProcessException
- when the splitSelect executable failed to execute.@NonNull public static <T extends com.android.build.VariantOutput> java.util.List<T> computeBestOutput(@NonNull java.util.Collection<? extends T> outputs, @Nullable java.util.Collection<java.lang.String> variantAbiFilters, int deviceDensity, @NonNull java.util.List<java.lang.String> deviceAbis)
This uses the same logic as the store, using two passes: First, find all the compatible outputs. Then take the one with the highest versionCode.
outputs
- the outputs to choose from.variantAbiFilters
- a list of abi filters applied to the variant. This is used in place
of the outputs, if there is a single output with no abi filters. If the list is null,
then the variant does not restrict ABI packaging.deviceDensity
- the density of the device.deviceAbis
- a list of ABIs supported by the device.public static java.lang.String prepareConfigFormatMccMnc(@NonNull java.lang.String deviceConfig)
Devices having api level 21 have a config format that is not compatible with split-select. The problem is that the split-select tool expects mcc310-mnc260, while the am get-config command will output 310mcc-260mnc-... (mcc is always before mnc, and both are optional). That is why the string is processed to match the expected format for these two dimensions. The rest of the config string is not changed.
deviceConfig
- device configuration to process