From 60d26b80eb4d618e5bfbd6eaa9f201a0febf534a Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 4 Jul 2021 14:48:44 +0200 Subject: [PATCH] Clearcut: Get rid of log spam due to missing fields in tracking function --- .../internal/IClearcutLoggerCallbacks.aidl | 2 +- .../gms/clearcut/LogEventParcelable.java | 28 ++++++--- .../gms/phenotype/ExperimentToken.java | 12 ++++ .../gms/phenotype/GenericDimension.java | 17 ++++++ .../playlog/internal/PlayLoggerContext.java | 60 +++++++++---------- .../clearcut/ClearcutLoggerServiceImpl.java | 2 +- 6 files changed, 79 insertions(+), 42 deletions(-) create mode 100644 play-services-api/src/main/java/com/google/android/gms/phenotype/ExperimentToken.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/phenotype/GenericDimension.java diff --git a/play-services-api/src/main/aidl/com/google/android/gms/clearcut/internal/IClearcutLoggerCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/clearcut/internal/IClearcutLoggerCallbacks.aidl index 58e796ef..31042db8 100644 --- a/play-services-api/src/main/aidl/com/google/android/gms/clearcut/internal/IClearcutLoggerCallbacks.aidl +++ b/play-services-api/src/main/aidl/com/google/android/gms/clearcut/internal/IClearcutLoggerCallbacks.aidl @@ -3,5 +3,5 @@ package com.google.android.gms.clearcut.internal; import com.google.android.gms.common.api.Status; interface IClearcutLoggerCallbacks { - void onStatus(in Status status) = 0; + oneway void onStatus(in Status status) = 0; } diff --git a/play-services-api/src/main/java/com/google/android/gms/clearcut/LogEventParcelable.java b/play-services-api/src/main/java/com/google/android/gms/clearcut/LogEventParcelable.java index 81042a97..6ff57373 100644 --- a/play-services-api/src/main/java/com/google/android/gms/clearcut/LogEventParcelable.java +++ b/play-services-api/src/main/java/com/google/android/gms/clearcut/LogEventParcelable.java @@ -18,6 +18,8 @@ package com.google.android.gms.clearcut; import android.util.Base64; +import com.google.android.gms.phenotype.ExperimentToken; +import com.google.android.gms.phenotype.GenericDimension; import com.google.android.gms.playlog.internal.PlayLoggerContext; import org.microg.safeparcel.AutoSafeParcelable; @@ -30,30 +32,36 @@ import java.nio.charset.CharsetDecoder; import java.util.Arrays; public class LogEventParcelable extends AutoSafeParcelable { - @SafeParceled(1) + @Field(1) private int versionCode = 1; - @SafeParceled(2) + @Field(2) public final PlayLoggerContext context; - @SafeParceled(3) + @Field(3) public final byte[] bytes; - @SafeParceled(4) + @Field(4) public final int[] testCodes; - @SafeParceled(5) + @Field(5) public final String[] mendelPackages; - @SafeParceled(6) + @Field(6) public final int[] experimentIds; - @SafeParceled(7) + @Field(7) public final byte[][] experimentTokens; - @SafeParceled(8) + @Field(8) public final boolean addPhenotypeExperimentTokens; + @Field(9) + public final ExperimentToken[] experimentTokenParcelables; + + @Field(10) + public final GenericDimension[] genericDimensions; + private LogEventParcelable() { context = null; bytes = null; @@ -61,6 +69,8 @@ public class LogEventParcelable extends AutoSafeParcelable { mendelPackages = null; experimentTokens = null; addPhenotypeExperimentTokens = false; + experimentTokenParcelables = null; + genericDimensions = null; } public LogEventParcelable(PlayLoggerContext context, byte[] bytes, int[] testCodes, String[] mendelPackages, int[] experimentIds, byte[][] experimentTokens, boolean addPhenotypeExperimentTokens) { @@ -71,6 +81,8 @@ public class LogEventParcelable extends AutoSafeParcelable { this.experimentIds = experimentIds; this.experimentTokens = experimentTokens; this.addPhenotypeExperimentTokens = addPhenotypeExperimentTokens; + this.experimentTokenParcelables = null; + this.genericDimensions = null; } @Override diff --git a/play-services-api/src/main/java/com/google/android/gms/phenotype/ExperimentToken.java b/play-services-api/src/main/java/com/google/android/gms/phenotype/ExperimentToken.java new file mode 100644 index 00000000..0d618f2f --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/phenotype/ExperimentToken.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.phenotype; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ExperimentToken extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(ExperimentToken.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/phenotype/GenericDimension.java b/play-services-api/src/main/java/com/google/android/gms/phenotype/GenericDimension.java new file mode 100644 index 00000000..f10f83c0 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/phenotype/GenericDimension.java @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.phenotype; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class GenericDimension extends AutoSafeParcelable { + @Field(1) + public int a; + @Field(2) + public int b; + + public static final Creator CREATOR = new AutoCreator<>(GenericDimension.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/playlog/internal/PlayLoggerContext.java b/play-services-api/src/main/java/com/google/android/gms/playlog/internal/PlayLoggerContext.java index ca31fb9b..7f793740 100644 --- a/play-services-api/src/main/java/com/google/android/gms/playlog/internal/PlayLoggerContext.java +++ b/play-services-api/src/main/java/com/google/android/gms/playlog/internal/PlayLoggerContext.java @@ -21,55 +21,49 @@ import org.microg.safeparcel.SafeParceled; public class PlayLoggerContext extends AutoSafeParcelable { - @SafeParceled(1) + @Field(1) private int versionCode = 1; - @SafeParceled(2) + @Field(2) public final String packageName; - @SafeParceled(3) + @Field(3) public final int packageVersionCode; - @SafeParceled(4) + @Field(4) public final int logSource; - @SafeParceled(5) - public final String uploadAccount; - - @SafeParceled(6) - public final int loggingId; - - @SafeParceled(7) - public final boolean logAndroidId; - - @SafeParceled(8) + @Field(8) public final String logSourceName; - @SafeParceled(9) + @Field(5) + public final String uploadAccount; + + @Field(6) + public final String loggingId; + + @Field(7) + public final boolean logAndroidId; + + @Field(9) public final boolean isAnonymous; - @SafeParceled(10) + @Field(10) public final int qosTier; + @Field(11) + public final Integer appMobileSpecId; + + @Field(12) + public final boolean scrubMccMnc; + private PlayLoggerContext() { - packageName = uploadAccount = logSourceName = null; - qosTier = packageVersionCode = logSource = loggingId = -1; - isAnonymous = logAndroidId = false; + packageName = uploadAccount = logSourceName = loggingId = null; + qosTier = packageVersionCode = logSource = appMobileSpecId = -1; + isAnonymous = logAndroidId = scrubMccMnc = false; } - public PlayLoggerContext(String packageName, int packageVersionCode, int logSource, String uploadAccount, int loggingId, boolean logAndroidId) { - this.packageName = packageName; - this.packageVersionCode = packageVersionCode; - this.logSource = logSource; - this.logSourceName = null; - this.uploadAccount = uploadAccount; - this.loggingId = loggingId; - this.logAndroidId = logAndroidId; - this.isAnonymous = false; - this.qosTier = 0; - } - - public PlayLoggerContext(String packageName, int packageVersionCode, int logSource, String logSourceName, String uploadAccount, int loggingId, boolean isAnonymous, int qosTier) { + public PlayLoggerContext(String packageName, int packageVersionCode, int logSource, String logSourceName, String uploadAccount, String loggingId, boolean isAnonymous, int qosTier, boolean scrubMccMnc) { this.packageName = packageName; this.packageVersionCode = packageVersionCode; this.logSource = logSource; @@ -79,6 +73,8 @@ public class PlayLoggerContext extends AutoSafeParcelable { this.logAndroidId = !isAnonymous; this.isAnonymous = isAnonymous; this.qosTier = qosTier; + this.appMobileSpecId = null; + this.scrubMccMnc = scrubMccMnc; } @Override diff --git a/play-services-core/src/main/java/org/microg/gms/clearcut/ClearcutLoggerServiceImpl.java b/play-services-core/src/main/java/org/microg/gms/clearcut/ClearcutLoggerServiceImpl.java index d5e77388..fd1a1dac 100644 --- a/play-services-core/src/main/java/org/microg/gms/clearcut/ClearcutLoggerServiceImpl.java +++ b/play-services-core/src/main/java/org/microg/gms/clearcut/ClearcutLoggerServiceImpl.java @@ -29,7 +29,7 @@ public class ClearcutLoggerServiceImpl extends IClearcutLoggerService.Stub { @Override public void log(IClearcutLoggerCallbacks callbacks, LogEventParcelable event) throws RemoteException { - Log.d(TAG, "log: " + event); + // These logs are not really helpful for us, so let's just ignore it. try { callbacks.onStatus(Status.SUCCESS); } catch (Exception ignored) {