☠☠ backed out by 03297f8c28a0 ☠ ☠ | |
author | Nick Alexander <nalexander@mozilla.com> |
Tue, 26 Jan 2016 10:36:09 -0800 | |
changeset 319184 | baf25be8d4917e6dcc52eede79e61e1837328c86 |
parent 319183 | e228040a044b7ff7363a178da2cb0b8b42724048 |
child 319185 | 03297f8c28a08d2b39a252c7b368524d9e69da69 |
push id | 5913 |
push user | jlund@mozilla.com |
push date | Mon, 25 Apr 2016 16:57:49 +0000 |
treeherder | mozilla-beta@dcaf0a6fa115 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | rnewman |
bugs | 1163082, 1163080 |
milestone | 47.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java | file | annotate | diff | comparison | revisions |
--- a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java +++ b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java @@ -638,17 +638,17 @@ public class Distribution { } /** * @return true if we copied files out of the APK. Sets distributionDir in that case. */ private boolean copyAndCheckAPKDistribution() { try { // First, try copying distribution files out of the APK. - if (copyFiles()) { + if (copyFilesFromPackagedAssets()) { // We always copy to the data dir, and we only copy files from // a 'distribution' subdirectory. Now determine our actual distribution directory. return checkDataDistribution(); } } catch (IOException e) { Log.e(LOGTAG, "Error copying distribution files from APK.", e); } return false; @@ -713,42 +713,48 @@ public class Distribution { writeStream(jar, outFile, entry.getTime(), buffer); } return distributionSet; } /** - * Copies the /distribution folder out of the APK and into the app's data directory. + * Copies the /assets/distribution folder out of the APK and into the app's data directory. * Returns true if distribution files were found and copied. */ - private boolean copyFiles() throws IOException { + private boolean copyFilesFromPackagedAssets() throws IOException { final File applicationPackage = new File(packagePath); final ZipFile zip = new ZipFile(applicationPackage); + final String assetsPrefix = "assets/"; + final String fullPrefix = assetsPrefix + DISTRIBUTION_PATH; + boolean distributionSet = false; try { final byte[] buffer = new byte[1024]; final Enumeration<? extends ZipEntry> zipEntries = zip.entries(); while (zipEntries.hasMoreElements()) { final ZipEntry fileEntry = zipEntries.nextElement(); final String name = fileEntry.getName(); if (fileEntry.isDirectory()) { // We'll let getDataFile deal with creating the directory hierarchy. continue; } - if (!name.startsWith(DISTRIBUTION_PATH)) { + // Read from "assets/distribution/**". + if (!name.startsWith(fullPrefix)) { continue; } - final File outFile = getDataFile(name); + // Write to "distribution/**". + final String nameWithoutPrefix = name.substring(assetsPrefix.length()); + final File outFile = getDataFile(nameWithoutPrefix); if (outFile == null) { continue; } distributionSet = true; final InputStream fileStream = zip.getInputStream(fileEntry); try {