protected void updateServersFromIntentExtras(Intent intent) {
    // Start with defaults.
    this.authServerEndpoint = FxAccountConstants.DEFAULT_AUTH_SERVER_ENDPOINT;
    this.syncServerEndpoint = FxAccountConstants.DEFAULT_TOKEN_SERVER_ENDPOINT;

    if (intent == null) {
      Logger.warn(LOG_TAG, "Intent is null; ignoring and using default servers.");
      return;
    }

    final String extrasString = intent.getStringExtra(EXTRA_EXTRAS);

    if (extrasString == null) {
      return;
    }

    final ExtendedJSONObject extras;
    final ExtendedJSONObject services;
    try {
      extras = new ExtendedJSONObject(extrasString);
      services = extras.getObject(JSON_KEY_SERVICES);
    } catch (Exception e) {
      Logger.warn(LOG_TAG, "Got exception parsing extras; ignoring and using default servers.");
      return;
    }

    String authServer = extras.getString(JSON_KEY_AUTH);
    String syncServer = services == null ? null : services.getString(JSON_KEY_SYNC);

    if (authServer != null) {
      this.authServerEndpoint = authServer;
    }
    if (syncServer != null) {
      this.syncServerEndpoint = syncServer;
    }

    if (FxAccountConstants.DEFAULT_TOKEN_SERVER_ENDPOINT.equals(syncServerEndpoint)
        && !FxAccountConstants.DEFAULT_AUTH_SERVER_ENDPOINT.equals(authServerEndpoint)) {
      // We really don't want to hard-code assumptions about server
      // configurations into client code in such a way that if and when the
      // situation is relaxed, the client code stops valid usage. Instead, we
      // warn. This configuration should present itself as an auth exception at
      // Sync time.
      Logger.warn(
          LOG_TAG,
          "Mozilla's Sync token servers only works with Mozilla's auth servers. Sync will likely be mis-configured.");
    }
  }
 protected void updateSyncServerPreference() {
   final String syncServer = fxAccount.getTokenServerURI();
   final boolean shouldBeShown =
       ALWAYS_SHOW_SYNC_SERVER
           || !FxAccountConstants.DEFAULT_TOKEN_SERVER_ENDPOINT.equals(syncServer);
   final boolean currentlyShown = null != findPreference(syncServerPreference.getKey());
   if (currentlyShown != shouldBeShown) {
     if (shouldBeShown) {
       syncCategory.addPreference(syncServerPreference);
     } else {
       syncCategory.removePreference(syncServerPreference);
     }
   }
   // Always set the summary, because on first run, the preference is visible,
   // and the above block will be skipped if there is a custom value.
   syncServerPreference.setSummary(syncServer);
 }
  protected void updateCustomServerView() {
    final boolean shouldShow =
        ALWAYS_SHOW_CUSTOM_SERVER_LAYOUT
            || !FxAccountConstants.DEFAULT_AUTH_SERVER_ENDPOINT.equals(authServerEndpoint)
            || !FxAccountConstants.DEFAULT_TOKEN_SERVER_ENDPOINT.equals(syncServerEndpoint);

    if (!shouldShow) {
      setCustomServerViewVisibility(View.GONE);
      return;
    }

    final TextView authServerView =
        (TextView) ensureFindViewById(null, R.id.account_server_summary, "account server");
    final TextView syncServerView =
        (TextView) ensureFindViewById(null, R.id.sync_server_summary, "Sync server");
    authServerView.setText(authServerEndpoint);
    syncServerView.setText(syncServerEndpoint);

    setCustomServerViewVisibility(View.VISIBLE);
  }