зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1273689 - Move session measurement calls to CorePingDelegate. r=sebastian
MozReview-Commit-ID: EPLUd5Uq0Pc --HG-- extra : rebase_source : ad7f650414c15ac44b64acb371a04f3cfea3d0e2
This commit is contained in:
Родитель
3013ee94dd
Коммит
9022a32d3c
|
@ -79,7 +79,6 @@ import org.mozilla.gecko.tabs.TabsPanel;
|
|||
import org.mozilla.gecko.telemetry.TelemetryUploadService;
|
||||
import org.mozilla.gecko.telemetry.TelemetryCorePingUploadDelegate;
|
||||
import org.mozilla.gecko.telemetry.measurements.SearchCountMeasurements;
|
||||
import org.mozilla.gecko.telemetry.measurements.SessionMeasurements;
|
||||
import org.mozilla.gecko.toolbar.AutocompleteHandler;
|
||||
import org.mozilla.gecko.toolbar.BrowserToolbar;
|
||||
import org.mozilla.gecko.toolbar.BrowserToolbar.TabEditingState;
|
||||
|
@ -316,8 +315,6 @@ public class BrowserApp extends GeckoApp
|
|||
@NonNull
|
||||
private SearchEngineManager mSearchEngineManager; // Contains reference to Context - DO NOT LEAK!
|
||||
|
||||
private final SessionMeasurements mSessionMeasurements = new SessionMeasurements();
|
||||
|
||||
private boolean mHasResumed;
|
||||
|
||||
@Override
|
||||
|
@ -1001,7 +998,6 @@ public class BrowserApp extends GeckoApp
|
|||
|
||||
// Needed for Adjust to get accurate session measurements
|
||||
AdjustConstants.getAdjustHelper().onResume();
|
||||
mSessionMeasurements.recordSessionStart();
|
||||
|
||||
if (!mHasResumed) {
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener) this,
|
||||
|
@ -1026,10 +1022,6 @@ public class BrowserApp extends GeckoApp
|
|||
// Needed for Adjust to get accurate session measurements
|
||||
AdjustConstants.getAdjustHelper().onPause();
|
||||
|
||||
// onStart/onStop is ideal over onResume/onPause. However, onStop is not guaranteed to be called and
|
||||
// dealing with that possibility adds a lot of complexity that we don't want to handle at this point.
|
||||
mSessionMeasurements.recordSessionEnd(this);
|
||||
|
||||
if (mHasResumed) {
|
||||
// Register for Prompt:ShowTop so we can foreground this activity even if it's hidden.
|
||||
EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener) this,
|
||||
|
@ -3915,10 +3907,6 @@ public class BrowserApp extends GeckoApp
|
|||
return mSearchEngineManager;
|
||||
}
|
||||
|
||||
public SessionMeasurements getSessionMeasurementDelegate() {
|
||||
return mSessionMeasurements;
|
||||
}
|
||||
|
||||
// For use from tests only.
|
||||
@RobocopTarget
|
||||
public ReadingListHelper getReadingListHelper() {
|
||||
|
|
|
@ -34,6 +34,7 @@ public class TelemetryCorePingUploadDelegate extends BrowserAppDelegate {
|
|||
"Gecko" + TelemetryCorePingUploadDelegate.class.getSimpleName(), 0, 23);
|
||||
|
||||
private TelemetryDispatcher telemetryDispatcher; // lazy
|
||||
private final SessionMeasurements sessionMeasurements = new SessionMeasurements();
|
||||
|
||||
@Override
|
||||
public void onStart(final BrowserApp browserApp) {
|
||||
|
@ -49,6 +50,18 @@ public class TelemetryCorePingUploadDelegate extends BrowserAppDelegate {
|
|||
searchEngineManager.getEngine(new UploadTelemetryCorePingCallback(browserApp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(BrowserApp browserApp) {
|
||||
sessionMeasurements.recordSessionStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause(BrowserApp browserApp) {
|
||||
// onStart/onStop is ideal over onResume/onPause. However, onStop is not guaranteed to be called and
|
||||
// dealing with that possibility adds a lot of complexity that we don't want to handle at this point.
|
||||
sessionMeasurements.recordSessionEnd(browserApp);
|
||||
}
|
||||
|
||||
@WorkerThread // via constructor
|
||||
private TelemetryDispatcher getTelemetryDispatcher(final BrowserApp browserApp) {
|
||||
if (telemetryDispatcher == null) {
|
||||
|
@ -107,7 +120,7 @@ public class TelemetryCorePingUploadDelegate extends BrowserAppDelegate {
|
|||
// Each profile can have different telemetry data so we intentionally grab the shared prefs for the profile.
|
||||
final SharedPreferences sharedPrefs = getSharedPreferences(activity);
|
||||
final SessionMeasurements.SessionMeasurementsContainer sessionMeasurementsContainer =
|
||||
activity.getSessionMeasurementDelegate().getAndResetSessionMeasurements(activity);
|
||||
sessionMeasurements.getAndResetSessionMeasurements(activity);
|
||||
final TelemetryCorePingBuilder pingBuilder = new TelemetryCorePingBuilder(activity)
|
||||
.setClientID(clientID)
|
||||
.setDefaultSearchEngine(TelemetryCorePingBuilder.getEngineIdentifier(engine))
|
||||
|
|
Загрузка…
Ссылка в новой задаче