Skip to content

Commit

Permalink
Backed out changeset 91bc05242c6f (bug 1534451) for causing Advertisi…
Browse files Browse the repository at this point in the history
…ngUtil.java build bustages CLOSED TREE
  • Loading branch information
SV-ACiure committed May 13, 2019
1 parent b597c1d commit 126ca52
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 359 deletions.
3 changes: 0 additions & 3 deletions mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ android {
if (!mozconfig.substs.MOZ_ANDROID_GCM) {
exclude 'org/mozilla/gecko/gcm/**/*.java'
exclude 'org/mozilla/gecko/push/**/*.java'
exclude 'org/mozilla/gecko/advertising/**'
}
}
resources {
Expand Down Expand Up @@ -245,8 +244,6 @@ dependencies {
implementation "com.google.android.gms:play-services-basement:$google_play_services_version"
implementation "com.google.android.gms:play-services-base:$google_play_services_version"
implementation "com.google.android.gms:play-services-gcm:$google_play_services_version"
implementation "com.google.android.gms:play-services-ads-identifier:$google_play_services_version"
implementation "org.mindrot:jbcrypt:0.4"
}

if (mozconfig.substs.MOZ_ANDROID_GOOGLE_PLAY_SERVICES) {
Expand Down
3 changes: 0 additions & 3 deletions mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
import org.mozilla.gecko.telemetry.TelemetryCorePingDelegate;
import org.mozilla.gecko.telemetry.TelemetryUploadService;
import org.mozilla.gecko.telemetry.measurements.SearchCountMeasurements;
import org.mozilla.gecko.telemetry.TelemetryActivationPingDelegate;
import org.mozilla.gecko.toolbar.AutocompleteHandler;
import org.mozilla.gecko.toolbar.BrowserToolbar;
import org.mozilla.gecko.toolbar.BrowserToolbar.CommitEventSource;
Expand Down Expand Up @@ -319,15 +318,13 @@ public float getInterpolation(float t) {
private final DynamicToolbar mDynamicToolbar = new DynamicToolbar();

private final TelemetryCorePingDelegate mTelemetryCorePingDelegate = new TelemetryCorePingDelegate();
private final TelemetryActivationPingDelegate mTelemetryActivationPingDelegate = new TelemetryActivationPingDelegate();

private final List<BrowserAppDelegate> delegates = Collections.unmodifiableList(Arrays.asList(
new ScreenshotDelegate(),
new BookmarkStateChangeDelegate(),
new ReaderViewBookmarkPromotion(),
new PostUpdateHandler(),
mTelemetryCorePingDelegate,
mTelemetryActivationPingDelegate,
new OfflineTabStatusDelegate(),
new AdjustBrowserAppDelegate(mTelemetryCorePingDelegate)
));
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.adjust.AttributionHelperListener;
import org.mozilla.gecko.telemetry.measurements.CampaignIdMeasurements;
import org.mozilla.gecko.delegates.BrowserAppDelegateWithReference;
import org.mozilla.gecko.distribution.DistributionStoreCallback;
import org.mozilla.gecko.search.SearchEngineManager;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.telemetry.measurements.CampaignIdMeasurements;
import org.mozilla.gecko.telemetry.measurements.SearchCountMeasurements;
import org.mozilla.gecko.telemetry.measurements.SessionMeasurements;
import org.mozilla.gecko.telemetry.pingbuilders.TelemetryCorePingBuilder;
Expand Down Expand Up @@ -139,43 +139,47 @@ public void execute(@Nullable final org.mozilla.gecko.search.SearchEngine engine
// the first launch of the activity doesn't trigger profile init too early.
//
// Additionally, getAndIncrementSequenceNumber must be called from a worker thread.
ThreadUtils.postToBackgroundThread(() -> {
final BrowserApp activity = getBrowserApp();
if (activity == null) {
return;
}

final GeckoProfile profile = GeckoThread.getActiveProfile();
if (!TelemetryUploadService.isUploadEnabledByProfileConfig(activity, profile)) {
Log.d(LOGTAG, "Core ping upload disabled by profile config. Returning.");
return;
}

final String clientID;
final boolean hadCanaryClientId;
try {
clientID = profile.getClientId();
hadCanaryClientId = profile.getIfHadCanaryClientId();
} catch (final IOException e) {
Log.w(LOGTAG, "Unable to get client ID properties to generate core ping: " + e);
return;
ThreadUtils.postToBackgroundThread(new Runnable() {
@WorkerThread
@Override
public void run() {
final BrowserApp activity = getBrowserApp();
if (activity == null) {
return;
}

final GeckoProfile profile = GeckoThread.getActiveProfile();
if (!TelemetryUploadService.isUploadEnabledByProfileConfig(activity, profile)) {
Log.d(LOGTAG, "Core ping upload disabled by profile config. Returning.");
return;
}

final String clientID;
final boolean hadCanaryClientId;
try {
clientID = profile.getClientId();
hadCanaryClientId = profile.getIfHadCanaryClientId();
} catch (final IOException e) {
Log.w(LOGTAG, "Unable to get client ID properties to generate core ping: " + e);
return;
}

// 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 =
sessionMeasurements.getAndResetSessionMeasurements(activity);
final TelemetryCorePingBuilder pingBuilder = new TelemetryCorePingBuilder(activity)
.setClientID(clientID)
.setHadCanaryClientId(hadCanaryClientId)
.setDefaultSearchEngine(TelemetryCorePingBuilder.getEngineIdentifier(engine))
.setProfileCreationDate(TelemetryCorePingBuilder.getProfileCreationDate(activity, profile))
.setSequenceNumber(TelemetryCorePingBuilder.getAndIncrementSequenceNumber(sharedPrefs))
.setSessionCount(sessionMeasurementsContainer.sessionCount)
.setSessionDuration(sessionMeasurementsContainer.elapsedSeconds);
maybeSetOptionalMeasurements(activity, sharedPrefs, pingBuilder);

getTelemetryDispatcher(activity).queuePingForUpload(activity, pingBuilder);
}

// 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 =
sessionMeasurements.getAndResetSessionMeasurements(activity);
final TelemetryCorePingBuilder pingBuilder = new TelemetryCorePingBuilder(activity)
.setClientID(clientID)
.setHadCanaryClientId(hadCanaryClientId)
.setDefaultSearchEngine(TelemetryCorePingBuilder.getEngineIdentifier(engine))
.setProfileCreationDate(TelemetryCorePingBuilder.getProfileCreationDate(activity, profile))
.setSequenceNumber(TelemetryCorePingBuilder.getAndIncrementSequenceNumber(sharedPrefs))
.setSessionCount(sessionMeasurementsContainer.sessionCount)
.setSessionDuration(sessionMeasurementsContainer.elapsedSeconds);
maybeSetOptionalMeasurements(activity, sharedPrefs, pingBuilder);

getTelemetryDispatcher(activity).queuePingForUpload(activity, pingBuilder);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import android.content.Context;
import android.support.annotation.WorkerThread;
import android.util.Log;

import org.mozilla.gecko.telemetry.pingbuilders.TelemetryActivationPingBuilder;
import org.mozilla.gecko.telemetry.pingbuilders.TelemetryCorePingBuilder;
import org.mozilla.gecko.telemetry.pingbuilders.TelemetryCrashPingBuilder;
import org.mozilla.gecko.telemetry.schedulers.TelemetryUploadScheduler;
Expand Down Expand Up @@ -92,14 +90,6 @@ public void queuePingForUpload(final Context context, final TelemetryCorePingBui
queuePingForUpload(context, ping, coreStore, uploadAllPingsImmediatelyScheduler);
}

/**
* Queues the given ping for upload and potentially schedules upload. This method can be called from any thread.
*/
public void queuePingForUpload(final Context context, final TelemetryActivationPingBuilder pingBuilder) {
final TelemetryOutgoingPing ping = pingBuilder.build();
queuePingForUpload(context, ping, coreStore, uploadAllPingsImmediatelyScheduler);
}

/**
* Queues the given crash ping for upload and potentially schedules upload. This method can be called from any thread.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.BaseResourceDelegate;
import org.mozilla.gecko.sync.net.Resource;
import org.mozilla.gecko.telemetry.pingbuilders.TelemetryActivationPingBuilder;
import org.mozilla.gecko.telemetry.stores.TelemetryPingStore;
import org.mozilla.gecko.util.DateUtil;
import org.mozilla.gecko.util.NetworkUtils;
Expand Down Expand Up @@ -126,8 +125,6 @@ private static boolean uploadPendingPingsFromStore(final Context context, final
if (delegate.hadConnectionError()) {
break;
}

checkPingsPersistence(context, ping.getDocID());
}

final boolean wereAllUploadsSuccessful = !delegate.hadConnectionError();
Expand All @@ -139,23 +136,6 @@ private static boolean uploadPendingPingsFromStore(final Context context, final
return wereAllUploadsSuccessful;
}

/**
* Check if we have any pings that need to persist their succesful upload status in order to prevent further attempts.
* E.g. {@link TelemetryActivationPingBuilder}
* @param context
*/
private static void checkPingsPersistence(Context context, String successfulUploadID) {
final String activationID = TelemetryActivationPingBuilder.getActivationPingId(context);

if(activationID == null) {
return;
}

if(activationID.equals(successfulUploadID)) {
TelemetryActivationPingBuilder.setActivationPingSent(context, true);
}
}

private static void uploadPayload(final String url, final ExtendedJSONObject payload, final ResultDelegate delegate) {
final BaseResource resource;
try {
Expand Down
Loading

0 comments on commit 126ca52

Please sign in to comment.