Bug 965371 - Part 2: report device type and attributes. r=mcomella

This commit is contained in:
Richard Newman 2014-05-09 19:19:14 -07:00
parent 9cf7154a60
commit ce5980a9f7
2 changed files with 17 additions and 11 deletions

View File

@ -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) {

View File

@ -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.");
}