Bug 1234629 - Pre: Make Distribution look in /data/data/.../distribution first. r?rnewman draft
authorNick Alexander <nalexander@mozilla.com>
Tue, 26 Jan 2016 17:06:27 -0800
changeset 326424 59200eec0b81a56ab1ee94475643c6bd139e9d4c
parent 326423 8ece62a6fe49f2f346e8536fac397c9945b8de0f
child 326425 111e419fa2db04f74ddb36bae12fa67a6bb71398
push id10152
push usernalexander@mozilla.com
push dateWed, 27 Jan 2016 23:52:39 +0000
reviewersrnewman
bugs1234629
milestone47.0a1
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.
mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
--- 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;