diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-06-09 17:30:57 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2014-07-14 10:26:21 -0700 |
commit | 960df97c2356f5a804d3ef87fe49f788d7ecdfaf (patch) | |
tree | 1c0bb5d596f7bc747b5ee7d76796ddf9c3db8e08 /adb/file_sync_client.c | |
parent | e60eb623845b6809657b18ea068a0b93f052fa0c (diff) | |
download | system_core-960df97c2356f5a804d3ef87fe49f788d7ecdfaf.zip system_core-960df97c2356f5a804d3ef87fe49f788d7ecdfaf.tar.gz system_core-960df97c2356f5a804d3ef87fe49f788d7ecdfaf.tar.bz2 |
Add install-multiple to adb.
The new install-multiple command automates creating an install
session, streaming multiple files into place, and then committing
or destroying the session. This uses the recent "exec" feature to
stream APK contents over stdin directly into their final resting
place, requiring no extra copies.
Blindly pass through command line arguments to "pm" to make adding
new flags easier in future.
Remove support for verifying APK before sending across wire, since it
was reading the entire APK into memory (!) before sending. Also
remove encrypted APKs, since they are no longer supported. Drop
support for undocumented verification files.
Bug: 14975160
Change-Id: I0c538471873061798160e2e47cec4c0424c27361
Diffstat (limited to 'adb/file_sync_client.c')
-rw-r--r-- | adb/file_sync_client.c | 65 |
1 files changed, 4 insertions, 61 deletions
diff --git a/adb/file_sync_client.c b/adb/file_sync_client.c index c1ab808..ad59e81 100644 --- a/adb/file_sync_client.c +++ b/adb/file_sync_client.c @@ -335,7 +335,7 @@ static int write_data_link(int fd, const char *path, syncsendbuf *sbuf) #endif static int sync_send(int fd, const char *lpath, const char *rpath, - unsigned mtime, mode_t mode, int verifyApk, int show_progress) + unsigned mtime, mode_t mode, int show_progress) { syncmsg msg; int len, r; @@ -350,63 +350,6 @@ static int sync_send(int fd, const char *lpath, const char *rpath, snprintf(tmp, sizeof(tmp), ",%d", mode); r = strlen(tmp); - if (verifyApk) { - int lfd; - zipfile_t zip; - zipentry_t entry; - int amt; - - // if we are transferring an APK file, then sanity check to make sure - // we have a real zip file that contains an AndroidManifest.xml - // this requires that we read the entire file into memory. - lfd = adb_open(lpath, O_RDONLY); - if(lfd < 0) { - fprintf(stderr,"cannot open '%s': %s\n", lpath, strerror(errno)); - return -1; - } - - size = adb_lseek(lfd, 0, SEEK_END); - if (size == -1 || -1 == adb_lseek(lfd, 0, SEEK_SET)) { - fprintf(stderr, "error seeking in file '%s'\n", lpath); - adb_close(lfd); - return 1; - } - - file_buffer = (char *)malloc(size); - if (file_buffer == NULL) { - fprintf(stderr, "could not allocate buffer for '%s'\n", - lpath); - adb_close(lfd); - return 1; - } - amt = adb_read(lfd, file_buffer, size); - if (amt != size) { - fprintf(stderr, "error reading from file: '%s'\n", lpath); - adb_close(lfd); - free(file_buffer); - return 1; - } - - adb_close(lfd); - - zip = init_zipfile(file_buffer, size); - if (zip == NULL) { - fprintf(stderr, "file '%s' is not a valid zip file\n", - lpath); - free(file_buffer); - return 1; - } - - entry = lookup_zipentry(zip, "AndroidManifest.xml"); - release_zipfile(zip); - if (entry == NULL) { - fprintf(stderr, "file '%s' does not contain AndroidManifest.xml\n", - lpath); - free(file_buffer); - return 1; - } - } - msg.req.id = ID_SEND; msg.req.namelen = htoll(len + r); @@ -789,7 +732,7 @@ static int copy_local_dir_remote(int fd, const char *lpath, const char *rpath, i if(ci->flag == 0) { fprintf(stderr,"%spush: %s -> %s\n", listonly ? "would " : "", ci->src, ci->dst); if(!listonly && - sync_send(fd, ci->src, ci->dst, ci->time, ci->mode, 0 /* no verify APK */, + sync_send(fd, ci->src, ci->dst, ci->time, ci->mode, 0 /* no show progress */)) { return 1; } @@ -808,7 +751,7 @@ static int copy_local_dir_remote(int fd, const char *lpath, const char *rpath, i } -int do_sync_push(const char *lpath, const char *rpath, int verifyApk, int show_progress) +int do_sync_push(const char *lpath, const char *rpath, int show_progress) { struct stat st; unsigned mode; @@ -855,7 +798,7 @@ int do_sync_push(const char *lpath, const char *rpath, int verifyApk, int show_p rpath = tmp; } BEGIN(); - if(sync_send(fd, lpath, rpath, st.st_mtime, st.st_mode, verifyApk, show_progress)) { + if(sync_send(fd, lpath, rpath, st.st_mtime, st.st_mode, show_progress)) { return 1; } else { END(); |