From ce5980a9f7a2807ce8089bf9f35f71dbc479e536 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Fri, 9 May 2014 19:19:14 -0700 Subject: [PATCH] Bug 965371 - Part 2: report device type and attributes. r=mcomella --- .../base/health/BrowserHealthRecorder.java | 8 +++++++- .../base/health/BrowserHealthReporter.java | 20 +++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/health/BrowserHealthRecorder.java b/mobile/android/base/health/BrowserHealthRecorder.java index 420d71b25862..08664196052e 100644 --- a/mobile/android/base/health/BrowserHealthRecorder.java +++ b/mobile/android/base/health/BrowserHealthRecorder.java @@ -27,7 +27,9 @@ import org.mozilla.gecko.Distribution.DistributionDescriptor; import org.mozilla.gecko.EventDispatcher; import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoEvent; +import org.mozilla.gecko.background.healthreport.AndroidConfigurationProvider; import org.mozilla.gecko.background.healthreport.EnvironmentBuilder; +import org.mozilla.gecko.background.healthreport.EnvironmentBuilder.ConfigurationProvider; import org.mozilla.gecko.background.healthreport.HealthReportDatabaseStorage; import org.mozilla.gecko.background.healthreport.HealthReportStorage.Field; import org.mozilla.gecko.background.healthreport.HealthReportStorage.MeasurementFields; @@ -89,6 +91,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener private ContentProviderClient client; private volatile HealthReportDatabaseStorage storage; private final ProfileInformationCache profileCache; + private final ConfigurationProvider configProvider; private final EventDispatcher dispatcher; private final SharedPreferences prefs; @@ -155,6 +158,8 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener Log.e(LOG_TAG, "Exception initializing.", e); } + this.configProvider = new AndroidConfigurationProvider(context); + this.prefs = appPrefs; } @@ -290,7 +295,8 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener return -1; } return this.env = EnvironmentBuilder.registerCurrentEnvironment(this.storage, - this.profileCache); + this.profileCache, + this.configProvider); } private static final String getTimesPath(final String profilePath) { diff --git a/mobile/android/base/health/BrowserHealthReporter.java b/mobile/android/base/health/BrowserHealthReporter.java index df3c25478993..6324aad7f074 100644 --- a/mobile/android/base/health/BrowserHealthReporter.java +++ b/mobile/android/base/health/BrowserHealthReporter.java @@ -5,26 +5,25 @@ package org.mozilla.gecko.health; -import android.content.ContentProviderClient; -import android.content.Context; -import android.util.Log; - +import org.json.JSONException; +import org.json.JSONObject; import org.mozilla.gecko.EventDispatcher; import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoEvent; import org.mozilla.gecko.GeckoProfile; - -import org.mozilla.gecko.background.healthreport.EnvironmentBuilder; import org.mozilla.gecko.background.common.GlobalConstants; +import org.mozilla.gecko.background.healthreport.AndroidConfigurationProvider; +import org.mozilla.gecko.background.healthreport.EnvironmentBuilder; +import org.mozilla.gecko.background.healthreport.EnvironmentBuilder.ConfigurationProvider; import org.mozilla.gecko.background.healthreport.HealthReportConstants; import org.mozilla.gecko.background.healthreport.HealthReportDatabaseStorage; import org.mozilla.gecko.background.healthreport.HealthReportGenerator; - import org.mozilla.gecko.util.GeckoEventListener; import org.mozilla.gecko.util.ThreadUtils; -import org.json.JSONException; -import org.json.JSONObject; +import android.content.ContentProviderClient; +import android.content.Context; +import android.util.Log; /** * BrowserHealthReporter is the browser's interface to the Firefox Health @@ -89,7 +88,8 @@ public class BrowserHealthReporter implements GeckoEventListener { } HealthReportGenerator generator = new HealthReportGenerator(storage); - JSONObject report = generator.generateDocument(since, lastPingTime, profilePath); + ConfigurationProvider configProvider = new AndroidConfigurationProvider(context); + JSONObject report = generator.generateDocument(since, lastPingTime, profilePath, configProvider); if (report == null) { throw new IllegalStateException("Not enough profile information to generate report."); }