- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
435 lines
18 KiB
Java
435 lines
18 KiB
Java
package com.facebook.appevents;
|
|
|
|
import android.content.SharedPreferences;
|
|
import android.os.Bundle;
|
|
import android.preference.PreferenceManager;
|
|
import android.util.Log;
|
|
import android.util.Patterns;
|
|
import androidx.annotation.RestrictTo;
|
|
import com.facebook.FacebookSdk;
|
|
import com.facebook.appevents.aam.MetadataRule;
|
|
import com.facebook.internal.Utility;
|
|
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
|
|
import com.fyber.inneractive.sdk.external.InneractiveMediationDefs;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.Regex;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes2.dex */
|
|
public final class UserDataStore {
|
|
public static final String CITY = "ct";
|
|
public static final String COUNTRY = "country";
|
|
private static final String DATA_SEPARATOR = ",";
|
|
public static final String DATE_OF_BIRTH = "db";
|
|
public static final String EMAIL = "em";
|
|
public static final String FIRST_NAME = "fn";
|
|
public static final String GENDER = "ge";
|
|
private static final String INTERNAL_USER_DATA_KEY = "com.facebook.appevents.UserDataStore.internalUserData";
|
|
public static final String LAST_NAME = "ln";
|
|
private static final int MAX_NUM = 5;
|
|
public static final String PHONE = "ph";
|
|
public static final String STATE = "st";
|
|
private static final String USER_DATA_KEY = "com.facebook.appevents.UserDataStore.userData";
|
|
public static final String ZIP = "zp";
|
|
private static SharedPreferences sharedPreferences;
|
|
public static final UserDataStore INSTANCE = new UserDataStore();
|
|
private static final String TAG = UserDataStore.class.getSimpleName();
|
|
private static final AtomicBoolean initialized = new AtomicBoolean(false);
|
|
private static final ConcurrentHashMap<String, String> externalHashedUserData = new ConcurrentHashMap<>();
|
|
private static final ConcurrentHashMap<String, String> internalHashedUserData = new ConcurrentHashMap<>();
|
|
|
|
private UserDataStore() {
|
|
}
|
|
|
|
public static final void initStore() {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (initialized.get()) {
|
|
return;
|
|
}
|
|
INSTANCE.initAndWait();
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
}
|
|
}
|
|
|
|
private final void writeDataIntoCache(final String str, final String str2) {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return;
|
|
}
|
|
try {
|
|
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.UserDataStore$$ExternalSyntheticLambda2
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
UserDataStore.m477writeDataIntoCache$lambda0(str, str2);
|
|
}
|
|
});
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: writeDataIntoCache$lambda-0, reason: not valid java name */
|
|
public static final void m477writeDataIntoCache$lambda0(String key, String value) {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return;
|
|
}
|
|
try {
|
|
Intrinsics.checkNotNullParameter(key, "$key");
|
|
Intrinsics.checkNotNullParameter(value, "$value");
|
|
if (!initialized.get()) {
|
|
INSTANCE.initAndWait();
|
|
}
|
|
SharedPreferences sharedPreferences2 = sharedPreferences;
|
|
if (sharedPreferences2 != null) {
|
|
sharedPreferences2.edit().putString(key, value).apply();
|
|
} else {
|
|
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
|
|
throw null;
|
|
}
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
}
|
|
}
|
|
|
|
public static final void setUserDataAndHash(final Bundle bundle) {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return;
|
|
}
|
|
try {
|
|
InternalAppEventsLogger.Companion.getAnalyticsExecutor().execute(new Runnable() { // from class: com.facebook.appevents.UserDataStore$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
UserDataStore.m476setUserDataAndHash$lambda1(bundle);
|
|
}
|
|
});
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: setUserDataAndHash$lambda-1, reason: not valid java name */
|
|
public static final void m476setUserDataAndHash$lambda1(Bundle bundle) {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (!initialized.get()) {
|
|
Log.w(TAG, "initStore should have been called before calling setUserData");
|
|
INSTANCE.initAndWait();
|
|
}
|
|
UserDataStore userDataStore = INSTANCE;
|
|
userDataStore.updateHashUserData(bundle);
|
|
Utility utility = Utility.INSTANCE;
|
|
userDataStore.writeDataIntoCache(USER_DATA_KEY, Utility.mapToJsonStr(externalHashedUserData));
|
|
userDataStore.writeDataIntoCache(INTERNAL_USER_DATA_KEY, Utility.mapToJsonStr(internalHashedUserData));
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
}
|
|
}
|
|
|
|
private final String normalizeData(String str, String str2) {
|
|
String str3;
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
int length = str2.length() - 1;
|
|
int i = 0;
|
|
boolean z = false;
|
|
while (i <= length) {
|
|
boolean z2 = Intrinsics.compare((int) str2.charAt(!z ? i : length), 32) <= 0;
|
|
if (z) {
|
|
if (!z2) {
|
|
break;
|
|
}
|
|
length--;
|
|
} else if (z2) {
|
|
i++;
|
|
} else {
|
|
z = true;
|
|
}
|
|
}
|
|
String obj = str2.subSequence(i, length + 1).toString();
|
|
if (obj != null) {
|
|
String lowerCase = obj.toLowerCase();
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
|
|
if (Intrinsics.areEqual(EMAIL, str)) {
|
|
if (Patterns.EMAIL_ADDRESS.matcher(lowerCase).matches()) {
|
|
return lowerCase;
|
|
}
|
|
Log.e(TAG, "Setting email failure: this is not a valid email address");
|
|
return "";
|
|
}
|
|
if (Intrinsics.areEqual(PHONE, str)) {
|
|
return new Regex("[^0-9]").replace(lowerCase, "");
|
|
}
|
|
if (!Intrinsics.areEqual(GENDER, str)) {
|
|
return lowerCase;
|
|
}
|
|
if (lowerCase.length() <= 0) {
|
|
str3 = "";
|
|
} else {
|
|
if (lowerCase == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
|
|
}
|
|
str3 = lowerCase.substring(0, 1);
|
|
Intrinsics.checkNotNullExpressionValue(str3, "(this as java.lang.Strin…ing(startIndex, endIndex)");
|
|
}
|
|
if (!Intrinsics.areEqual(InneractiveMediationDefs.GENDER_FEMALE, str3) && !Intrinsics.areEqual(InneractiveMediationDefs.GENDER_MALE, str3)) {
|
|
Log.e(TAG, "Setting gender failure: the supported value for gender is f or m");
|
|
return "";
|
|
}
|
|
return str3;
|
|
}
|
|
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final void setUserDataAndHash(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10) {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return;
|
|
}
|
|
try {
|
|
Bundle bundle = new Bundle();
|
|
if (str != null) {
|
|
bundle.putString(EMAIL, str);
|
|
}
|
|
if (str2 != null) {
|
|
bundle.putString(FIRST_NAME, str2);
|
|
}
|
|
if (str3 != null) {
|
|
bundle.putString("ln", str3);
|
|
}
|
|
if (str4 != null) {
|
|
bundle.putString(PHONE, str4);
|
|
}
|
|
if (str5 != null) {
|
|
bundle.putString(DATE_OF_BIRTH, str5);
|
|
}
|
|
if (str6 != null) {
|
|
bundle.putString(GENDER, str6);
|
|
}
|
|
if (str7 != null) {
|
|
bundle.putString(CITY, str7);
|
|
}
|
|
if (str8 != null) {
|
|
bundle.putString(STATE, str8);
|
|
}
|
|
if (str9 != null) {
|
|
bundle.putString(ZIP, str9);
|
|
}
|
|
if (str10 != null) {
|
|
bundle.putString("country", str10);
|
|
}
|
|
setUserDataAndHash(bundle);
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
}
|
|
}
|
|
|
|
public static final void clear() {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return;
|
|
}
|
|
try {
|
|
InternalAppEventsLogger.Companion.getAnalyticsExecutor().execute(new Runnable() { // from class: com.facebook.appevents.UserDataStore$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
UserDataStore.m475clear$lambda2();
|
|
}
|
|
});
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: clear$lambda-2, reason: not valid java name */
|
|
public static final void m475clear$lambda2() {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (!initialized.get()) {
|
|
Log.w(TAG, "initStore should have been called before calling setUserData");
|
|
INSTANCE.initAndWait();
|
|
}
|
|
externalHashedUserData.clear();
|
|
SharedPreferences sharedPreferences2 = sharedPreferences;
|
|
if (sharedPreferences2 != null) {
|
|
sharedPreferences2.edit().putString(USER_DATA_KEY, null).apply();
|
|
} else {
|
|
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
|
|
throw null;
|
|
}
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
}
|
|
}
|
|
|
|
public static final String getHashedUserData$facebook_core_release() {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return null;
|
|
}
|
|
try {
|
|
if (!initialized.get()) {
|
|
Log.w(TAG, "initStore should have been called before calling setUserID");
|
|
INSTANCE.initAndWait();
|
|
}
|
|
Utility utility = Utility.INSTANCE;
|
|
return Utility.mapToJsonStr(externalHashedUserData);
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final String getAllHashedUserData() {
|
|
if (CrashShieldHandler.isObjectCrashing(UserDataStore.class)) {
|
|
return null;
|
|
}
|
|
try {
|
|
if (!initialized.get()) {
|
|
INSTANCE.initAndWait();
|
|
}
|
|
HashMap hashMap = new HashMap();
|
|
hashMap.putAll(externalHashedUserData);
|
|
hashMap.putAll(INSTANCE.getEnabledInternalUserData());
|
|
return Utility.mapToJsonStr(hashMap);
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, UserDataStore.class);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private final Map<String, String> getEnabledInternalUserData() {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
HashMap hashMap = new HashMap();
|
|
Set<String> enabledRuleNames = MetadataRule.Companion.getEnabledRuleNames();
|
|
for (String str : internalHashedUserData.keySet()) {
|
|
if (enabledRuleNames.contains(str)) {
|
|
hashMap.put(str, internalHashedUserData.get(str));
|
|
}
|
|
}
|
|
return hashMap;
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private final synchronized void initAndWait() {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return;
|
|
}
|
|
try {
|
|
AtomicBoolean atomicBoolean = initialized;
|
|
if (atomicBoolean.get()) {
|
|
return;
|
|
}
|
|
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext());
|
|
Intrinsics.checkNotNullExpressionValue(defaultSharedPreferences, "getDefaultSharedPreferences(FacebookSdk.getApplicationContext())");
|
|
sharedPreferences = defaultSharedPreferences;
|
|
if (defaultSharedPreferences != null) {
|
|
String string = defaultSharedPreferences.getString(USER_DATA_KEY, "");
|
|
if (string == null) {
|
|
string = "";
|
|
}
|
|
SharedPreferences sharedPreferences2 = sharedPreferences;
|
|
if (sharedPreferences2 != null) {
|
|
String string2 = sharedPreferences2.getString(INTERNAL_USER_DATA_KEY, "");
|
|
if (string2 == null) {
|
|
string2 = "";
|
|
}
|
|
externalHashedUserData.putAll(Utility.jsonStrToMap(string));
|
|
internalHashedUserData.putAll(Utility.jsonStrToMap(string2));
|
|
atomicBoolean.set(true);
|
|
return;
|
|
}
|
|
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
|
|
throw null;
|
|
}
|
|
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
|
|
throw null;
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
}
|
|
}
|
|
|
|
private final void updateHashUserData(Bundle bundle) {
|
|
if (CrashShieldHandler.isObjectCrashing(this) || bundle == null) {
|
|
return;
|
|
}
|
|
try {
|
|
for (String key : bundle.keySet()) {
|
|
Object obj = bundle.get(key);
|
|
if (obj != null) {
|
|
String obj2 = obj.toString();
|
|
if (maybeSHA256Hashed(obj2)) {
|
|
ConcurrentHashMap<String, String> concurrentHashMap = externalHashedUserData;
|
|
if (obj2 == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
|
|
}
|
|
String lowerCase = obj2.toLowerCase();
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
|
|
concurrentHashMap.put(key, lowerCase);
|
|
} else {
|
|
Utility utility = Utility.INSTANCE;
|
|
Intrinsics.checkNotNullExpressionValue(key, "key");
|
|
String sha256hash = Utility.sha256hash(normalizeData(key, obj2));
|
|
if (sha256hash != null) {
|
|
externalHashedUserData.put(key, sha256hash);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:47:0x00b1, code lost:
|
|
|
|
r4 = new java.lang.String[0];
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public static final void setInternalUd(java.util.Map<java.lang.String, java.lang.String> r12) {
|
|
/*
|
|
Method dump skipped, instructions count: 287
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.UserDataStore.setInternalUd(java.util.Map):void");
|
|
}
|
|
|
|
private final boolean maybeSHA256Hashed(String str) {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return false;
|
|
}
|
|
try {
|
|
return new Regex("[A-Fa-f0-9]{64}").matches(str);
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
return false;
|
|
}
|
|
}
|
|
}
|