Bug 1418193 - Display MMA device id in about:config. r?maliu
MozReview-Commit-ID: LuHPuFbZneu
--- a/mobile/android/base/java/org/mozilla/gecko/mma/MmaDelegate.java
+++ b/mobile/android/base/java/org/mozilla/gecko/mma/MmaDelegate.java
@@ -14,16 +14,17 @@ import android.content.pm.PackageManager
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import org.mozilla.gecko.Experiments;
import org.mozilla.gecko.MmaConstants;
+import org.mozilla.gecko.PrefsHelper;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.fxa.FirefoxAccounts;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.push.PushManager;
import org.mozilla.gecko.switchboard.SwitchBoard;
import org.mozilla.gecko.util.ContextUtils;
@@ -69,17 +70,19 @@ public class MmaDelegate {
public static void init(Activity activity) {
applicationContext = new WeakReference<>(activity.getApplicationContext());
// Since user attributes are gathered in Fennec, not in MMA implementation,
// we gather the information here then pass to mmaHelper.init()
// Note that generateUserAttribute always return a non null HashMap.
final Map<String, Object> attributes = gatherUserAttributes(activity);
mmaHelper.setGcmSenderId(PushManager.getSenderIds());
- mmaHelper.setDeviceId(getDeviceId(activity));
+ final String deviceId = getDeviceId(activity);
+ mmaHelper.setDeviceId(deviceId);
+ PrefsHelper.setPref(GeckoPreferences.PREFS_MMA_DEVICE_ID, deviceId);
// above two config setup required to be invoked before mmaHelper.init.
mmaHelper.init(activity, attributes);
if (!isDefaultBrowser(activity)) {
mmaHelper.event(MmaDelegate.LAUNCH_BUT_NOT_DEFAULT_BROWSER);
}
mmaHelper.event(MmaDelegate.LAUNCH_BROWSER);
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -172,16 +172,17 @@ public class GeckoPreferences
public static final String PREFS_RESTORE_SESSION_ONCE = "browser.sessionstore.resume_session_once";
public static final String PREFS_TAB_QUEUE = NON_PREF_PREFIX + "tab_queue";
public static final String PREFS_TAB_QUEUE_LAST_SITE = NON_PREF_PREFIX + "last_site";
public static final String PREFS_TAB_QUEUE_LAST_TIME = NON_PREF_PREFIX + "last_time";
private static final String PREFS_DYNAMIC_TOOLBAR = "browser.chrome.dynamictoolbar";
public static final String PREFS_SHUTDOWN_INTENT = "app.shutdownintent.enabled";
+ public static final String PREFS_MMA_DEVICE_ID = "mma.device_id";
// These values are chosen to be distinct from other Activity constants.
private static final int REQUEST_CODE_PREF_SCREEN = 5;
private static final int RESULT_CODE_EXIT_SETTINGS = 6;
// Result code used when a locale preference changes.
// Callers can recognize this code to refresh themselves to
// accommodate a locale change.