Bug 1323759 - To ensure distribution is initialized draft
authorJulian_Chu <walkingice0204@gmail.com>
Mon, 19 Dec 2016 14:25:14 +0800
changeset 456751 6ab7c7812f4c0986432cc423ea429958d108ce26
parent 449801 7652a58efa46f1c57c94bba26efc5d53b6184e83
child 541308 91c0a33e340949406f9cfbc30cc8d9dddc80b1c1
push id40588
push userbmo:walkingice0204@gmail.com
push dateFri, 06 Jan 2017 04:38:32 +0000
bugs1323759
milestone53.0a1
Bug 1323759 - To ensure distribution is initialized 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) {