diff options
author | Jon Noack <noackjr@google.com> | 2017-01-12 08:55:14 -0600 |
---|---|---|
committer | Jon Noack <noackjr@google.com> | 2017-01-13 09:08:34 -0600 |
commit | 4b56ee2bb0401ccf35bdecaaf86b2212e98db919 (patch) | |
tree | d975bfe4953f509463bf3ea09d2f7297ed7a4605 | |
parent | 07bca8fb7f8d97223a1c27dd5f18008f56e406af (diff) | |
download | multidex-4b56ee2bb0401ccf35bdecaaf86b2212e98db919.tar.gz |
Prefix temp files to ensure they are cleaned up
Temp files are removed unconditionally in a finally block following extraction.
However, if the process is killed during extraction this finally block will not
run. Because temp files started with extractedFilePrefix, they wouldn't be
cleaned up in prepareDexDir(). This change ensures that prepareDexDir() will
remove any existing temp files before extraction begins.
Bug: 27769642
Bug: 33718827
Test: Passes Google Play services tests
Change-Id: I803ba2c7234801551d36cbbe2941eeaa986d31f8
-rw-r--r-- | library/src/android/support/multidex/MultiDexExtractor.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/src/android/support/multidex/MultiDexExtractor.java b/library/src/android/support/multidex/MultiDexExtractor.java index 32d7ee9..177279a 100644 --- a/library/src/android/support/multidex/MultiDexExtractor.java +++ b/library/src/android/support/multidex/MultiDexExtractor.java @@ -334,7 +334,8 @@ final class MultiDexExtractor { InputStream in = apk.getInputStream(dexFile); ZipOutputStream out = null; - File tmp = File.createTempFile(extractedFilePrefix, EXTRACTED_SUFFIX, + // Temp files must not start with extractedFilePrefix to get cleaned up in prepareDexDir() + File tmp = File.createTempFile("tmp-" + extractedFilePrefix, EXTRACTED_SUFFIX, extractTo.getParentFile()); Log.i(TAG, "Extracting " + tmp.getPath()); try { |