com.android.ide.common.build
Class SplitOutputMatcher

java.lang.Object
  extended by com.android.ide.common.build.SplitOutputMatcher

public class SplitOutputMatcher
extends java.lang.Object

Helper class to help with installation of multi-output variants.


Constructor Summary
SplitOutputMatcher()
           
 
Method Summary
static java.util.List<com.android.build.OutputFile> computeBestOutput(java.util.List<? extends com.android.build.VariantOutput> outputs, java.util.Collection<java.lang.String> variantAbiFilters, int deviceDensity, java.util.Collection<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.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.util.List<java.io.File> computeBestOutput(ProcessExecutor processExecutor, java.io.File splitSelectExe, com.android.builder.testing.api.DeviceConfigProvider deviceConfigProvider, java.util.List<? extends com.android.build.VariantOutput> outputs, java.util.Collection<java.lang.String> variantAbiFilters)
          Determines and return the list of APKs to use based on given device density and abis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitOutputMatcher

public SplitOutputMatcher()
Method Detail

computeBestOutput

@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.List<? extends com.android.build.VariantOutput> outputs,
                                                                     @Nullable
                                                                     java.util.Collection<java.lang.String> variantAbiFilters)
                                                      throws ProcessException
Determines and return the list of APKs to use based on given device density and abis. if there are pure splits, use the split-select tool otherwise revert to store logic.

Parameters:
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.
Returns:
the list of APK files to install.
Throws:
ProcessException

computeBestOutput

@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
Determines and return the list of APKs to use based on given device density and abis. if there are pure splits, use the split-select tool otherwise revert to store logic.

Parameters:
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.
Returns:
the list of APK files to install.
Throws:
ProcessException

computeBestOutput

@NonNull
public static java.util.List<com.android.build.OutputFile> computeBestOutput(@NonNull
                                                                                     java.util.List<? extends com.android.build.VariantOutput> outputs,
                                                                                     @Nullable
                                                                                     java.util.Collection<java.lang.String> variantAbiFilters,
                                                                                     int deviceDensity,
                                                                                     @NonNull
                                                                                     java.util.Collection<java.lang.String> deviceAbis)
Determines and return the list of APKs to use based on given device density and abis. 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.

Parameters:
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.
Returns:
the list of APKs to install or null if none are compatible.