Bug 1323759 - To ensure distribution is initialized r=rnewman a=jcristau, a=gchang
authorJulian_Chu <walkingice0204@gmail.com>
Mon, 19 Dec 2016 14:25:14 +0800
changeset 462179 833a4a349de0391c4f690fac337b6db18fc9e1de
parent 462178 5fb0834eba17ac8df15f2cbd34805ecada288c48
child 462180 188c8d2342ffc6340f5589be3175225d73e26b01
push id41678
push userfelipc@gmail.com
push dateMon, 16 Jan 2017 20:19:38 +0000
reviewersrnewman, jcristau, gchang
bugs1323759
milestone51.0
Bug 1323759 - To ensure distribution is initialized r=rnewman a=jcristau, a=gchang The referrer intent INSTALL_REFERRER comes after Fennec been installed. On Android 5+ we might receive the referrer intent and never actually launch the browser. Attempt to init here to handle that case. MozReview-Commit-ID: 6kDeqnNT2pS
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
@@ -292,16 +292,24 @@ public class Distribution {
 
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
                 final Distribution distribution = Distribution.getInstance(context);
 
                 // This will bail if we aren't delayed, or we already have a distribution.
                 distribution.processDelayedReferrer(ref);
+
+                // On Android 5+ we might receive the referrer intent
+                // and never actually launch the browser, which is the usual signal
+                // for the distribution init process to complete.
+                // Attempt to init here to handle that case.
+                // Profile setup that relies on the distribution will occur
+                // when the browser is eventually launched, via `addOnDistributionReadyCallback`.
+                distribution.doInit();
             }
         });
     }
 
     /**
      * Handle a referrer intent that arrives after first use of the distribution.
      */
     private void processDelayedReferrer(final ReferrerDescriptor ref) {