Search in sources :

Example 1 with RetryingInstaller

use of com.android.tools.idea.run.RetryingInstaller in project android by JetBrains.

the class SplitApkDeployTask method perform.

@Override
public boolean perform(@NotNull IDevice device, @NotNull LaunchStatus launchStatus, @NotNull ConsolePrinter printer) {
    InstantRunBuildInfo buildInfo = myInstantRunContext.getInstantRunBuildInfo();
    assert buildInfo != null;
    List<InstantRunArtifact> artifacts = buildInfo.getArtifacts();
    // TODO: should we pass in pm install options?
    List<String> installOptions = Lists.newArrayList();
    if (buildInfo.isPatchBuild()) {
        // partial install
        installOptions.add("-p");
        installOptions.add(myInstantRunContext.getApplicationId());
    }
    List<File> apks = Lists.newArrayListWithExpectedSize(artifacts.size());
    for (InstantRunArtifact artifact : artifacts) {
        if (artifact.type == InstantRunArtifactType.SPLIT_MAIN || artifact.type == InstantRunArtifactType.SPLIT) {
            apks.add(artifact.file);
        }
    }
    RetryingInstaller.Installer installer = new SplitApkInstaller(printer, apks, installOptions);
    RetryingInstaller retryingInstaller = new RetryingInstaller(myProject, device, installer, myInstantRunContext.getApplicationId(), printer, launchStatus);
    boolean status = retryingInstaller.install();
    if (status) {
        printer.stdout("Split APKs installed");
    }
    assert myInstantRunContext.getBuildSelection() != null;
    InstantRunStatsService.get(myProject).notifyDeployType(DeployType.SPLITAPK, myInstantRunContext, device);
    return status;
}
Also used : InstantRunBuildInfo(com.android.tools.fd.client.InstantRunBuildInfo) RetryingInstaller(com.android.tools.idea.run.RetryingInstaller) InstantRunArtifact(com.android.tools.fd.client.InstantRunArtifact) File(java.io.File)

Aggregations

InstantRunArtifact (com.android.tools.fd.client.InstantRunArtifact)1 InstantRunBuildInfo (com.android.tools.fd.client.InstantRunBuildInfo)1 RetryingInstaller (com.android.tools.idea.run.RetryingInstaller)1 File (java.io.File)1