Example #1
0
  /** Handle a referrer intent that arrives after first use of the distribution. */
  private void processDelayedReferrer(final ReferrerDescriptor ref) {
    ThreadUtils.assertOnBackgroundThread();
    if (state != STATE_NONE) {
      return;
    }

    Log.i(LOGTAG, "Processing delayed referrer.");

    if (!checkIntentDistribution(ref)) {
      // Oh well. No sense keeping these tasks around.
      this.onLateReady.clear();
      return;
    }

    // Persist our new state.
    this.state = STATE_SET;
    getSharedPreferences().edit().putInt(getKeyName(), this.state).apply();

    // Just in case this isn't empty but doInit has finished.
    runReadyQueue();

    // Now process any tasks that already ran while we were in STATE_NONE
    // to tell them of our good news.
    runLateReadyQueue();

    // Make sure that changes to search defaults are applied immediately.
    GeckoAppShell.notifyObservers("Distribution:Changed", "");
  }