use of com.android.tools.fd.client.InstantRunBuildInfo in project android by JetBrains.
the class InstantRunManager method pushArtifacts.
/**
* Pushes the artifacts obtained from the {@link InstantRunContext} to the given device.
* If the app is running, the artifacts are sent directly to the server running as part of the app.
* Otherwise, we save it to a file on the device.
*/
public UpdateMode pushArtifacts(@NotNull IDevice device, @NotNull InstantRunContext context, @NotNull UpdateMode updateMode) throws InstantRunPushFailedException, IOException {
InstantRunClient client = getInstantRunClient(context);
assert client != null;
InstantRunBuildInfo instantRunBuildInfo = context.getInstantRunBuildInfo();
assert instantRunBuildInfo != null;
updateMode = client.pushPatches(device, instantRunBuildInfo, updateMode, InstantRunSettings.isRestartActivity(), InstantRunSettings.isShowToastEnabled());
if ((updateMode == UpdateMode.HOT_SWAP || updateMode == UpdateMode.WARM_SWAP)) {
refreshDebugger(context.getApplicationId());
}
return updateMode;
}
use of com.android.tools.fd.client.InstantRunBuildInfo in project android by JetBrains.
the class InstantRunManager method transferLocalIdToDeviceId.
/**
* Called after a build & successful push to device: updates the build id on the device to whatever the
* build id was assigned by Gradle.
*
* @param device the device to push to
* @param module a module context, normally the main app module (but if it's a library module
* the infrastructure will look for other app modules
*/
public static void transferLocalIdToDeviceId(@NotNull IDevice device, @NotNull InstantRunContext context) {
InstantRunBuildInfo buildInfo = context.getInstantRunBuildInfo();
assert buildInfo != null;
String localTimestamp = buildInfo.getTimeStamp();
assert !StringUtil.isEmpty(localTimestamp) : "Unable to detect build timestamp";
InstantRunClient.transferBuildIdToDevice(device, localTimestamp, context.getApplicationId(), ILOGGER);
}
use of com.android.tools.fd.client.InstantRunBuildInfo in project android by JetBrains.
the class InstantRunBuildAnalyzer method getIrDebugSignals.
@NotNull
private Map<String, String> getIrDebugSignals(@NotNull DeployType deployType) {
Map<String, String> m = new HashMap<>();
m.put("deployType", deployType.toString());
m.put("canReuseProcessHandler", Boolean.toString(canReuseProcessHandler()));
m.put("androidGradlePluginVersion", myContext.getGradlePluginVersion().toString());
BuildSelection selection = myContext.getBuildSelection();
if (selection != null) {
m.put("buildSelection.mode", selection.getBuildMode().toString());
m.put("buildSelection.why", selection.why.toString());
}
InstantRunBuildInfo buildInfo = myContext.getInstantRunBuildInfo();
if (buildInfo != null) {
m.put("buildinfo.buildMode", buildInfo.getBuildMode());
m.put("buildinfo.verifierStatus", buildInfo.getVerifierStatus());
m.put("buildinfo.format", Integer.toString(buildInfo.getFormat()));
List<InstantRunArtifact> artifacts = buildInfo.getArtifacts();
m.put("buildinfo.nArtifacts", Integer.toString(artifacts.size()));
for (int i = 0; i < artifacts.size(); i++) {
InstantRunArtifact artifact = artifacts.get(i);
String prefix = "buildInfo.artifact[" + i + "]";
m.put(prefix + ".type", artifact.type.toString());
m.put(prefix + ".file", artifact.file.getName());
}
}
return m;
}
Aggregations