FastDeploy refactor: 2+GB APK support, optimizations, tests.
- removed 2GB apk size cap,
- removed zip archive parsing on device (1.1M->236K agent size reduction),
- optimized matching entries search,
- added more robust matching entries search based on hash of CDr entry,
- reduced patch size by reusing Local File Header of matched entries,
- removed extra manifest parsing and extra agent calls,
- added device-side tests for agent,
- fix for Windows patch creation.
Test: atest adb_test fastdeploy_test FastDeployTests
Total time for 0-size patch reduction for 1.7G apk: 1m1.778s->0m36.234s.
Change-Id: I66d2cef1adf5b2be3325e355a7e72e9c99992369
diff --git a/adb/client/fastdeploycallbacks.cpp b/adb/client/fastdeploycallbacks.cpp
index 23a0aca..86ceaa1 100644
--- a/adb/client/fastdeploycallbacks.cpp
+++ b/adb/client/fastdeploycallbacks.cpp
@@ -49,35 +49,7 @@
int capture_shell_command(const char* command, std::vector<char>* outBuffer,
std::vector<char>* errBuffer) {
DeployAgentBufferCallback cb(outBuffer, errBuffer);
- return send_shell_command(command, false, &cb);
-}
-
-DeployAgentFileCallback::DeployAgentFileCallback(FILE* outputFile, std::vector<char>* errBuffer) {
- mpOutFile = outputFile;
- mpErrBuffer = errBuffer;
- mBytesWritten = 0;
-}
-
-void DeployAgentFileCallback::OnStdout(const char* buffer, int length) {
- if (mpOutFile != NULL) {
- int bytes_written = fwrite(buffer, 1, length, mpOutFile);
- if (bytes_written != length) {
- printf("Write error %d\n", bytes_written);
- }
- mBytesWritten += bytes_written;
- }
-}
-
-void DeployAgentFileCallback::OnStderr(const char* buffer, int length) {
- appendBuffer(mpErrBuffer, buffer, length);
-}
-
-int DeployAgentFileCallback::Done(int status) {
- return status;
-}
-
-int DeployAgentFileCallback::getBytesWritten() {
- return mBytesWritten;
+ return send_shell_command(command, /*disable_shell_protocol=*/false, &cb);
}
DeployAgentBufferCallback::DeployAgentBufferCallback(std::vector<char>* outBuffer,