Bug 1234629 - Pre: Make Distribution look in /data/data/.../distribution first. r?rnewman
Call a distribution in /data/data/.../distribution a "data
distribution". Right now we read data distributions only in response
to writing them via another code path (extracting from APK, or
downloading). We don't recognize a data distribution in the same way
that we recognize a system distribution (in /system/.../distribution)
in the Java code, simply because we don't look for it; and I haven't
investigated, but I think the Gecko may in fact recognize a data
distribution in this case.
This patch simply recognizes data distributions before looking for
other distributions. That way data distributions written by the
bouncer APK are recognized and initialized.
--- a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
+++ b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
@@ -458,18 +458,20 @@ public class Distribution {
// We've done the work once; don't do it again.
if (this.state == STATE_SET) {
// Note that we don't compute the distribution directory.
// Call `ensureDistributionDir` if you need it.
runReadyQueue();
return true;
}
- // We try the install intent, then the APK, then the system directory.
+ // We try to find an already copied distribution, then the install intent, then the APK,
+ // then the system directory. Already copied might originate from the bouncer APK.
final boolean distributionSet =
+ checkDataDistribution() ||
checkIntentDistribution(referrer) ||
copyAndCheckAPKDistribution() ||
checkSystemDistribution();
// If this is our first run -- and thus we weren't already in STATE_NONE or STATE_SET above --
// and we didn't find a distribution already, then we should hold on to callbacks in case we
// get a late distribution.
this.shouldDelayLateCallbacks = !distributionSet;