Clearcut: Get rid of log spam due to missing fields in tracking function

This commit is contained in:
Marvin W 2021-07-04 14:48:44 +02:00
parent 659ece03b4
commit 60d26b80eb
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
6 changed files with 79 additions and 42 deletions

View File

@ -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;
}

View File

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

View File

@ -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<ExperimentToken> CREATOR = new AutoCreator<>(ExperimentToken.class);
}

View File

@ -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<GenericDimension> CREATOR = new AutoCreator<>(GenericDimension.class);
}

View File

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

View File

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