Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
package com.facebook.appevents;
import androidx.annotation.RestrictTo;
import com.facebook.AccessToken;
import com.facebook.FacebookSdk;
import com.facebook.internal.Utility;
import java.io.ObjectStreamException;
import java.io.Serializable;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class AccessTokenAppIdPair implements Serializable {
public static final Companion Companion = new Companion(null);
private static final long serialVersionUID = 1;
private final String accessTokenString;
private final String applicationId;
public final String getAccessTokenString() {
return this.accessTokenString;
}
public final String getApplicationId() {
return this.applicationId;
}
public AccessTokenAppIdPair(String str, String applicationId) {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
this.applicationId = applicationId;
this.accessTokenString = Utility.isNullOrEmpty(str) ? null : str;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public AccessTokenAppIdPair(AccessToken accessToken) {
this(accessToken.getToken(), FacebookSdk.getApplicationId());
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
}
public int hashCode() {
String str = this.accessTokenString;
return (str == null ? 0 : str.hashCode()) ^ this.applicationId.hashCode();
}
public boolean equals(Object obj) {
if (!(obj instanceof AccessTokenAppIdPair)) {
return false;
}
Utility utility = Utility.INSTANCE;
AccessTokenAppIdPair accessTokenAppIdPair = (AccessTokenAppIdPair) obj;
return Utility.areObjectsEqual(accessTokenAppIdPair.accessTokenString, this.accessTokenString) && Utility.areObjectsEqual(accessTokenAppIdPair.applicationId, this.applicationId);
}
public static final class SerializationProxyV1 implements Serializable {
public static final Companion Companion = new Companion(null);
private static final long serialVersionUID = -2488473066578201069L;
private final String accessTokenString;
private final String appId;
public SerializationProxyV1(String str, String appId) {
Intrinsics.checkNotNullParameter(appId, "appId");
this.accessTokenString = str;
this.appId = appId;
}
private final Object readResolve() throws ObjectStreamException {
return new AccessTokenAppIdPair(this.accessTokenString, this.appId);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
private final Object writeReplace() throws ObjectStreamException {
return new SerializationProxyV1(this.accessTokenString, this.applicationId);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,107 @@
package com.facebook.appevents;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import com.facebook.FacebookSdk;
import com.facebook.appevents.internal.AppEventUtility;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/* loaded from: classes2.dex */
public final class AnalyticsUserIDStore {
private static final String ANALYTICS_USER_ID_KEY = "com.facebook.appevents.AnalyticsUserIDStore.userID";
private static volatile boolean initialized;
private static String userID;
public static final AnalyticsUserIDStore INSTANCE = new AnalyticsUserIDStore();
private static final String TAG = AnalyticsUserIDStore.class.getSimpleName();
private static final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
private AnalyticsUserIDStore() {
}
public static final void initStore() {
if (initialized) {
return;
}
InternalAppEventsLogger.Companion.getAnalyticsExecutor().execute(new Runnable() { // from class: com.facebook.appevents.AnalyticsUserIDStore$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AnalyticsUserIDStore.m445initStore$lambda0();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: initStore$lambda-0, reason: not valid java name */
public static final void m445initStore$lambda0() {
INSTANCE.initAndWait();
}
public static final void setUserID(final String str) {
AppEventUtility.assertIsNotMainThread();
if (!initialized) {
Log.w(TAG, "initStore should have been called before calling setUserID");
INSTANCE.initAndWait();
}
InternalAppEventsLogger.Companion.getAnalyticsExecutor().execute(new Runnable() { // from class: com.facebook.appevents.AnalyticsUserIDStore$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
AnalyticsUserIDStore.m446setUserID$lambda1(str);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: setUserID$lambda-1, reason: not valid java name */
public static final void m446setUserID$lambda1(String str) {
ReentrantReadWriteLock reentrantReadWriteLock = lock;
reentrantReadWriteLock.writeLock().lock();
try {
userID = str;
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext()).edit();
edit.putString(ANALYTICS_USER_ID_KEY, userID);
edit.apply();
reentrantReadWriteLock.writeLock().unlock();
} catch (Throwable th) {
lock.writeLock().unlock();
throw th;
}
}
public static final String getUserID() {
if (!initialized) {
Log.w(TAG, "initStore should have been called before calling setUserID");
INSTANCE.initAndWait();
}
ReentrantReadWriteLock reentrantReadWriteLock = lock;
reentrantReadWriteLock.readLock().lock();
try {
String str = userID;
reentrantReadWriteLock.readLock().unlock();
return str;
} catch (Throwable th) {
lock.readLock().unlock();
throw th;
}
}
private final void initAndWait() {
if (initialized) {
return;
}
ReentrantReadWriteLock reentrantReadWriteLock = lock;
reentrantReadWriteLock.writeLock().lock();
try {
if (!initialized) {
userID = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext()).getString(ANALYTICS_USER_ID_KEY, null);
initialized = true;
reentrantReadWriteLock.writeLock().unlock();
return;
}
reentrantReadWriteLock.writeLock().unlock();
} catch (Throwable th) {
lock.writeLock().unlock();
throw th;
}
}
}

View File

@@ -0,0 +1,282 @@
package com.facebook.appevents;
import android.os.Bundle;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookException;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.eventdeactivation.EventDeactivationManager;
import com.facebook.appevents.integrity.IntegrityManager;
import com.facebook.appevents.integrity.ProtectedModeManager;
import com.facebook.appevents.integrity.RedactedEventsManager;
import com.facebook.appevents.integrity.SensitiveParamsManager;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.appevents.internal.Constants;
import com.facebook.appevents.restrictivedatafilter.RestrictiveDataManager;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import com.mbridge.msdk.foundation.tools.SameMD5;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Regex;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class AppEvent implements Serializable {
private static final int MAX_IDENTIFIER_LENGTH = 40;
private static final long serialVersionUID = 1;
private final String checksum;
private final boolean inBackground;
private final boolean isImplicit;
private final JSONObject jsonObject;
private final String name;
public static final Companion Companion = new Companion(null);
private static final HashSet<String> validatedIdentifiers = new HashSet<>();
public /* synthetic */ AppEvent(String str, boolean z, boolean z2, String str2, DefaultConstructorMarker defaultConstructorMarker) {
this(str, z, z2, str2);
}
public final boolean getIsImplicit() {
return this.isImplicit;
}
public final JSONObject getJSONObject() {
return this.jsonObject;
}
public final JSONObject getJsonObject() {
return this.jsonObject;
}
public final String getName() {
return this.name;
}
public final boolean isImplicit() {
return this.isImplicit;
}
public AppEvent(String contextName, String eventName, Double d, Bundle bundle, boolean z, boolean z2, UUID uuid) throws JSONException, FacebookException {
Intrinsics.checkNotNullParameter(contextName, "contextName");
Intrinsics.checkNotNullParameter(eventName, "eventName");
this.isImplicit = z;
this.inBackground = z2;
this.name = eventName;
this.jsonObject = getJSONObjectForAppEvent(contextName, eventName, d, bundle, uuid);
this.checksum = calculateChecksum();
}
private AppEvent(String str, boolean z, boolean z2, String str2) {
JSONObject jSONObject = new JSONObject(str);
this.jsonObject = jSONObject;
this.isImplicit = z;
String optString = jSONObject.optString(Constants.EVENT_NAME_EVENT_KEY);
Intrinsics.checkNotNullExpressionValue(optString, "jsonObject.optString(Constants.EVENT_NAME_EVENT_KEY)");
this.name = optString;
this.checksum = str2;
this.inBackground = z2;
}
public final boolean isChecksumValid() {
if (this.checksum == null) {
return true;
}
return Intrinsics.areEqual(calculateChecksum(), this.checksum);
}
private final JSONObject getJSONObjectForAppEvent(String str, String str2, Double d, Bundle bundle, UUID uuid) {
Companion companion = Companion;
companion.validateIdentifier(str2);
JSONObject jSONObject = new JSONObject();
String processEvent = RestrictiveDataManager.processEvent(str2);
if (Intrinsics.areEqual(processEvent, str2)) {
processEvent = RedactedEventsManager.processEventsRedaction(str2);
}
jSONObject.put(Constants.EVENT_NAME_EVENT_KEY, processEvent);
jSONObject.put(Constants.EVENT_NAME_MD5_EVENT_KEY, companion.md5Checksum(processEvent));
jSONObject.put(Constants.LOG_TIME_APP_EVENT_KEY, System.currentTimeMillis() / 1000);
jSONObject.put("_ui", str);
if (uuid != null) {
jSONObject.put("_session_id", uuid);
}
if (bundle != null) {
Map<String, String> validateParameters = validateParameters(bundle);
for (String str3 : validateParameters.keySet()) {
jSONObject.put(str3, validateParameters.get(str3));
}
}
if (d != null) {
jSONObject.put(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM, d.doubleValue());
}
if (this.inBackground) {
jSONObject.put("_inBackground", "1");
}
if (this.isImplicit) {
jSONObject.put("_implicitlyLogged", "1");
} else {
Logger.Companion companion2 = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "eventObject.toString()");
companion2.log(loggingBehavior, "AppEvents", "Created app event '%s'", jSONObject2);
}
return jSONObject;
}
private final Map<String, String> validateParameters(Bundle bundle) {
HashMap hashMap = new HashMap();
for (String key : bundle.keySet()) {
Companion companion = Companion;
Intrinsics.checkNotNullExpressionValue(key, "key");
companion.validateIdentifier(key);
Object obj = bundle.get(key);
if (!(obj instanceof String) && !(obj instanceof Number)) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("Parameter value '%s' for key '%s' should be a string or a numeric type.", Arrays.copyOf(new Object[]{obj, key}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
throw new FacebookException(format);
}
hashMap.put(key, obj.toString());
}
if (!ProtectedModeManager.INSTANCE.protectedModeIsApplied(bundle)) {
SensitiveParamsManager sensitiveParamsManager = SensitiveParamsManager.INSTANCE;
SensitiveParamsManager.processFilterSensitiveParams(hashMap, this.name);
}
IntegrityManager.processParameters(hashMap);
RestrictiveDataManager restrictiveDataManager = RestrictiveDataManager.INSTANCE;
RestrictiveDataManager.processParameters(hashMap, this.name);
EventDeactivationManager eventDeactivationManager = EventDeactivationManager.INSTANCE;
EventDeactivationManager.processDeprecatedParameters(hashMap, this.name);
return hashMap;
}
public static final class SerializationProxyV2 implements Serializable {
public static final Companion Companion = new Companion(null);
private static final long serialVersionUID = 20160803001L;
private final String checksum;
private final boolean inBackground;
private final boolean isImplicit;
private final String jsonString;
public SerializationProxyV2(String jsonString, boolean z, boolean z2, String str) {
Intrinsics.checkNotNullParameter(jsonString, "jsonString");
this.jsonString = jsonString;
this.isImplicit = z;
this.inBackground = z2;
this.checksum = str;
}
private final Object readResolve() throws JSONException, ObjectStreamException {
return new AppEvent(this.jsonString, this.isImplicit, this.inBackground, this.checksum, null);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
private final Object writeReplace() throws ObjectStreamException {
String jSONObject = this.jsonObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "jsonObject.toString()");
return new SerializationProxyV2(jSONObject, this.isImplicit, this.inBackground, this.checksum);
}
public String toString() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("\"%s\", implicit: %b, json: %s", Arrays.copyOf(new Object[]{this.jsonObject.optString(Constants.EVENT_NAME_EVENT_KEY), Boolean.valueOf(this.isImplicit), this.jsonObject.toString()}, 3));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
private final String calculateChecksum() {
Companion companion = Companion;
String jSONObject = this.jsonObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "jsonObject.toString()");
return companion.md5Checksum(jSONObject);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
/* JADX INFO: Access modifiers changed from: private */
public final void validateIdentifier(String str) {
boolean contains;
if (str == null || str.length() == 0 || str.length() > 40) {
if (str == null) {
str = "<None Provided>";
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.ROOT, "Identifier '%s' must be less than %d characters", Arrays.copyOf(new Object[]{str, 40}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
throw new FacebookException(format);
}
synchronized (AppEvent.validatedIdentifiers) {
contains = AppEvent.validatedIdentifiers.contains(str);
Unit unit = Unit.INSTANCE;
}
if (contains) {
return;
}
if (new Regex("^[0-9a-zA-Z_]+[0-9a-zA-Z _-]*$").matches(str)) {
synchronized (AppEvent.validatedIdentifiers) {
AppEvent.validatedIdentifiers.add(str);
}
} else {
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
String format2 = String.format("Skipping event named '%s' due to illegal name - must be under 40 chars and alphanumeric, _, - or space, and not start with a space or hyphen.", Arrays.copyOf(new Object[]{str}, 1));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(format, *args)");
throw new FacebookException(format2);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final String md5Checksum(String str) {
try {
MessageDigest messageDigest = MessageDigest.getInstance(SameMD5.TAG);
Charset forName = Charset.forName("UTF-8");
Intrinsics.checkNotNullExpressionValue(forName, "Charset.forName(charsetName)");
if (str == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
byte[] bytes = str.getBytes(forName);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
messageDigest.update(bytes, 0, bytes.length);
byte[] digest = messageDigest.digest();
Intrinsics.checkNotNullExpressionValue(digest, "digest.digest()");
return AppEventUtility.bytesToHex(digest);
} catch (UnsupportedEncodingException e) {
Utility.logd("Failed to generate checksum: ", e);
return "1";
} catch (NoSuchAlgorithmException e2) {
Utility.logd("Failed to generate checksum: ", e2);
return "0";
}
}
}
}

View File

@@ -0,0 +1,76 @@
package com.facebook.appevents;
import android.content.Context;
import com.facebook.FacebookSdk;
import com.facebook.internal.AttributionIdentifiers;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class AppEventCollection {
private final HashMap<AccessTokenAppIdPair, SessionEventsState> stateMap = new HashMap<>();
public final synchronized void addPersistedEvents(PersistedEvents persistedEvents) {
if (persistedEvents == null) {
return;
}
for (Map.Entry<AccessTokenAppIdPair, List<AppEvent>> entry : persistedEvents.entrySet()) {
SessionEventsState sessionEventsState = getSessionEventsState(entry.getKey());
if (sessionEventsState != null) {
Iterator<AppEvent> it = entry.getValue().iterator();
while (it.hasNext()) {
sessionEventsState.addEvent(it.next());
}
}
}
}
public final synchronized void addEvent(AccessTokenAppIdPair accessTokenAppIdPair, AppEvent appEvent) {
Intrinsics.checkNotNullParameter(accessTokenAppIdPair, "accessTokenAppIdPair");
Intrinsics.checkNotNullParameter(appEvent, "appEvent");
SessionEventsState sessionEventsState = getSessionEventsState(accessTokenAppIdPair);
if (sessionEventsState != null) {
sessionEventsState.addEvent(appEvent);
}
}
public final synchronized Set<AccessTokenAppIdPair> keySet() {
Set<AccessTokenAppIdPair> keySet;
keySet = this.stateMap.keySet();
Intrinsics.checkNotNullExpressionValue(keySet, "stateMap.keys");
return keySet;
}
public final synchronized SessionEventsState get(AccessTokenAppIdPair accessTokenAppIdPair) {
Intrinsics.checkNotNullParameter(accessTokenAppIdPair, "accessTokenAppIdPair");
return this.stateMap.get(accessTokenAppIdPair);
}
public final synchronized int getEventCount() {
int i;
Iterator<SessionEventsState> it = this.stateMap.values().iterator();
i = 0;
while (it.hasNext()) {
i += it.next().getAccumulatedEventCount();
}
return i;
}
private final synchronized SessionEventsState getSessionEventsState(AccessTokenAppIdPair accessTokenAppIdPair) {
Context applicationContext;
AttributionIdentifiers attributionIdentifiers;
SessionEventsState sessionEventsState = this.stateMap.get(accessTokenAppIdPair);
if (sessionEventsState == null && (attributionIdentifiers = AttributionIdentifiers.Companion.getAttributionIdentifiers((applicationContext = FacebookSdk.getApplicationContext()))) != null) {
sessionEventsState = new SessionEventsState(attributionIdentifiers, AppEventsLogger.Companion.getAnonymousAppDeviceGUID(applicationContext));
}
if (sessionEventsState == null) {
return null;
}
this.stateMap.put(accessTokenAppIdPair, sessionEventsState);
return sessionEventsState;
}
}

View File

@@ -0,0 +1,200 @@
package com.facebook.appevents;
import android.content.Context;
import android.util.Log;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AccessTokenAppIdPair;
import com.facebook.appevents.AppEvent;
import com.facebook.internal.Utility;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class AppEventDiskStore {
private static final String PERSISTED_EVENTS_FILENAME = "AppEventsLogger.persistedevents";
public static final AppEventDiskStore INSTANCE = new AppEventDiskStore();
private static final String TAG = AppEventDiskStore.class.getName();
private AppEventDiskStore() {
}
/* JADX WARN: Removed duplicated region for block: B:17:0x009f A[Catch: all -> 0x0035, TRY_LEAVE, TryCatch #3 {, blocks: (B:4:0x0003, B:12:0x0028, B:14:0x002b, B:17:0x009f, B:23:0x0039, B:44:0x0074, B:46:0x0077, B:47:0x0089, B:50:0x0082, B:36:0x005e, B:38:0x0061, B:41:0x006c, B:33:0x0070, B:27:0x008a, B:29:0x008d, B:32:0x0098), top: B:3:0x0003, inners: #1, #4, #5, #10 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final synchronized com.facebook.appevents.PersistedEvents readAndClearStore() {
/*
java.lang.Class<com.facebook.appevents.AppEventDiskStore> r0 = com.facebook.appevents.AppEventDiskStore.class
monitor-enter(r0)
com.facebook.appevents.internal.AppEventUtility.assertIsNotMainThread() // Catch: java.lang.Throwable -> L35
android.content.Context r1 = com.facebook.FacebookSdk.getApplicationContext() // Catch: java.lang.Throwable -> L35
r2 = 0
java.lang.String r3 = "AppEventsLogger.persistedevents"
java.io.FileInputStream r3 = r1.openFileInput(r3) // Catch: java.lang.Throwable -> L4e java.lang.Exception -> L52 java.io.FileNotFoundException -> L55
java.lang.String r4 = "context.openFileInput(PERSISTED_EVENTS_FILENAME)"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r4) // Catch: java.lang.Throwable -> L4e java.lang.Exception -> L52 java.io.FileNotFoundException -> L55
com.facebook.appevents.AppEventDiskStore$MovedClassObjectInputStream r4 = new com.facebook.appevents.AppEventDiskStore$MovedClassObjectInputStream // Catch: java.lang.Throwable -> L4e java.lang.Exception -> L52 java.io.FileNotFoundException -> L55
java.io.BufferedInputStream r5 = new java.io.BufferedInputStream // Catch: java.lang.Throwable -> L4e java.lang.Exception -> L52 java.io.FileNotFoundException -> L55
r5.<init>(r3) // Catch: java.lang.Throwable -> L4e java.lang.Exception -> L52 java.io.FileNotFoundException -> L55
r4.<init>(r5) // Catch: java.lang.Throwable -> L4e java.lang.Exception -> L52 java.io.FileNotFoundException -> L55
java.lang.Object r3 = r4.readObject() // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.io.FileNotFoundException -> L8a
if (r3 == 0) goto L46
com.facebook.appevents.PersistedEvents r3 = (com.facebook.appevents.PersistedEvents) r3 // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.io.FileNotFoundException -> L8a
com.facebook.internal.Utility.closeQuietly(r4) // Catch: java.lang.Throwable -> L35
java.lang.String r2 = "AppEventsLogger.persistedevents"
java.io.File r1 = r1.getFileStreamPath(r2) // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L38
r1.delete() // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L38
goto L40
L35:
r1 = move-exception
goto La6
L38:
r1 = move-exception
java.lang.String r2 = com.facebook.appevents.AppEventDiskStore.TAG // Catch: java.lang.Throwable -> L35
java.lang.String r4 = "Got unexpected exception when removing events file: "
android.util.Log.w(r2, r4, r1) // Catch: java.lang.Throwable -> L35
L40:
r2 = r3
goto L9d
L42:
r2 = move-exception
goto L74
L44:
r3 = move-exception
goto L57
L46:
java.lang.NullPointerException r3 = new java.lang.NullPointerException // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.io.FileNotFoundException -> L8a
java.lang.String r5 = "null cannot be cast to non-null type com.facebook.appevents.PersistedEvents"
r3.<init>(r5) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.io.FileNotFoundException -> L8a
throw r3 // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.io.FileNotFoundException -> L8a
L4e:
r3 = move-exception
r4 = r2
r2 = r3
goto L74
L52:
r3 = move-exception
r4 = r2
goto L57
L55:
r4 = r2
goto L8a
L57:
java.lang.String r5 = com.facebook.appevents.AppEventDiskStore.TAG // Catch: java.lang.Throwable -> L42
java.lang.String r6 = "Got unexpected exception while reading events: "
android.util.Log.w(r5, r6, r3) // Catch: java.lang.Throwable -> L42
com.facebook.internal.Utility.closeQuietly(r4) // Catch: java.lang.Throwable -> L35
java.lang.String r3 = "AppEventsLogger.persistedevents"
java.io.File r1 = r1.getFileStreamPath(r3) // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L6b
r1.delete() // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L6b
goto L9d
L6b:
r1 = move-exception
java.lang.String r3 = com.facebook.appevents.AppEventDiskStore.TAG // Catch: java.lang.Throwable -> L35
java.lang.String r4 = "Got unexpected exception when removing events file: "
L70:
android.util.Log.w(r3, r4, r1) // Catch: java.lang.Throwable -> L35
goto L9d
L74:
com.facebook.internal.Utility.closeQuietly(r4) // Catch: java.lang.Throwable -> L35
java.lang.String r3 = "AppEventsLogger.persistedevents"
java.io.File r1 = r1.getFileStreamPath(r3) // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L81
r1.delete() // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L81
goto L89
L81:
r1 = move-exception
java.lang.String r3 = com.facebook.appevents.AppEventDiskStore.TAG // Catch: java.lang.Throwable -> L35
java.lang.String r4 = "Got unexpected exception when removing events file: "
android.util.Log.w(r3, r4, r1) // Catch: java.lang.Throwable -> L35
L89:
throw r2 // Catch: java.lang.Throwable -> L35
L8a:
com.facebook.internal.Utility.closeQuietly(r4) // Catch: java.lang.Throwable -> L35
java.lang.String r3 = "AppEventsLogger.persistedevents"
java.io.File r1 = r1.getFileStreamPath(r3) // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L97
r1.delete() // Catch: java.lang.Throwable -> L35 java.lang.Exception -> L97
goto L9d
L97:
r1 = move-exception
java.lang.String r3 = com.facebook.appevents.AppEventDiskStore.TAG // Catch: java.lang.Throwable -> L35
java.lang.String r4 = "Got unexpected exception when removing events file: "
goto L70
L9d:
if (r2 != 0) goto La4
com.facebook.appevents.PersistedEvents r2 = new com.facebook.appevents.PersistedEvents // Catch: java.lang.Throwable -> L35
r2.<init>() // Catch: java.lang.Throwable -> L35
La4:
monitor-exit(r0)
return r2
La6:
monitor-exit(r0)
throw r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.AppEventDiskStore.readAndClearStore():com.facebook.appevents.PersistedEvents");
}
public static final void saveEventsToDisk$facebook_core_release(PersistedEvents persistedEvents) {
ObjectOutputStream objectOutputStream;
Context applicationContext = FacebookSdk.getApplicationContext();
ObjectOutputStream objectOutputStream2 = null;
try {
objectOutputStream = new ObjectOutputStream(new BufferedOutputStream(applicationContext.openFileOutput(PERSISTED_EVENTS_FILENAME, 0)));
} catch (Throwable th) {
th = th;
}
try {
objectOutputStream.writeObject(persistedEvents);
Utility.closeQuietly(objectOutputStream);
} catch (Throwable th2) {
th = th2;
objectOutputStream2 = objectOutputStream;
try {
Log.w(TAG, "Got unexpected exception while persisting events: ", th);
try {
applicationContext.getFileStreamPath(PERSISTED_EVENTS_FILENAME).delete();
} catch (Exception unused) {
}
} finally {
Utility.closeQuietly(objectOutputStream2);
}
}
}
public static final class MovedClassObjectInputStream extends ObjectInputStream {
private static final String ACCESS_TOKEN_APP_ID_PAIR_SERIALIZATION_PROXY_V1_CLASS_NAME = "com.facebook.appevents.AppEventsLogger$AccessTokenAppIdPair$SerializationProxyV1";
private static final String APP_EVENT_SERIALIZATION_PROXY_V1_CLASS_NAME = "com.facebook.appevents.AppEventsLogger$AppEvent$SerializationProxyV2";
public static final Companion Companion = new Companion(null);
public MovedClassObjectInputStream(InputStream inputStream) {
super(inputStream);
}
@Override // java.io.ObjectInputStream
public ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
ObjectStreamClass resultClassDescriptor = super.readClassDescriptor();
if (Intrinsics.areEqual(resultClassDescriptor.getName(), ACCESS_TOKEN_APP_ID_PAIR_SERIALIZATION_PROXY_V1_CLASS_NAME)) {
resultClassDescriptor = ObjectStreamClass.lookup(AccessTokenAppIdPair.SerializationProxyV1.class);
} else if (Intrinsics.areEqual(resultClassDescriptor.getName(), APP_EVENT_SERIALIZATION_PROXY_V1_CLASS_NAME)) {
resultClassDescriptor = ObjectStreamClass.lookup(AppEvent.SerializationProxyV2.class);
}
Intrinsics.checkNotNullExpressionValue(resultClassDescriptor, "resultClassDescriptor");
return resultClassDescriptor;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
}

View File

@@ -0,0 +1,406 @@
package com.facebook.appevents;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.appevents.cloudbridge.AppEventsCAPIManager;
import com.facebook.appevents.cloudbridge.AppEventsConversionsAPITransformerWebRequests;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Logger;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONException;
/* loaded from: classes2.dex */
public final class AppEventQueue {
private static final int FLUSH_PERIOD_IN_SECONDS = 15;
private static final int NO_CONNECTIVITY_ERROR_CODE = -1;
private static ScheduledFuture<?> scheduledFuture;
public static final AppEventQueue INSTANCE = new AppEventQueue();
private static final String TAG = AppEventQueue.class.getName();
private static final int NUM_LOG_EVENTS_TO_TRY_TO_FLUSH_AFTER = 100;
private static volatile AppEventCollection appEventCollection = new AppEventCollection();
private static final ScheduledExecutorService singleThreadExecutor = Executors.newSingleThreadScheduledExecutor();
private static final Runnable flushRunnable = new Runnable() { // from class: com.facebook.appevents.AppEventQueue$$ExternalSyntheticLambda5
@Override // java.lang.Runnable
public final void run() {
AppEventQueue.m453flushRunnable$lambda0();
}
};
private AppEventQueue() {
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: flushRunnable$lambda-0, reason: not valid java name */
public static final void m453flushRunnable$lambda0() {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
scheduledFuture = null;
if (AppEventsLogger.Companion.getFlushBehavior() != AppEventsLogger.FlushBehavior.EXPLICIT_ONLY) {
flushAndWait(FlushReason.TIMER);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
public static final void persistToDisk() {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
singleThreadExecutor.execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
AppEventQueue.m455persistToDisk$lambda1();
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: persistToDisk$lambda-1, reason: not valid java name */
public static final void m455persistToDisk$lambda1() {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
AppEventStore appEventStore = AppEventStore.INSTANCE;
AppEventStore.persistEvents(appEventCollection);
appEventCollection = new AppEventCollection();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
public static final void flush(final FlushReason reason) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(reason, "reason");
singleThreadExecutor.execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
AppEventQueue.m452flush$lambda2(FlushReason.this);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: flush$lambda-2, reason: not valid java name */
public static final void m452flush$lambda2(FlushReason reason) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(reason, "$reason");
flushAndWait(reason);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
public static final void add(final AccessTokenAppIdPair accessTokenAppId, final AppEvent appEvent) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppId, "accessTokenAppId");
Intrinsics.checkNotNullParameter(appEvent, "appEvent");
singleThreadExecutor.execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue$$ExternalSyntheticLambda4
@Override // java.lang.Runnable
public final void run() {
AppEventQueue.m450add$lambda3(AccessTokenAppIdPair.this, appEvent);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: add$lambda-3, reason: not valid java name */
public static final void m450add$lambda3(AccessTokenAppIdPair accessTokenAppId, AppEvent appEvent) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppId, "$accessTokenAppId");
Intrinsics.checkNotNullParameter(appEvent, "$appEvent");
appEventCollection.addEvent(accessTokenAppId, appEvent);
if (AppEventsLogger.Companion.getFlushBehavior() != AppEventsLogger.FlushBehavior.EXPLICIT_ONLY && appEventCollection.getEventCount() > NUM_LOG_EVENTS_TO_TRY_TO_FLUSH_AFTER) {
flushAndWait(FlushReason.EVENT_THRESHOLD);
} else if (scheduledFuture == null) {
scheduledFuture = singleThreadExecutor.schedule(flushRunnable, 15L, TimeUnit.SECONDS);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
public static final Set<AccessTokenAppIdPair> getKeySet() {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return null;
}
try {
return appEventCollection.keySet();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
return null;
}
}
public static final void flushAndWait(FlushReason reason) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(reason, "reason");
appEventCollection.addPersistedEvents(AppEventDiskStore.readAndClearStore());
try {
FlushStatistics sendEventsToServer = sendEventsToServer(reason, appEventCollection);
if (sendEventsToServer != null) {
Intent intent = new Intent(AppEventsLogger.ACTION_APP_EVENTS_FLUSHED);
intent.putExtra(AppEventsLogger.APP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED, sendEventsToServer.getNumEvents());
intent.putExtra(AppEventsLogger.APP_EVENTS_EXTRA_FLUSH_RESULT, sendEventsToServer.getResult());
LocalBroadcastManager.getInstance(FacebookSdk.getApplicationContext()).sendBroadcast(intent);
}
} catch (Exception e) {
Log.w(TAG, "Caught unexpected exception while flushing app events: ", e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
@VisibleForTesting(otherwise = 2)
public static final FlushStatistics sendEventsToServer(FlushReason reason, AppEventCollection appEventCollection2) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(reason, "reason");
Intrinsics.checkNotNullParameter(appEventCollection2, "appEventCollection");
FlushStatistics flushStatistics = new FlushStatistics();
List<GraphRequest> buildRequests = buildRequests(appEventCollection2, flushStatistics);
if (!(!buildRequests.isEmpty())) {
return null;
}
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, TAG2, "Flushing %d events due to %s.", Integer.valueOf(flushStatistics.getNumEvents()), reason.toString());
Iterator<GraphRequest> it = buildRequests.iterator();
while (it.hasNext()) {
it.next().executeAndWait();
}
return flushStatistics;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
return null;
}
}
public static final List<GraphRequest> buildRequests(AppEventCollection appEventCollection2, FlushStatistics flushResults) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(appEventCollection2, "appEventCollection");
Intrinsics.checkNotNullParameter(flushResults, "flushResults");
boolean limitEventAndDataUsage = FacebookSdk.getLimitEventAndDataUsage(FacebookSdk.getApplicationContext());
ArrayList arrayList = new ArrayList();
for (AccessTokenAppIdPair accessTokenAppIdPair : appEventCollection2.keySet()) {
SessionEventsState sessionEventsState = appEventCollection2.get(accessTokenAppIdPair);
if (sessionEventsState != null) {
GraphRequest buildRequestForSession = buildRequestForSession(accessTokenAppIdPair, sessionEventsState, limitEventAndDataUsage, flushResults);
if (buildRequestForSession != null) {
arrayList.add(buildRequestForSession);
if (AppEventsCAPIManager.INSTANCE.isEnabled$facebook_core_release()) {
AppEventsConversionsAPITransformerWebRequests.transformGraphRequestAndSendToCAPIGEndPoint(buildRequestForSession);
}
}
} else {
throw new IllegalStateException("Required value was null.".toString());
}
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
return null;
}
}
public static final GraphRequest buildRequestForSession(final AccessTokenAppIdPair accessTokenAppId, final SessionEventsState appEvents, boolean z, final FlushStatistics flushState) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppId, "accessTokenAppId");
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
Intrinsics.checkNotNullParameter(flushState, "flushState");
String applicationId = accessTokenAppId.getApplicationId();
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(applicationId, false);
GraphRequest.Companion companion = GraphRequest.Companion;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s/activities", Arrays.copyOf(new Object[]{applicationId}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
final GraphRequest newPostRequest = companion.newPostRequest(null, format, null, null);
newPostRequest.setForceApplicationRequest(true);
Bundle parameters = newPostRequest.getParameters();
if (parameters == null) {
parameters = new Bundle();
}
parameters.putString("access_token", accessTokenAppId.getAccessTokenString());
String pushNotificationsRegistrationId = InternalAppEventsLogger.Companion.getPushNotificationsRegistrationId();
if (pushNotificationsRegistrationId != null) {
parameters.putString("device_token", pushNotificationsRegistrationId);
}
String installReferrer = AppEventsLoggerImpl.Companion.getInstallReferrer();
if (installReferrer != null) {
parameters.putString("install_referrer", installReferrer);
}
newPostRequest.setParameters(parameters);
int populateRequest = appEvents.populateRequest(newPostRequest, FacebookSdk.getApplicationContext(), queryAppSettings != null ? queryAppSettings.supportsImplicitLogging() : false, z);
if (populateRequest == 0) {
return null;
}
flushState.setNumEvents(flushState.getNumEvents() + populateRequest);
newPostRequest.setCallback(new GraphRequest.Callback() { // from class: com.facebook.appevents.AppEventQueue$$ExternalSyntheticLambda1
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
AppEventQueue.m451buildRequestForSession$lambda4(AccessTokenAppIdPair.this, newPostRequest, appEvents, flushState, graphResponse);
}
});
return newPostRequest;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
return null;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: buildRequestForSession$lambda-4, reason: not valid java name */
public static final void m451buildRequestForSession$lambda4(AccessTokenAppIdPair accessTokenAppId, GraphRequest postRequest, SessionEventsState appEvents, FlushStatistics flushState, GraphResponse response) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppId, "$accessTokenAppId");
Intrinsics.checkNotNullParameter(postRequest, "$postRequest");
Intrinsics.checkNotNullParameter(appEvents, "$appEvents");
Intrinsics.checkNotNullParameter(flushState, "$flushState");
Intrinsics.checkNotNullParameter(response, "response");
handleResponse(accessTokenAppId, postRequest, response, appEvents, flushState);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
public static final void handleResponse(final AccessTokenAppIdPair accessTokenAppId, GraphRequest request, GraphResponse response, final SessionEventsState appEvents, FlushStatistics flushState) {
String str;
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppId, "accessTokenAppId");
Intrinsics.checkNotNullParameter(request, "request");
Intrinsics.checkNotNullParameter(response, "response");
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
Intrinsics.checkNotNullParameter(flushState, "flushState");
FacebookRequestError error = response.getError();
String str2 = "Success";
FlushResult flushResult = FlushResult.SUCCESS;
boolean z = true;
if (error != null) {
if (error.getErrorCode() == -1) {
str2 = "Failed: No Connectivity";
flushResult = FlushResult.NO_CONNECTIVITY;
} else {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
str2 = String.format("Failed:\n Response: %s\n Error %s", Arrays.copyOf(new Object[]{response.toString(), error.toString()}, 2));
Intrinsics.checkNotNullExpressionValue(str2, "java.lang.String.format(format, *args)");
flushResult = FlushResult.SERVER_ERROR;
}
}
FacebookSdk facebookSdk = FacebookSdk.INSTANCE;
if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.APP_EVENTS)) {
try {
str = new JSONArray((String) request.getTag()).toString(2);
Intrinsics.checkNotNullExpressionValue(str, "{\n val jsonArray = JSONArray(eventsJsonString)\n jsonArray.toString(2)\n }");
} catch (JSONException unused) {
str = "<Can't encode events for debug logging>";
}
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, TAG2, "Flush completed\nParams: %s\n Result: %s\n Events JSON: %s", String.valueOf(request.getGraphObject()), str2, str);
}
if (error == null) {
z = false;
}
appEvents.clearInFlightAndStats(z);
FlushResult flushResult2 = FlushResult.NO_CONNECTIVITY;
if (flushResult == flushResult2) {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AppEventQueue.m454handleResponse$lambda5(AccessTokenAppIdPair.this, appEvents);
}
});
}
if (flushResult == FlushResult.SUCCESS || flushState.getResult() == flushResult2) {
return;
}
flushState.setResult(flushResult);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: handleResponse$lambda-5, reason: not valid java name */
public static final void m454handleResponse$lambda5(AccessTokenAppIdPair accessTokenAppId, SessionEventsState appEvents) {
if (CrashShieldHandler.isObjectCrashing(AppEventQueue.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppId, "$accessTokenAppId");
Intrinsics.checkNotNullParameter(appEvents, "$appEvents");
AppEventStore.persistEvents(accessTokenAppId, appEvents);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventQueue.class);
}
}
}

View File

@@ -0,0 +1,55 @@
package com.facebook.appevents;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class AppEventStore {
public static final AppEventStore INSTANCE = new AppEventStore();
private static final String TAG = AppEventStore.class.getName();
private AppEventStore() {
}
public static final synchronized void persistEvents(AccessTokenAppIdPair accessTokenAppIdPair, SessionEventsState appEvents) {
synchronized (AppEventStore.class) {
if (CrashShieldHandler.isObjectCrashing(AppEventStore.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppIdPair, "accessTokenAppIdPair");
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
AppEventUtility.assertIsNotMainThread();
PersistedEvents readAndClearStore = AppEventDiskStore.readAndClearStore();
readAndClearStore.addEvents(accessTokenAppIdPair, appEvents.getEventsToPersist());
AppEventDiskStore.saveEventsToDisk$facebook_core_release(readAndClearStore);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventStore.class);
}
}
}
public static final synchronized void persistEvents(AppEventCollection eventsToPersist) {
synchronized (AppEventStore.class) {
if (CrashShieldHandler.isObjectCrashing(AppEventStore.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(eventsToPersist, "eventsToPersist");
AppEventUtility.assertIsNotMainThread();
PersistedEvents readAndClearStore = AppEventDiskStore.readAndClearStore();
for (AccessTokenAppIdPair accessTokenAppIdPair : eventsToPersist.keySet()) {
SessionEventsState sessionEventsState = eventsToPersist.get(accessTokenAppIdPair);
if (sessionEventsState == null) {
throw new IllegalStateException("Required value was null.".toString());
}
readAndClearStore.addEvents(accessTokenAppIdPair, sessionEventsState.getEventsToPersist());
}
AppEventDiskStore.saveEventsToDisk$facebook_core_release(readAndClearStore);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventStore.class);
}
}
}
}

View File

@@ -0,0 +1,91 @@
package com.facebook.appevents;
/* loaded from: classes2.dex */
public final class AppEventsConstants {
public static final String EVENT_NAME_ACHIEVED_LEVEL = "fb_mobile_level_achieved";
public static final String EVENT_NAME_ACTIVATED_APP = "fb_mobile_activate_app";
public static final String EVENT_NAME_ADDED_PAYMENT_INFO = "fb_mobile_add_payment_info";
public static final String EVENT_NAME_ADDED_TO_CART = "fb_mobile_add_to_cart";
public static final String EVENT_NAME_ADDED_TO_WISHLIST = "fb_mobile_add_to_wishlist";
public static final String EVENT_NAME_AD_CLICK = "AdClick";
public static final String EVENT_NAME_AD_IMPRESSION = "AdImpression";
public static final String EVENT_NAME_COMPLETED_REGISTRATION = "fb_mobile_complete_registration";
public static final String EVENT_NAME_COMPLETED_TUTORIAL = "fb_mobile_tutorial_completion";
public static final String EVENT_NAME_CONTACT = "Contact";
public static final String EVENT_NAME_CUSTOMIZE_PRODUCT = "CustomizeProduct";
public static final String EVENT_NAME_DEACTIVATED_APP = "fb_mobile_deactivate_app";
public static final String EVENT_NAME_DONATE = "Donate";
public static final String EVENT_NAME_FIND_LOCATION = "FindLocation";
public static final String EVENT_NAME_INITIATED_CHECKOUT = "fb_mobile_initiated_checkout";
public static final String EVENT_NAME_LIVE_STREAMING_ERROR = "fb_sdk_live_streaming_error";
public static final String EVENT_NAME_LIVE_STREAMING_PAUSE = "fb_sdk_live_streaming_pause";
public static final String EVENT_NAME_LIVE_STREAMING_RESUME = "fb_sdk_live_streaming_resume";
public static final String EVENT_NAME_LIVE_STREAMING_START = "fb_sdk_live_streaming_start";
public static final String EVENT_NAME_LIVE_STREAMING_STOP = "fb_sdk_live_streaming_stop";
public static final String EVENT_NAME_LIVE_STREAMING_UPDATE_STATUS = "fb_sdk_live_streaming_update_status";
public static final String EVENT_NAME_PRODUCT_CATALOG_UPDATE = "fb_mobile_catalog_update";
public static final String EVENT_NAME_PURCHASED = "fb_mobile_purchase";
public static final String EVENT_NAME_PUSH_TOKEN_OBTAINED = "fb_mobile_obtain_push_token";
public static final String EVENT_NAME_RATED = "fb_mobile_rate";
public static final String EVENT_NAME_SCHEDULE = "Schedule";
public static final String EVENT_NAME_SEARCHED = "fb_mobile_search";
public static final String EVENT_NAME_SESSION_INTERRUPTIONS = "fb_mobile_app_interruptions";
public static final String EVENT_NAME_SPENT_CREDITS = "fb_mobile_spent_credits";
public static final String EVENT_NAME_START_TRIAL = "StartTrial";
public static final String EVENT_NAME_SUBMIT_APPLICATION = "SubmitApplication";
public static final String EVENT_NAME_SUBSCRIBE = "Subscribe";
public static final String EVENT_NAME_TIME_BETWEEN_SESSIONS = "fb_mobile_time_between_sessions";
public static final String EVENT_NAME_UNLOCKED_ACHIEVEMENT = "fb_mobile_achievement_unlocked";
public static final String EVENT_NAME_VIEWED_CONTENT = "fb_mobile_content_view";
public static final String EVENT_PARAM_AD_TYPE = "ad_type";
public static final String EVENT_PARAM_APP_CERT_HASH = "fb_mobile_app_cert_hash";
public static final String EVENT_PARAM_CONTENT = "fb_content";
public static final String EVENT_PARAM_CONTENT_ID = "fb_content_id";
public static final String EVENT_PARAM_CONTENT_TYPE = "fb_content_type";
public static final String EVENT_PARAM_CURRENCY = "fb_currency";
public static final String EVENT_PARAM_DESCRIPTION = "fb_description";
public static final String EVENT_PARAM_LEVEL = "fb_level";
public static final String EVENT_PARAM_LIVE_STREAMING_ERROR = "live_streaming_error";
public static final String EVENT_PARAM_LIVE_STREAMING_PREV_STATUS = "live_streaming_prev_status";
public static final String EVENT_PARAM_LIVE_STREAMING_STATUS = "live_streaming_status";
public static final String EVENT_PARAM_MAX_RATING_VALUE = "fb_max_rating_value";
public static final String EVENT_PARAM_NUM_ITEMS = "fb_num_items";
public static final String EVENT_PARAM_ORDER_ID = "fb_order_id";
public static final String EVENT_PARAM_PACKAGE_FP = "fb_mobile_pckg_fp";
public static final String EVENT_PARAM_PAYMENT_INFO_AVAILABLE = "fb_payment_info_available";
public static final String EVENT_PARAM_PRODUCT_APPLINK_ANDROID_APP_NAME = "fb_product_applink_android_app_name";
public static final String EVENT_PARAM_PRODUCT_APPLINK_ANDROID_PACKAGE = "fb_product_applink_android_package";
public static final String EVENT_PARAM_PRODUCT_APPLINK_ANDROID_URL = "fb_product_applink_android_url";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IOS_APP_NAME = "fb_product_applink_ios_app_name";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IOS_APP_STORE_ID = "fb_product_applink_ios_app_store_id";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IOS_URL = "fb_product_applink_ios_url";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IPAD_APP_NAME = "fb_product_applink_ipad_app_name";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IPAD_APP_STORE_ID = "fb_product_applink_ipad_app_store_id";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IPAD_URL = "fb_product_applink_ipad_url";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IPHONE_APP_NAME = "fb_product_applink_iphone_app_name";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IPHONE_APP_STORE_ID = "fb_product_applink_iphone_app_store_id";
public static final String EVENT_PARAM_PRODUCT_APPLINK_IPHONE_URL = "fb_product_applink_iphone_url";
public static final String EVENT_PARAM_PRODUCT_APPLINK_WINDOWS_PHONE_APP_ID = "fb_product_applink_windows_phone_app_id";
public static final String EVENT_PARAM_PRODUCT_APPLINK_WINDOWS_PHONE_APP_NAME = "fb_product_applink_windows_phone_app_name";
public static final String EVENT_PARAM_PRODUCT_APPLINK_WINDOWS_PHONE_URL = "fb_product_applink_windows_phone_url";
public static final String EVENT_PARAM_PRODUCT_CATEGORY = "fb_product_category";
public static final String EVENT_PARAM_PRODUCT_CUSTOM_LABEL_0 = "fb_product_custom_label_0";
public static final String EVENT_PARAM_PRODUCT_CUSTOM_LABEL_1 = "fb_product_custom_label_1";
public static final String EVENT_PARAM_PRODUCT_CUSTOM_LABEL_2 = "fb_product_custom_label_2";
public static final String EVENT_PARAM_PRODUCT_CUSTOM_LABEL_3 = "fb_product_custom_label_3";
public static final String EVENT_PARAM_PRODUCT_CUSTOM_LABEL_4 = "fb_product_custom_label_4";
public static final String EVENT_PARAM_REGISTRATION_METHOD = "fb_registration_method";
public static final String EVENT_PARAM_SEARCH_STRING = "fb_search_string";
public static final String EVENT_PARAM_SOURCE_APPLICATION = "fb_mobile_launch_source";
public static final String EVENT_PARAM_SUCCESS = "fb_success";
public static final String EVENT_PARAM_VALUE_NO = "0";
public static final String EVENT_PARAM_VALUE_TO_SUM = "_valueToSum";
public static final String EVENT_PARAM_VALUE_YES = "1";
public static final AppEventsConstants INSTANCE = new AppEventsConstants();
public static /* synthetic */ void getEVENT_NAME_PURCHASED$annotations() {
}
private AppEventsConstants() {
}
}

View File

@@ -0,0 +1,303 @@
package com.facebook.appevents;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.webkit.WebView;
import androidx.annotation.RestrictTo;
import com.facebook.AccessToken;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Currency;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class AppEventsLogger {
public static final String ACTION_APP_EVENTS_FLUSHED = "com.facebook.sdk.APP_EVENTS_FLUSHED";
public static final String APP_EVENTS_EXTRA_FLUSH_RESULT = "com.facebook.sdk.APP_EVENTS_FLUSH_RESULT";
public static final String APP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED = "com.facebook.sdk.APP_EVENTS_NUM_EVENTS_FLUSHED";
public static final Companion Companion = new Companion(null);
private static final String TAG = AppEventsLogger.class.getCanonicalName();
private final AppEventsLoggerImpl loggerImpl;
public /* synthetic */ AppEventsLogger(Context context, String str, AccessToken accessToken, DefaultConstructorMarker defaultConstructorMarker) {
this(context, str, accessToken);
}
public static final void activateApp(Application application) {
Companion.activateApp(application);
}
public static final void activateApp(Application application, String str) {
Companion.activateApp(application, str);
}
public static final void augmentWebView(WebView webView, Context context) {
Companion.augmentWebView(webView, context);
}
public static final void clearUserData() {
Companion.clearUserData();
}
public static final void clearUserID() {
Companion.clearUserID();
}
public static final String getAnonymousAppDeviceGUID(Context context) {
return Companion.getAnonymousAppDeviceGUID(context);
}
public static final FlushBehavior getFlushBehavior() {
return Companion.getFlushBehavior();
}
public static final String getUserData() {
return Companion.getUserData();
}
public static final String getUserID() {
return Companion.getUserID();
}
public static final void initializeLib(Context context, String str) {
Companion.initializeLib(context, str);
}
public static final AppEventsLogger newLogger(Context context) {
return Companion.newLogger(context);
}
public static final AppEventsLogger newLogger(Context context, AccessToken accessToken) {
return Companion.newLogger(context, accessToken);
}
public static final AppEventsLogger newLogger(Context context, String str) {
return Companion.newLogger(context, str);
}
public static final AppEventsLogger newLogger(Context context, String str, AccessToken accessToken) {
return Companion.newLogger(context, str, accessToken);
}
public static final void onContextStop() {
Companion.onContextStop();
}
public static final void setFlushBehavior(FlushBehavior flushBehavior) {
Companion.setFlushBehavior(flushBehavior);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final void setInstallReferrer(String str) {
Companion.setInstallReferrer(str);
}
public static final void setPushNotificationsRegistrationId(String str) {
Companion.setPushNotificationsRegistrationId(str);
}
public static final void setUserData(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10) {
Companion.setUserData(str, str2, str3, str4, str5, str6, str7, str8, str9, str10);
}
public static final void setUserID(String str) {
Companion.setUserID(str);
}
private AppEventsLogger(Context context, String str, AccessToken accessToken) {
this.loggerImpl = new AppEventsLoggerImpl(context, str, accessToken);
}
public enum FlushBehavior {
AUTO,
EXPLICIT_ONLY;
/* renamed from: values, reason: to resolve conflict with enum method */
public static FlushBehavior[] valuesCustom() {
FlushBehavior[] valuesCustom = values();
return (FlushBehavior[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public enum ProductAvailability {
IN_STOCK,
OUT_OF_STOCK,
PREORDER,
AVALIABLE_FOR_ORDER,
DISCONTINUED;
/* renamed from: values, reason: to resolve conflict with enum method */
public static ProductAvailability[] valuesCustom() {
ProductAvailability[] valuesCustom = values();
return (ProductAvailability[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public enum ProductCondition {
NEW,
REFURBISHED,
USED;
/* renamed from: values, reason: to resolve conflict with enum method */
public static ProductCondition[] valuesCustom() {
ProductCondition[] valuesCustom = values();
return (ProductCondition[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public final void logEvent(String str) {
this.loggerImpl.logEvent(str);
}
public final void logEvent(String str, double d) {
this.loggerImpl.logEvent(str, d);
}
public final void logEvent(String str, Bundle bundle) {
this.loggerImpl.logEvent(str, bundle);
}
public final void logEvent(String str, double d, Bundle bundle) {
this.loggerImpl.logEvent(str, d, bundle);
}
public final void logPurchase(BigDecimal bigDecimal, Currency currency) {
this.loggerImpl.logPurchase(bigDecimal, currency);
}
public final void logPurchase(BigDecimal bigDecimal, Currency currency, Bundle bundle) {
this.loggerImpl.logPurchase(bigDecimal, currency, bundle);
}
public final void logPushNotificationOpen(Bundle payload) {
Intrinsics.checkNotNullParameter(payload, "payload");
this.loggerImpl.logPushNotificationOpen(payload, null);
}
public final void logPushNotificationOpen(Bundle payload, String str) {
Intrinsics.checkNotNullParameter(payload, "payload");
this.loggerImpl.logPushNotificationOpen(payload, str);
}
public final void logProductItem(String str, ProductAvailability productAvailability, ProductCondition productCondition, String str2, String str3, String str4, String str5, BigDecimal bigDecimal, Currency currency, String str6, String str7, String str8, Bundle bundle) {
this.loggerImpl.logProductItem(str, productAvailability, productCondition, str2, str3, str4, str5, bigDecimal, currency, str6, str7, str8, bundle);
}
public final void flush() {
this.loggerImpl.flush();
}
public final boolean isValidForAccessToken(AccessToken accessToken) {
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
return this.loggerImpl.isValidForAccessToken(accessToken);
}
public final String getApplicationId() {
return this.loggerImpl.getApplicationId();
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final void activateApp(Application application) {
Intrinsics.checkNotNullParameter(application, "application");
AppEventsLoggerImpl.Companion.activateApp(application, null);
}
public final void activateApp(Application application, String str) {
Intrinsics.checkNotNullParameter(application, "application");
AppEventsLoggerImpl.Companion.activateApp(application, str);
}
public final void initializeLib(Context context, String str) {
Intrinsics.checkNotNullParameter(context, "context");
AppEventsLoggerImpl.Companion.initializeLib(context, str);
}
/* JADX WARN: Multi-variable type inference failed */
public final AppEventsLogger newLogger(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return new AppEventsLogger(context, null, 0 == true ? 1 : 0, 0 == true ? 1 : 0);
}
/* JADX WARN: Multi-variable type inference failed */
public final AppEventsLogger newLogger(Context context, AccessToken accessToken) {
Intrinsics.checkNotNullParameter(context, "context");
return new AppEventsLogger(context, null, accessToken, 0 == true ? 1 : 0);
}
public final AppEventsLogger newLogger(Context context, String str, AccessToken accessToken) {
Intrinsics.checkNotNullParameter(context, "context");
return new AppEventsLogger(context, str, accessToken, null);
}
/* JADX WARN: Multi-variable type inference failed */
public final AppEventsLogger newLogger(Context context, String str) {
Intrinsics.checkNotNullParameter(context, "context");
return new AppEventsLogger(context, str, null, 0 == true ? 1 : 0);
}
public final FlushBehavior getFlushBehavior() {
return AppEventsLoggerImpl.Companion.getFlushBehavior();
}
public final void setFlushBehavior(FlushBehavior flushBehavior) {
Intrinsics.checkNotNullParameter(flushBehavior, "flushBehavior");
AppEventsLoggerImpl.Companion.setFlushBehavior(flushBehavior);
}
public final void onContextStop() {
AppEventsLoggerImpl.Companion.onContextStop();
}
public final void setPushNotificationsRegistrationId(String str) {
AppEventsLoggerImpl.Companion.setPushNotificationsRegistrationId(str);
}
public final void augmentWebView(WebView webView, Context context) {
Intrinsics.checkNotNullParameter(webView, "webView");
AppEventsLoggerImpl.Companion.augmentWebView(webView, context);
}
public final String getUserID() {
return AnalyticsUserIDStore.getUserID();
}
public final void setUserID(String str) {
AnalyticsUserIDStore.setUserID(str);
}
public final void clearUserID() {
AnalyticsUserIDStore.setUserID(null);
}
public final void setUserData(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10) {
UserDataStore.setUserDataAndHash(str, str2, str3, str4, str5, str6, str7, str8, str9, str10);
}
public final String getUserData() {
return UserDataStore.getHashedUserData$facebook_core_release();
}
public final void clearUserData() {
UserDataStore.clear();
}
public final String getAnonymousAppDeviceGUID(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return AppEventsLoggerImpl.Companion.getAnonymousAppDeviceGUID(context);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final void setInstallReferrer(String str) {
AppEventsLoggerImpl.Companion.setInstallReferrer(str);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,182 @@
package com.facebook.appevents;
import com.facebook.appevents.aam.MetadataIndexer;
import com.facebook.appevents.cloudbridge.AppEventsCAPIManager;
import com.facebook.appevents.eventdeactivation.EventDeactivationManager;
import com.facebook.appevents.iap.InAppPurchaseManager;
import com.facebook.appevents.integrity.BlocklistEventsManager;
import com.facebook.appevents.integrity.MACARuleMatchingManager;
import com.facebook.appevents.integrity.ProtectedModeManager;
import com.facebook.appevents.integrity.RedactedEventsManager;
import com.facebook.appevents.integrity.SensitiveParamsManager;
import com.facebook.appevents.ml.ModelManager;
import com.facebook.appevents.restrictivedatafilter.RestrictiveDataManager;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
/* loaded from: classes2.dex */
public final class AppEventsManager$start$1 implements FetchedAppSettingsManager.FetchedAppSettingsCallback {
@Override // com.facebook.internal.FetchedAppSettingsManager.FetchedAppSettingsCallback
public void onError() {
}
@Override // com.facebook.internal.FetchedAppSettingsManager.FetchedAppSettingsCallback
public void onSuccess(FetchedAppSettings fetchedAppSettings) {
FeatureManager featureManager = FeatureManager.INSTANCE;
FeatureManager.checkFeature(FeatureManager.Feature.AAM, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda0
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m463onSuccess$lambda0(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.RestrictiveDataFiltering, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda2
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m464onSuccess$lambda1(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.PrivacyProtection, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda3
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m466onSuccess$lambda2(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.EventDeactivation, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda4
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m467onSuccess$lambda3(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.IapLogging, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda5
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m468onSuccess$lambda4(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.ProtectedMode, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda6
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m469onSuccess$lambda5(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.MACARuleMatching, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda7
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m470onSuccess$lambda6(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.BlocklistEvents, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda8
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m471onSuccess$lambda7(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.FilterRedactedEvents, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda9
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m472onSuccess$lambda8(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.FilterSensitiveParams, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda10
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m473onSuccess$lambda9(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.CloudBridge, new FeatureManager.Callback() { // from class: com.facebook.appevents.AppEventsManager$start$1$$ExternalSyntheticLambda1
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
AppEventsManager$start$1.m465onSuccess$lambda10(z);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-0, reason: not valid java name */
public static final void m463onSuccess$lambda0(boolean z) {
if (z) {
MetadataIndexer.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-1, reason: not valid java name */
public static final void m464onSuccess$lambda1(boolean z) {
if (z) {
RestrictiveDataManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-2, reason: not valid java name */
public static final void m466onSuccess$lambda2(boolean z) {
if (z) {
ModelManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-3, reason: not valid java name */
public static final void m467onSuccess$lambda3(boolean z) {
if (z) {
EventDeactivationManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-4, reason: not valid java name */
public static final void m468onSuccess$lambda4(boolean z) {
if (z) {
InAppPurchaseManager.enableAutoLogging();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-5, reason: not valid java name */
public static final void m469onSuccess$lambda5(boolean z) {
if (z) {
ProtectedModeManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-6, reason: not valid java name */
public static final void m470onSuccess$lambda6(boolean z) {
if (z) {
MACARuleMatchingManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-7, reason: not valid java name */
public static final void m471onSuccess$lambda7(boolean z) {
if (z) {
BlocklistEventsManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-8, reason: not valid java name */
public static final void m472onSuccess$lambda8(boolean z) {
if (z) {
RedactedEventsManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-9, reason: not valid java name */
public static final void m473onSuccess$lambda9(boolean z) {
if (z) {
SensitiveParamsManager.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-10, reason: not valid java name */
public static final void m465onSuccess$lambda10(boolean z) {
if (z) {
AppEventsCAPIManager.enable();
}
}
}

View File

@@ -0,0 +1,26 @@
package com.facebook.appevents;
import androidx.annotation.RestrictTo;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class AppEventsManager {
public static final AppEventsManager INSTANCE = new AppEventsManager();
private AppEventsManager() {
}
public static final void start() {
if (CrashShieldHandler.isObjectCrashing(AppEventsManager.class)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettingsManager.getAppSettingsAsync(new AppEventsManager$start$1());
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventsManager.class);
}
}
}

View File

@@ -0,0 +1,112 @@
package com.facebook.appevents;
import android.content.Context;
import android.os.Bundle;
import android.webkit.JavascriptInterface;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.internal.Logger;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.Iterator;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class FacebookSDKJSInterface {
private static final String PARAMETER_FBSDK_PIXEL_REFERRAL = "_fb_pixel_referral_id";
private final Context context;
private final String protocol = "fbmq-0.1";
public static final Companion Companion = new Companion(null);
private static final String TAG = FacebookSDKJSInterface.class.getSimpleName();
public FacebookSDKJSInterface(Context context) {
this.context = context;
}
public static final /* synthetic */ String access$getTAG$cp() {
if (CrashShieldHandler.isObjectCrashing(FacebookSDKJSInterface.class)) {
return null;
}
try {
return TAG;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, FacebookSDKJSInterface.class);
return null;
}
}
@JavascriptInterface
public final void sendEvent(String str, String str2, String str3) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (str == null) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.DEVELOPER_ERRORS;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, TAG2, "Can't bridge an event without a referral Pixel ID. Check your webview Pixel configuration");
return;
}
InternalAppEventsLogger createInstance$default = InternalAppEventsLogger.Companion.createInstance$default(InternalAppEventsLogger.Companion, this.context, null, 2, null);
Bundle jsonStringToBundle = Companion.jsonStringToBundle(str3);
jsonStringToBundle.putString(PARAMETER_FBSDK_PIXEL_REFERRAL, str);
createInstance$default.logEvent(str2, jsonStringToBundle);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@JavascriptInterface
public final String getProtocol() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.protocol;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final String getTAG() {
return FacebookSDKJSInterface.access$getTAG$cp();
}
private final Bundle jsonToBundle(JSONObject jSONObject) throws JSONException {
Bundle bundle = new Bundle();
Iterator<String> keys = jSONObject.keys();
Intrinsics.checkNotNullExpressionValue(keys, "jsonObject.keys()");
while (keys.hasNext()) {
String next = keys.next();
if (next == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
String str = next;
bundle.putString(str, jSONObject.getString(str));
}
return bundle;
}
/* JADX INFO: Access modifiers changed from: private */
public final Bundle jsonStringToBundle(String str) {
try {
return jsonToBundle(new JSONObject(str));
} catch (JSONException unused) {
return new Bundle();
}
}
}
}

View File

@@ -0,0 +1,19 @@
package com.facebook.appevents;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum FlushReason {
EXPLICIT,
TIMER,
SESSION_CHANGE,
PERSISTED_EVENTS,
EVENT_THRESHOLD,
EAGER_FLUSHING_EVENT;
/* renamed from: values, reason: to resolve conflict with enum method */
public static FlushReason[] valuesCustom() {
FlushReason[] valuesCustom = values();
return (FlushReason[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,17 @@
package com.facebook.appevents;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum FlushResult {
SUCCESS,
SERVER_ERROR,
NO_CONNECTIVITY,
UNKNOWN_ERROR;
/* renamed from: values, reason: to resolve conflict with enum method */
public static FlushResult[] valuesCustom() {
FlushResult[] valuesCustom = values();
return (FlushResult[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,26 @@
package com.facebook.appevents;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class FlushStatistics {
private int numEvents;
private FlushResult result = FlushResult.SUCCESS;
public final int getNumEvents() {
return this.numEvents;
}
public final FlushResult getResult() {
return this.result;
}
public final void setNumEvents(int i) {
this.numEvents = i;
}
public final void setResult(FlushResult flushResult) {
Intrinsics.checkNotNullParameter(flushResult, "<set-?>");
this.result = flushResult;
}
}

View File

@@ -0,0 +1,187 @@
package com.facebook.appevents;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.RestrictTo;
import com.facebook.AccessToken;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
import java.math.BigDecimal;
import java.util.Currency;
import java.util.Map;
import java.util.concurrent.Executor;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InternalAppEventsLogger {
public static final Companion Companion = new Companion(null);
private final AppEventsLoggerImpl loggerImpl;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static final InternalAppEventsLogger createInstance(Context context) {
return Companion.createInstance(context);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static final InternalAppEventsLogger createInstance(Context context, String str) {
return Companion.createInstance(context, str);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static final InternalAppEventsLogger createInstance(String str, String str2, AccessToken accessToken) {
return Companion.createInstance(str, str2, accessToken);
}
public static final Executor getAnalyticsExecutor() {
return Companion.getAnalyticsExecutor();
}
public static final AppEventsLogger.FlushBehavior getFlushBehavior() {
return Companion.getFlushBehavior();
}
public static final String getPushNotificationsRegistrationId() {
return Companion.getPushNotificationsRegistrationId();
}
@RestrictTo({RestrictTo.Scope.GROUP_ID})
public static final void setInternalUserData(Map<String, String> map) {
Companion.setInternalUserData(map);
}
public static final void setUserData(Bundle bundle) {
Companion.setUserData(bundle);
}
public InternalAppEventsLogger(AppEventsLoggerImpl loggerImpl) {
Intrinsics.checkNotNullParameter(loggerImpl, "loggerImpl");
this.loggerImpl = loggerImpl;
}
public InternalAppEventsLogger(Context context) {
this(new AppEventsLoggerImpl(context, (String) null, (AccessToken) null));
}
public InternalAppEventsLogger(Context context, String str) {
this(new AppEventsLoggerImpl(context, str, (AccessToken) null));
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public InternalAppEventsLogger(String activityName, String str, AccessToken accessToken) {
this(new AppEventsLoggerImpl(activityName, str, accessToken));
Intrinsics.checkNotNullParameter(activityName, "activityName");
}
public final void logEvent(String str, Bundle bundle) {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logEvent(str, bundle);
}
}
public final void logEvent(String str, double d, Bundle bundle) {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logEvent(str, d, bundle);
}
}
public final void logPurchaseImplicitly(BigDecimal bigDecimal, Currency currency, Bundle bundle) {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logPurchaseImplicitly(bigDecimal, currency, bundle);
}
}
public final void logEventFromSE(String str, String str2) {
this.loggerImpl.logEventFromSE(str, str2);
}
public final void logEventImplicitly(String str, BigDecimal bigDecimal, Currency currency, Bundle bundle) {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logEventImplicitly(str, bigDecimal, currency, bundle);
}
}
public final void logEventImplicitly(String str) {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logEventImplicitly(str, null, null);
}
}
public final void logEventImplicitly(String str, Double d, Bundle bundle) {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logEventImplicitly(str, d, bundle);
}
}
public final void logEventImplicitly(String str, Bundle bundle) {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logEventImplicitly(str, null, bundle);
}
}
public final void logChangedSettingsEvent(Bundle parameters) {
Intrinsics.checkNotNullParameter(parameters, "parameters");
if (((parameters.getInt("previous") & 2) != 0) || FacebookSdk.getAutoLogAppEventsEnabled()) {
this.loggerImpl.logEventImplicitly("fb_sdk_settings_changed", null, parameters);
}
}
public final void flush() {
this.loggerImpl.flush();
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public final InternalAppEventsLogger createInstance(Context context) {
return createInstance$default(this, context, null, 2, null);
}
private Companion() {
}
public final AppEventsLogger.FlushBehavior getFlushBehavior() {
return AppEventsLoggerImpl.Companion.getFlushBehavior();
}
public final Executor getAnalyticsExecutor() {
return AppEventsLoggerImpl.Companion.getAnalyticsExecutor();
}
public final String getPushNotificationsRegistrationId() {
return AppEventsLoggerImpl.Companion.getPushNotificationsRegistrationId();
}
public final void setUserData(Bundle bundle) {
UserDataStore.setUserDataAndHash(bundle);
}
@RestrictTo({RestrictTo.Scope.GROUP_ID})
public final void setInternalUserData(Map<String, String> ud) {
Intrinsics.checkNotNullParameter(ud, "ud");
UserDataStore.setInternalUd(ud);
}
public static /* synthetic */ InternalAppEventsLogger createInstance$default(Companion companion, Context context, String str, int i, Object obj) {
if ((i & 2) != 0) {
str = null;
}
return companion.createInstance(context, str);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public final InternalAppEventsLogger createInstance(Context context, String str) {
return new InternalAppEventsLogger(context, str);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public final InternalAppEventsLogger createInstance(String activityName, String str, AccessToken accessToken) {
Intrinsics.checkNotNullParameter(activityName, "activityName");
return new InternalAppEventsLogger(activityName, str, accessToken);
}
}
}

View File

@@ -0,0 +1,151 @@
package com.facebook.appevents;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class PersistedEvents implements Serializable {
public static final Companion Companion = new Companion(null);
private static final long serialVersionUID = 20160629001L;
private final HashMap<AccessTokenAppIdPair, List<AppEvent>> events;
public PersistedEvents() {
this.events = new HashMap<>();
}
public PersistedEvents(HashMap<AccessTokenAppIdPair, List<AppEvent>> appEventMap) {
Intrinsics.checkNotNullParameter(appEventMap, "appEventMap");
HashMap<AccessTokenAppIdPair, List<AppEvent>> hashMap = new HashMap<>();
this.events = hashMap;
hashMap.putAll(appEventMap);
}
public final Set<AccessTokenAppIdPair> keySet() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Set<AccessTokenAppIdPair> keySet = this.events.keySet();
Intrinsics.checkNotNullExpressionValue(keySet, "events.keys");
return keySet;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final Set<Map.Entry<AccessTokenAppIdPair, List<AppEvent>>> entrySet() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Set<Map.Entry<AccessTokenAppIdPair, List<AppEvent>>> entrySet = this.events.entrySet();
Intrinsics.checkNotNullExpressionValue(entrySet, "events.entries");
return entrySet;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final List<AppEvent> get(AccessTokenAppIdPair accessTokenAppIdPair) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppIdPair, "accessTokenAppIdPair");
return this.events.get(accessTokenAppIdPair);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final boolean containsKey(AccessTokenAppIdPair accessTokenAppIdPair) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppIdPair, "accessTokenAppIdPair");
return this.events.containsKey(accessTokenAppIdPair);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public final void addEvents(AccessTokenAppIdPair accessTokenAppIdPair, List<AppEvent> appEvents) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(accessTokenAppIdPair, "accessTokenAppIdPair");
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
if (!this.events.containsKey(accessTokenAppIdPair)) {
this.events.put(accessTokenAppIdPair, CollectionsKt___CollectionsKt.toMutableList((Collection) appEvents));
return;
}
List<AppEvent> list = this.events.get(accessTokenAppIdPair);
if (list == null) {
return;
}
list.addAll(appEvents);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class SerializationProxyV1 implements Serializable {
public static final Companion Companion = new Companion(null);
private static final long serialVersionUID = 20160629001L;
private final HashMap<AccessTokenAppIdPair, List<AppEvent>> proxyEvents;
public SerializationProxyV1(HashMap<AccessTokenAppIdPair, List<AppEvent>> proxyEvents) {
Intrinsics.checkNotNullParameter(proxyEvents, "proxyEvents");
this.proxyEvents = proxyEvents;
}
private final Object readResolve() throws ObjectStreamException {
return new PersistedEvents(this.proxyEvents);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
private final Object writeReplace() throws ObjectStreamException {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return new SerializationProxyV1(this.events);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,186 @@
package com.facebook.appevents;
import android.content.Context;
import android.os.Bundle;
import com.facebook.GraphRequest;
import com.facebook.appevents.eventdeactivation.EventDeactivationManager;
import com.facebook.appevents.internal.AppEventsLoggerUtility;
import com.facebook.internal.AttributionIdentifiers;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class SessionEventsState {
private List<AppEvent> accumulatedEvents;
private final String anonymousAppDeviceGUID;
private final AttributionIdentifiers attributionIdentifiers;
private final List<AppEvent> inFlightEvents;
private int numSkippedEventsDueToFullBuffer;
public static final Companion Companion = new Companion(null);
private static final String TAG = SessionEventsState.class.getSimpleName();
private static final int MAX_ACCUMULATED_LOG_EVENTS = 1000;
public SessionEventsState(AttributionIdentifiers attributionIdentifiers, String anonymousAppDeviceGUID) {
Intrinsics.checkNotNullParameter(attributionIdentifiers, "attributionIdentifiers");
Intrinsics.checkNotNullParameter(anonymousAppDeviceGUID, "anonymousAppDeviceGUID");
this.attributionIdentifiers = attributionIdentifiers;
this.anonymousAppDeviceGUID = anonymousAppDeviceGUID;
this.accumulatedEvents = new ArrayList();
this.inFlightEvents = new ArrayList();
}
public final synchronized void addEvent(AppEvent event) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(event, "event");
if (this.accumulatedEvents.size() + this.inFlightEvents.size() >= MAX_ACCUMULATED_LOG_EVENTS) {
this.numSkippedEventsDueToFullBuffer++;
} else {
this.accumulatedEvents.add(event);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public final synchronized int getAccumulatedEventCount() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
return this.accumulatedEvents.size();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return 0;
}
}
public final synchronized void clearInFlightAndStats(boolean z) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
if (z) {
try {
this.accumulatedEvents.addAll(this.inFlightEvents);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return;
}
}
this.inFlightEvents.clear();
this.numSkippedEventsDueToFullBuffer = 0;
}
public final int populateRequest(GraphRequest request, Context applicationContext, boolean z, boolean z2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
Intrinsics.checkNotNullParameter(request, "request");
Intrinsics.checkNotNullParameter(applicationContext, "applicationContext");
synchronized (this) {
try {
int i = this.numSkippedEventsDueToFullBuffer;
EventDeactivationManager eventDeactivationManager = EventDeactivationManager.INSTANCE;
EventDeactivationManager.processEvents(this.accumulatedEvents);
this.inFlightEvents.addAll(this.accumulatedEvents);
this.accumulatedEvents.clear();
JSONArray jSONArray = new JSONArray();
for (AppEvent appEvent : this.inFlightEvents) {
if (appEvent.isChecksumValid()) {
if (!z && appEvent.isImplicit()) {
}
jSONArray.put(appEvent.getJsonObject());
} else {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, Intrinsics.stringPlus("Event with invalid checksum: ", appEvent));
}
}
if (jSONArray.length() == 0) {
return 0;
}
Unit unit = Unit.INSTANCE;
populateRequest(request, applicationContext, i, jSONArray, z2);
return jSONArray.length();
} catch (Throwable th) {
throw th;
}
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
return 0;
}
}
public final synchronized List<AppEvent> getEventsToPersist() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
List<AppEvent> list = this.accumulatedEvents;
this.accumulatedEvents = new ArrayList();
return list;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final synchronized void accumulatePersistedEvents(List<AppEvent> events) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(events, "events");
this.accumulatedEvents.addAll(events);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void populateRequest(GraphRequest graphRequest, Context context, int i, JSONArray jSONArray, boolean z) {
JSONObject jSONObject;
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
AppEventsLoggerUtility appEventsLoggerUtility = AppEventsLoggerUtility.INSTANCE;
jSONObject = AppEventsLoggerUtility.getJSONObjectForGraphAPICall(AppEventsLoggerUtility.GraphAPIActivityType.CUSTOM_APP_EVENTS, this.attributionIdentifiers, this.anonymousAppDeviceGUID, z, context);
if (this.numSkippedEventsDueToFullBuffer > 0) {
jSONObject.put("num_skipped_events", i);
}
} catch (JSONException unused) {
jSONObject = new JSONObject();
}
graphRequest.setGraphObject(jSONObject);
Bundle parameters = graphRequest.getParameters();
String jSONArray2 = jSONArray.toString();
Intrinsics.checkNotNullExpressionValue(jSONArray2, "events.toString()");
parameters.putString("custom_events", jSONArray2);
graphRequest.setTag(jSONArray2);
graphRequest.setParameters(parameters);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,434 @@
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;
}
}
}

View File

@@ -0,0 +1,96 @@
package com.facebook.appevents.aam;
import android.app.Activity;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import com.facebook.FacebookSdk;
import com.facebook.internal.AttributionIdentifiers;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class MetadataIndexer {
public static final MetadataIndexer INSTANCE = new MetadataIndexer();
private static final String TAG = MetadataIndexer.class.getCanonicalName();
private static boolean enabled;
private MetadataIndexer() {
}
@UiThread
public static final void onActivityResumed(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(MetadataIndexer.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
try {
if (enabled && !MetadataRule.Companion.getRules().isEmpty()) {
MetadataViewObserver.Companion.startTrackingActivity(activity);
}
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataIndexer.class);
}
}
private final void updateRules() {
String rawAamRules;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings == null || (rawAamRules = queryAppSettings.getRawAamRules()) == null) {
return;
}
MetadataRule.Companion.updateRules(rawAamRules);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final void enable() {
try {
if (CrashShieldHandler.isObjectCrashing(MetadataIndexer.class)) {
return;
}
try {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.aam.MetadataIndexer$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MetadataIndexer.m478enable$lambda0();
}
});
} catch (Exception e) {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataIndexer.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: enable$lambda-0, reason: not valid java name */
public static final void m478enable$lambda0() {
if (CrashShieldHandler.isObjectCrashing(MetadataIndexer.class)) {
return;
}
try {
if (AttributionIdentifiers.Companion.isTrackingLimited(FacebookSdk.getApplicationContext())) {
return;
}
INSTANCE.updateRules();
enabled = true;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataIndexer.class);
}
}
}

View File

@@ -0,0 +1,175 @@
package com.facebook.appevents.aam;
import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
import kotlin.text.StringsKt__StringsKt;
/* loaded from: classes2.dex */
public final class MetadataMatcher {
public static final MetadataMatcher INSTANCE = new MetadataMatcher();
private static final int MAX_INDICATOR_LENGTH = 100;
private MetadataMatcher() {
}
public static final List<String> getCurrentViewIndicators(View view) {
if (CrashShieldHandler.isObjectCrashing(MetadataMatcher.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
ArrayList<String> arrayList = new ArrayList();
arrayList.add(ViewHierarchy.getHintOfView(view));
Object tag = view.getTag();
if (tag != null) {
arrayList.add(tag.toString());
}
CharSequence contentDescription = view.getContentDescription();
if (contentDescription != null) {
arrayList.add(contentDescription.toString());
}
try {
if (view.getId() != -1) {
String resourceName = view.getResources().getResourceName(view.getId());
Intrinsics.checkNotNullExpressionValue(resourceName, "resourceName");
Object[] array = new Regex("/").split(resourceName, 0).toArray(new String[0]);
if (array == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
}
String[] strArr = (String[]) array;
if (strArr.length == 2) {
arrayList.add(strArr[1]);
}
}
} catch (Resources.NotFoundException unused) {
}
ArrayList arrayList2 = new ArrayList();
for (String str : arrayList) {
if (str.length() > 0 && str.length() <= 100) {
String lowerCase = str.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
arrayList2.add(lowerCase);
}
}
return arrayList2;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataMatcher.class);
return null;
}
}
public static final List<String> getAroundViewIndicators(View view) {
if (CrashShieldHandler.isObjectCrashing(MetadataMatcher.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
ArrayList arrayList = new ArrayList();
ViewGroup parentOfView = ViewHierarchy.getParentOfView(view);
if (parentOfView != null) {
for (View view2 : ViewHierarchy.getChildrenOfView(parentOfView)) {
if (view != view2) {
arrayList.addAll(INSTANCE.getTextIndicators(view2));
}
}
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataMatcher.class);
return null;
}
}
public static final boolean matchIndicator(List<String> indicators, List<String> keys) {
if (CrashShieldHandler.isObjectCrashing(MetadataMatcher.class)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(indicators, "indicators");
Intrinsics.checkNotNullParameter(keys, "keys");
Iterator<String> it = indicators.iterator();
while (it.hasNext()) {
if (INSTANCE.matchIndicator(it.next(), keys)) {
return true;
}
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataMatcher.class);
return false;
}
}
private final boolean matchIndicator(String str, List<String> list) {
boolean contains$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
contains$default = StringsKt__StringsKt.contains$default(str, it.next(), false, 2, null);
if (contains$default) {
return true;
}
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final boolean matchValue(String text, String rule) {
if (CrashShieldHandler.isObjectCrashing(MetadataMatcher.class)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(text, "text");
Intrinsics.checkNotNullParameter(rule, "rule");
return new Regex(rule).matches(text);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataMatcher.class);
return false;
}
}
private final List<String> getTextIndicators(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ArrayList arrayList = new ArrayList();
if (view instanceof EditText) {
return arrayList;
}
if (view instanceof TextView) {
String obj = ((TextView) view).getText().toString();
if (obj.length() > 0 && obj.length() < 100) {
String lowerCase = obj.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
arrayList.add(lowerCase);
}
return arrayList;
}
Iterator<View> it = ViewHierarchy.getChildrenOfView(view).iterator();
while (it.hasNext()) {
arrayList.addAll(getTextIndicators(it.next()));
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,173 @@
package com.facebook.appevents.aam;
import androidx.annotation.RestrictTo;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class MetadataRule {
private static final String FIELD_K = "k";
private static final String FIELD_K_DELIMITER = ",";
private static final String FIELD_V = "v";
private final List<String> keyRules;
private final String name;
private final String valRule;
public static final Companion Companion = new Companion(null);
private static final Set<MetadataRule> rules = new CopyOnWriteArraySet();
public /* synthetic */ MetadataRule(String str, List list, String str2, DefaultConstructorMarker defaultConstructorMarker) {
this(str, list, str2);
}
public static final Set<String> getEnabledRuleNames() {
if (CrashShieldHandler.isObjectCrashing(MetadataRule.class)) {
return null;
}
try {
return Companion.getEnabledRuleNames();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataRule.class);
return null;
}
}
public static final Set<MetadataRule> getRules() {
if (CrashShieldHandler.isObjectCrashing(MetadataRule.class)) {
return null;
}
try {
return Companion.getRules();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataRule.class);
return null;
}
}
public static final void updateRules(String str) {
if (CrashShieldHandler.isObjectCrashing(MetadataRule.class)) {
return;
}
try {
Companion.updateRules(str);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataRule.class);
}
}
private MetadataRule(String str, List<String> list, String str2) {
this.name = str;
this.valRule = str2;
this.keyRules = list;
}
public static final /* synthetic */ Set access$getRules$cp() {
if (CrashShieldHandler.isObjectCrashing(MetadataRule.class)) {
return null;
}
try {
return rules;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataRule.class);
return null;
}
}
public final String getName() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.name;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final String getValRule() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.valRule;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Set<MetadataRule> getRules() {
return new HashSet(MetadataRule.access$getRules$cp());
}
public final void updateRules(String rulesFromServer) {
Intrinsics.checkNotNullParameter(rulesFromServer, "rulesFromServer");
try {
MetadataRule.access$getRules$cp().clear();
constructRules(new JSONObject(rulesFromServer));
} catch (JSONException unused) {
}
}
public final Set<String> getEnabledRuleNames() {
HashSet hashSet = new HashSet();
Iterator it = MetadataRule.access$getRules$cp().iterator();
while (it.hasNext()) {
hashSet.add(((MetadataRule) it.next()).getName());
}
return hashSet;
}
private final void constructRules(JSONObject jSONObject) {
List split$default;
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String key = keys.next();
JSONObject optJSONObject = jSONObject.optJSONObject(key);
if (optJSONObject != null) {
String k = optJSONObject.optString("k");
String v = optJSONObject.optString("v");
Intrinsics.checkNotNullExpressionValue(k, "k");
if (k.length() != 0) {
Set access$getRules$cp = MetadataRule.access$getRules$cp();
Intrinsics.checkNotNullExpressionValue(key, "key");
split$default = StringsKt__StringsKt.split$default((CharSequence) k, new String[]{MetadataRule.FIELD_K_DELIMITER}, false, 0, 6, (Object) null);
Intrinsics.checkNotNullExpressionValue(v, "v");
access$getRules$cp.add(new MetadataRule(key, split$default, v, null));
}
}
}
}
}
public final List<String> getKeyRules() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return new ArrayList(this.keyRules);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,402 @@
package com.facebook.appevents.aam;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.EditText;
import androidx.annotation.UiThread;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
import kotlin.text.StringsKt__StringsKt;
/* loaded from: classes2.dex */
public final class MetadataViewObserver implements ViewTreeObserver.OnGlobalFocusChangeListener {
private static final int MAX_TEXT_LENGTH = 100;
private final WeakReference<Activity> activityWeakReference;
private final AtomicBoolean isTracking;
private final Set<String> processedText;
private final Handler uiThreadHandler;
public static final Companion Companion = new Companion(null);
private static final Map<Integer, MetadataViewObserver> observers = new HashMap();
public /* synthetic */ MetadataViewObserver(Activity activity, DefaultConstructorMarker defaultConstructorMarker) {
this(activity);
}
@UiThread
public static final void startTrackingActivity(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(MetadataViewObserver.class)) {
return;
}
try {
Companion.startTrackingActivity(activity);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataViewObserver.class);
}
}
@UiThread
public static final void stopTrackingActivity(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(MetadataViewObserver.class)) {
return;
}
try {
Companion.stopTrackingActivity(activity);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataViewObserver.class);
}
}
private MetadataViewObserver(Activity activity) {
this.processedText = new LinkedHashSet();
this.uiThreadHandler = new Handler(Looper.getMainLooper());
this.activityWeakReference = new WeakReference<>(activity);
this.isTracking = new AtomicBoolean(false);
}
public static final /* synthetic */ Map access$getObservers$cp() {
if (CrashShieldHandler.isObjectCrashing(MetadataViewObserver.class)) {
return null;
}
try {
return observers;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataViewObserver.class);
return null;
}
}
public static final /* synthetic */ void access$startTracking(MetadataViewObserver metadataViewObserver) {
if (CrashShieldHandler.isObjectCrashing(MetadataViewObserver.class)) {
return;
}
try {
metadataViewObserver.startTracking();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataViewObserver.class);
}
}
public static final /* synthetic */ void access$stopTracking(MetadataViewObserver metadataViewObserver) {
if (CrashShieldHandler.isObjectCrashing(MetadataViewObserver.class)) {
return;
}
try {
metadataViewObserver.stopTracking();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataViewObserver.class);
}
}
private final void startTracking() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (this.isTracking.getAndSet(true)) {
return;
}
AppEventUtility appEventUtility = AppEventUtility.INSTANCE;
View rootView = AppEventUtility.getRootView(this.activityWeakReference.get());
if (rootView == null) {
return;
}
ViewTreeObserver viewTreeObserver = rootView.getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.addOnGlobalFocusChangeListener(this);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void stopTracking() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (this.isTracking.getAndSet(false)) {
AppEventUtility appEventUtility = AppEventUtility.INSTANCE;
View rootView = AppEventUtility.getRootView(this.activityWeakReference.get());
if (rootView == null) {
return;
}
ViewTreeObserver viewTreeObserver = rootView.getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.removeOnGlobalFocusChangeListener(this);
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // android.view.ViewTreeObserver.OnGlobalFocusChangeListener
public void onGlobalFocusChanged(View view, View view2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
if (view != null) {
try {
process(view);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return;
}
}
if (view2 != null) {
process(view2);
}
}
private final void process(final View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
runOnUIThread(new Runnable() { // from class: com.facebook.appevents.aam.MetadataViewObserver$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MetadataViewObserver.m480process$lambda0(view, this);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: process$lambda-0, reason: not valid java name */
public static final void m480process$lambda0(View view, MetadataViewObserver this$0) {
if (CrashShieldHandler.isObjectCrashing(MetadataViewObserver.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(view, "$view");
Intrinsics.checkNotNullParameter(this$0, "this$0");
if (view instanceof EditText) {
this$0.processEditText(view);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MetadataViewObserver.class);
}
}
private final void processEditText(View view) {
CharSequence trim;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
String obj = ((EditText) view).getText().toString();
if (obj == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
}
trim = StringsKt__StringsKt.trim(obj);
String obj2 = trim.toString();
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()");
if (lowerCase.length() != 0 && !this.processedText.contains(lowerCase) && lowerCase.length() <= 100) {
this.processedText.add(lowerCase);
HashMap hashMap = new HashMap();
List<String> currentViewIndicators = MetadataMatcher.getCurrentViewIndicators(view);
List<String> list = null;
for (MetadataRule metadataRule : MetadataRule.Companion.getRules()) {
Companion companion = Companion;
String preNormalize = companion.preNormalize(metadataRule.getName(), lowerCase);
if (metadataRule.getValRule().length() > 0) {
MetadataMatcher metadataMatcher = MetadataMatcher.INSTANCE;
if (!MetadataMatcher.matchValue(preNormalize, metadataRule.getValRule())) {
}
}
MetadataMatcher metadataMatcher2 = MetadataMatcher.INSTANCE;
if (!MetadataMatcher.matchIndicator(currentViewIndicators, metadataRule.getKeyRules())) {
if (list == null) {
list = MetadataMatcher.getAroundViewIndicators(view);
}
if (MetadataMatcher.matchIndicator(list, metadataRule.getKeyRules())) {
companion.putUserData(hashMap, metadataRule.getName(), preNormalize);
}
} else {
companion.putUserData(hashMap, metadataRule.getName(), preNormalize);
}
}
InternalAppEventsLogger.Companion.setInternalUserData(hashMap);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void runOnUIThread(Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
runnable.run();
} else {
this.uiThreadHandler.post(runnable);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
@UiThread
public final void startTrackingActivity(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
int hashCode = activity.hashCode();
Map access$getObservers$cp = MetadataViewObserver.access$getObservers$cp();
Integer valueOf = Integer.valueOf(hashCode);
Object obj = access$getObservers$cp.get(valueOf);
if (obj == null) {
obj = new MetadataViewObserver(activity, null);
access$getObservers$cp.put(valueOf, obj);
}
MetadataViewObserver.access$startTracking((MetadataViewObserver) obj);
}
@UiThread
public final void stopTrackingActivity(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
MetadataViewObserver metadataViewObserver = (MetadataViewObserver) MetadataViewObserver.access$getObservers$cp().remove(Integer.valueOf(activity.hashCode()));
if (metadataViewObserver == null) {
return;
}
MetadataViewObserver.access$stopTracking(metadataViewObserver);
}
/* JADX INFO: Access modifiers changed from: private */
public final String preNormalize(String str, String str2) {
return Intrinsics.areEqual("r2", str) ? new Regex("[^\\d.]").replace(str2, "") : str2;
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Code restructure failed: missing block: B:14:0x0044, code lost:
if (r7.equals("r5") == false) goto L34;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x0050, code lost:
r8 = new kotlin.text.Regex("[^a-z]+").replace(r8, "");
*/
/* JADX WARN: Code restructure failed: missing block: B:17:0x004d, code lost:
if (r7.equals("r4") == false) goto L34;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void putUserData(java.util.Map<java.lang.String, java.lang.String> r6, java.lang.String r7, java.lang.String r8) {
/*
r5 = this;
int r0 = r7.hashCode()
r1 = 0
r2 = 2
r3 = 0
switch(r0) {
case 3585: goto L5e;
case 3586: goto L47;
case 3587: goto L3e;
case 3588: goto Lc;
default: goto La;
}
La:
goto L84
Lc:
java.lang.String r0 = "r6"
boolean r0 = r7.equals(r0)
if (r0 != 0) goto L16
goto L84
L16:
java.lang.String r0 = "-"
boolean r1 = kotlin.text.StringsKt.contains$default(r8, r0, r3, r2, r1)
if (r1 == 0) goto L84
kotlin.text.Regex r1 = new kotlin.text.Regex
r1.<init>(r0)
java.util.List r8 = r1.split(r8, r3)
java.util.Collection r8 = (java.util.Collection) r8
java.lang.String[] r0 = new java.lang.String[r3]
java.lang.Object[] r8 = r8.toArray(r0)
if (r8 == 0) goto L36
java.lang.String[] r8 = (java.lang.String[]) r8
r8 = r8[r3]
goto L84
L36:
java.lang.NullPointerException r6 = new java.lang.NullPointerException
java.lang.String r7 = "null cannot be cast to non-null type kotlin.Array<T>"
r6.<init>(r7)
throw r6
L3e:
java.lang.String r0 = "r5"
boolean r0 = r7.equals(r0)
if (r0 != 0) goto L50
goto L84
L47:
java.lang.String r0 = "r4"
boolean r0 = r7.equals(r0)
if (r0 != 0) goto L50
goto L84
L50:
kotlin.text.Regex r0 = new kotlin.text.Regex
java.lang.String r1 = "[^a-z]+"
r0.<init>(r1)
java.lang.String r1 = ""
java.lang.String r8 = r0.replace(r8, r1)
goto L84
L5e:
java.lang.String r0 = "r3"
boolean r0 = r7.equals(r0)
if (r0 != 0) goto L67
goto L84
L67:
java.lang.String r0 = "m"
boolean r4 = kotlin.text.StringsKt.startsWith$default(r8, r0, r3, r2, r1)
if (r4 != 0) goto L83
java.lang.String r4 = "b"
boolean r4 = kotlin.text.StringsKt.startsWith$default(r8, r4, r3, r2, r1)
if (r4 != 0) goto L83
java.lang.String r4 = "ge"
boolean r8 = kotlin.text.StringsKt.startsWith$default(r8, r4, r3, r2, r1)
if (r8 == 0) goto L80
goto L83
L80:
java.lang.String r8 = "f"
goto L84
L83:
r8 = r0
L84:
r6.put(r7, r8)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.aam.MetadataViewObserver.Companion.putUserData(java.util.Map, java.lang.String, java.lang.String):void");
}
}
}

View File

@@ -0,0 +1,34 @@
package com.facebook.appevents.cloudbridge;
import java.util.Arrays;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public enum AppEventType {
MOBILE_APP_INSTALL,
CUSTOM,
OTHER;
public static final Companion Companion = new Companion(null);
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final AppEventType invoke(String rawValue) {
Intrinsics.checkNotNullParameter(rawValue, "rawValue");
return Intrinsics.areEqual(rawValue, "MOBILE_APP_INSTALL") ? AppEventType.MOBILE_APP_INSTALL : Intrinsics.areEqual(rawValue, "CUSTOM_APP_EVENTS") ? AppEventType.CUSTOM : AppEventType.OTHER;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static AppEventType[] valuesCustom() {
AppEventType[] valuesCustom = values();
return (AppEventType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,63 @@
package com.facebook.appevents.cloudbridge;
import com.applovin.sdk.AppLovinEventParameters;
import java.util.Arrays;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public enum AppEventUserAndAppDataField {
ANON_ID("anon_id"),
APP_USER_ID("app_user_id"),
ADVERTISER_ID("advertiser_id"),
PAGE_ID("page_id"),
PAGE_SCOPED_USER_ID("page_scoped_user_id"),
USER_DATA("ud"),
ADV_TE("advertiser_tracking_enabled"),
APP_TE("application_tracking_enabled"),
CONSIDER_VIEWS("consider_views"),
DEVICE_TOKEN("device_token"),
EXT_INFO("extInfo"),
INCLUDE_DWELL_DATA("include_dwell_data"),
INCLUDE_VIDEO_DATA("include_video_data"),
INSTALL_REFERRER("install_referrer"),
INSTALLER_PACKAGE("installer_package"),
RECEIPT_DATA(AppLovinEventParameters.IN_APP_PURCHASE_DATA),
URL_SCHEMES("url_schemes");
public static final Companion Companion = new Companion(null);
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
AppEventUserAndAppDataField(String str) {
this.rawValue = str;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final AppEventUserAndAppDataField invoke(String rawValue) {
Intrinsics.checkNotNullParameter(rawValue, "rawValue");
for (AppEventUserAndAppDataField appEventUserAndAppDataField : AppEventUserAndAppDataField.valuesCustom()) {
if (Intrinsics.areEqual(appEventUserAndAppDataField.getRawValue(), rawValue)) {
return appEventUserAndAppDataField;
}
}
return null;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static AppEventUserAndAppDataField[] valuesCustom() {
AppEventUserAndAppDataField[] valuesCustom = values();
return (AppEventUserAndAppDataField[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,229 @@
package com.facebook.appevents.cloudbridge;
import android.content.SharedPreferences;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.facebook.LoggingBehavior;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class AppEventsCAPIManager {
private static final String SETTINGS_PATH = "/cloudbridge_settings";
private static boolean isEnabled;
public static final AppEventsCAPIManager INSTANCE = new AppEventsCAPIManager();
private static final String TAG = AppEventsCAPIManager.class.getCanonicalName();
public final boolean isEnabled$facebook_core_release() {
return isEnabled;
}
public final void setEnabled$facebook_core_release(boolean z) {
isEnabled = z;
}
private AppEventsCAPIManager() {
}
public static final Map<String, Object> getSavedCloudBridgeCredentials$facebook_core_release() {
if (CrashShieldHandler.isObjectCrashing(AppEventsCAPIManager.class)) {
return null;
}
try {
SharedPreferences sharedPreferences = FacebookSdk.getApplicationContext().getSharedPreferences(FacebookSdk.CLOUDBRIDGE_SAVED_CREDENTIALS, 0);
if (sharedPreferences == null) {
return null;
}
SettingsAPIFields settingsAPIFields = SettingsAPIFields.DATASETID;
String string = sharedPreferences.getString(settingsAPIFields.getRawValue(), null);
SettingsAPIFields settingsAPIFields2 = SettingsAPIFields.URL;
String string2 = sharedPreferences.getString(settingsAPIFields2.getRawValue(), null);
SettingsAPIFields settingsAPIFields3 = SettingsAPIFields.ACCESSKEY;
String string3 = sharedPreferences.getString(settingsAPIFields3.getRawValue(), null);
if (string != null && !StringsKt__StringsJVMKt.isBlank(string) && string2 != null && !StringsKt__StringsJVMKt.isBlank(string2) && string3 != null && !StringsKt__StringsJVMKt.isBlank(string3)) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.put(settingsAPIFields2.getRawValue(), string2);
linkedHashMap.put(settingsAPIFields.getRawValue(), string);
linkedHashMap.put(settingsAPIFields3.getRawValue(), string3);
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG.toString(), " \n\nLoading Cloudbridge settings from saved Prefs: \n================\n DATASETID: %s\n URL: %s \n ACCESSKEY: %s \n\n ", string, string2, string3);
return linkedHashMap;
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventsCAPIManager.class);
return null;
}
}
public final void setSavedCloudBridgeCredentials$facebook_core_release(Map<String, ? extends Object> map) {
SharedPreferences sharedPreferences = FacebookSdk.getApplicationContext().getSharedPreferences(FacebookSdk.CLOUDBRIDGE_SAVED_CREDENTIALS, 0);
if (sharedPreferences == null) {
return;
}
if (map == null) {
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.clear();
edit.apply();
return;
}
SettingsAPIFields settingsAPIFields = SettingsAPIFields.DATASETID;
Object obj = map.get(settingsAPIFields.getRawValue());
SettingsAPIFields settingsAPIFields2 = SettingsAPIFields.URL;
Object obj2 = map.get(settingsAPIFields2.getRawValue());
SettingsAPIFields settingsAPIFields3 = SettingsAPIFields.ACCESSKEY;
Object obj3 = map.get(settingsAPIFields3.getRawValue());
if (obj == null || obj2 == null || obj3 == null) {
return;
}
SharedPreferences.Editor edit2 = sharedPreferences.edit();
edit2.putString(settingsAPIFields.getRawValue(), obj.toString());
edit2.putString(settingsAPIFields2.getRawValue(), obj2.toString());
edit2.putString(settingsAPIFields3.getRawValue(), obj3.toString());
edit2.apply();
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG.toString(), " \n\nSaving Cloudbridge settings from saved Prefs: \n================\n DATASETID: %s\n URL: %s \n ACCESSKEY: %s \n\n ", obj, obj2, obj3);
}
public static final void enable() {
String stackTraceToString;
try {
GraphRequest graphRequest = new GraphRequest(null, Intrinsics.stringPlus(FacebookSdk.getApplicationId(), SETTINGS_PATH), null, HttpMethod.GET, new GraphRequest.Callback() { // from class: com.facebook.appevents.cloudbridge.AppEventsCAPIManager$$ExternalSyntheticLambda0
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
AppEventsCAPIManager.m482enable$lambda0(graphResponse);
}
}, null, 32, null);
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
String str = TAG;
if (str != null) {
companion.log(loggingBehavior, str, " \n\nCreating Graph Request: \n=============\n%s\n\n ", graphRequest);
graphRequest.executeAsync();
return;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
} catch (JSONException e) {
Logger.Companion companion2 = Logger.Companion;
LoggingBehavior loggingBehavior2 = LoggingBehavior.APP_EVENTS;
String str2 = TAG;
if (str2 == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
stackTraceToString = ExceptionsKt__ExceptionsKt.stackTraceToString(e);
companion2.log(loggingBehavior2, str2, " \n\nGraph Request Exception: \n=============\n%s\n\n ", stackTraceToString);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: enable$lambda-0, reason: not valid java name */
public static final void m482enable$lambda0(GraphResponse response) {
Intrinsics.checkNotNullParameter(response, "response");
INSTANCE.getCAPIGSettingsFromGraphResponse$facebook_core_release(response);
}
public final void getCAPIGSettingsFromGraphResponse$facebook_core_release(GraphResponse response) {
String stackTraceToString;
String stackTraceToString2;
Object firstOrNull;
String stackTraceToString3;
boolean z;
Intrinsics.checkNotNullParameter(response, "response");
if (response.getError() != null) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
String str = TAG;
if (str != null) {
companion.log(loggingBehavior, str, " \n\nGraph Response Error: \n================\nResponse Error: %s\nResponse Error Exception: %s\n\n ", response.getError().toString(), String.valueOf(response.getError().getException()));
Map<String, Object> savedCloudBridgeCredentials$facebook_core_release = getSavedCloudBridgeCredentials$facebook_core_release();
if (savedCloudBridgeCredentials$facebook_core_release != null) {
URL url = new URL(String.valueOf(savedCloudBridgeCredentials$facebook_core_release.get(SettingsAPIFields.URL.getRawValue())));
AppEventsConversionsAPITransformerWebRequests appEventsConversionsAPITransformerWebRequests = AppEventsConversionsAPITransformerWebRequests.INSTANCE;
AppEventsConversionsAPITransformerWebRequests.configure(String.valueOf(savedCloudBridgeCredentials$facebook_core_release.get(SettingsAPIFields.DATASETID.getRawValue())), url.getProtocol() + "://" + ((Object) url.getHost()), String.valueOf(savedCloudBridgeCredentials$facebook_core_release.get(SettingsAPIFields.ACCESSKEY.getRawValue())));
isEnabled = true;
return;
}
return;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
Logger.Companion companion2 = Logger.Companion;
LoggingBehavior loggingBehavior2 = LoggingBehavior.APP_EVENTS;
String TAG2 = TAG;
if (TAG2 != null) {
companion2.log(loggingBehavior2, TAG2, " \n\nGraph Response Received: \n================\n%s\n\n ", response);
JSONObject jSONObject = response.getJSONObject();
try {
Utility utility = Utility.INSTANCE;
Object obj = jSONObject == null ? null : jSONObject.get("data");
if (obj == null) {
throw new NullPointerException("null cannot be cast to non-null type org.json.JSONArray");
}
firstOrNull = CollectionsKt___CollectionsKt.firstOrNull((List) Utility.convertJSONArrayToList((JSONArray) obj));
Map<String, ? extends Object> convertJSONObjectToHashMap = Utility.convertJSONObjectToHashMap(new JSONObject((String) firstOrNull));
String str2 = (String) convertJSONObjectToHashMap.get(SettingsAPIFields.URL.getRawValue());
String str3 = (String) convertJSONObjectToHashMap.get(SettingsAPIFields.DATASETID.getRawValue());
String str4 = (String) convertJSONObjectToHashMap.get(SettingsAPIFields.ACCESSKEY.getRawValue());
if (str2 == null || str3 == null || str4 == null) {
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion2.log(loggingBehavior2, TAG2, "CloudBridge Settings API response doesn't have valid data");
return;
}
try {
AppEventsConversionsAPITransformerWebRequests.configure(str3, str2, str4);
setSavedCloudBridgeCredentials$facebook_core_release(convertJSONObjectToHashMap);
SettingsAPIFields settingsAPIFields = SettingsAPIFields.ENABLED;
if (convertJSONObjectToHashMap.get(settingsAPIFields.getRawValue()) != null) {
Object obj2 = convertJSONObjectToHashMap.get(settingsAPIFields.getRawValue());
if (obj2 == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Boolean");
}
z = ((Boolean) obj2).booleanValue();
} else {
z = false;
}
isEnabled = z;
return;
} catch (MalformedURLException e) {
Logger.Companion companion3 = Logger.Companion;
LoggingBehavior loggingBehavior3 = LoggingBehavior.APP_EVENTS;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
stackTraceToString3 = ExceptionsKt__ExceptionsKt.stackTraceToString(e);
companion3.log(loggingBehavior3, TAG3, "CloudBridge Settings API response doesn't have valid url\n %s ", stackTraceToString3);
return;
}
} catch (NullPointerException e2) {
Logger.Companion companion4 = Logger.Companion;
LoggingBehavior loggingBehavior4 = LoggingBehavior.APP_EVENTS;
String TAG4 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG4, "TAG");
stackTraceToString2 = ExceptionsKt__ExceptionsKt.stackTraceToString(e2);
companion4.log(loggingBehavior4, TAG4, "CloudBridge Settings API response is not a valid json: \n%s ", stackTraceToString2);
return;
} catch (JSONException e3) {
Logger.Companion companion5 = Logger.Companion;
LoggingBehavior loggingBehavior5 = LoggingBehavior.APP_EVENTS;
String TAG5 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG5, "TAG");
stackTraceToString = ExceptionsKt__ExceptionsKt.stackTraceToString(e3);
companion5.log(loggingBehavior5, TAG5, "CloudBridge Settings API response is not a valid json: \n%s ", stackTraceToString);
return;
}
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
}

View File

@@ -0,0 +1,603 @@
package com.facebook.appevents.cloudbridge;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.cloudbridge.AppEventType;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringNumberConversionsKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class AppEventsConversionsAPITransformer {
public static final AppEventsConversionsAPITransformer INSTANCE = new AppEventsConversionsAPITransformer();
public static final String TAG = "AppEventsConversionsAPITransformer";
public static final Map<CustomEventField, SectionCustomEventFieldMapping> customEventTransformations;
public static final Map<String, ConversionsAPIEventName> standardEventTransformations;
private static final Map<AppEventUserAndAppDataField, SectionFieldMapping> topLevelTransformations;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
public static final /* synthetic */ int[] $EnumSwitchMapping$2;
static {
int[] iArr = new int[ValueTransformationType.valuesCustom().length];
iArr[ValueTransformationType.ARRAY.ordinal()] = 1;
iArr[ValueTransformationType.BOOL.ordinal()] = 2;
iArr[ValueTransformationType.INT.ordinal()] = 3;
$EnumSwitchMapping$0 = iArr;
int[] iArr2 = new int[ConversionsAPISection.valuesCustom().length];
iArr2[ConversionsAPISection.APP_DATA.ordinal()] = 1;
iArr2[ConversionsAPISection.USER_DATA.ordinal()] = 2;
$EnumSwitchMapping$1 = iArr2;
int[] iArr3 = new int[AppEventType.valuesCustom().length];
iArr3[AppEventType.MOBILE_APP_INSTALL.ordinal()] = 1;
iArr3[AppEventType.CUSTOM.ordinal()] = 2;
$EnumSwitchMapping$2 = iArr3;
}
}
private AppEventsConversionsAPITransformer() {
}
public static final class SectionFieldMapping {
private ConversionsAPIUserAndAppDataField field;
private ConversionsAPISection section;
public static /* synthetic */ SectionFieldMapping copy$default(SectionFieldMapping sectionFieldMapping, ConversionsAPISection conversionsAPISection, ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField, int i, Object obj) {
if ((i & 1) != 0) {
conversionsAPISection = sectionFieldMapping.section;
}
if ((i & 2) != 0) {
conversionsAPIUserAndAppDataField = sectionFieldMapping.field;
}
return sectionFieldMapping.copy(conversionsAPISection, conversionsAPIUserAndAppDataField);
}
public final ConversionsAPISection component1() {
return this.section;
}
public final ConversionsAPIUserAndAppDataField component2() {
return this.field;
}
public final SectionFieldMapping copy(ConversionsAPISection section, ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField) {
Intrinsics.checkNotNullParameter(section, "section");
return new SectionFieldMapping(section, conversionsAPIUserAndAppDataField);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SectionFieldMapping)) {
return false;
}
SectionFieldMapping sectionFieldMapping = (SectionFieldMapping) obj;
return this.section == sectionFieldMapping.section && this.field == sectionFieldMapping.field;
}
public final ConversionsAPIUserAndAppDataField getField() {
return this.field;
}
public final ConversionsAPISection getSection() {
return this.section;
}
public int hashCode() {
int hashCode = this.section.hashCode() * 31;
ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField = this.field;
return hashCode + (conversionsAPIUserAndAppDataField == null ? 0 : conversionsAPIUserAndAppDataField.hashCode());
}
public final void setField(ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField) {
this.field = conversionsAPIUserAndAppDataField;
}
public final void setSection(ConversionsAPISection conversionsAPISection) {
Intrinsics.checkNotNullParameter(conversionsAPISection, "<set-?>");
this.section = conversionsAPISection;
}
public String toString() {
return "SectionFieldMapping(section=" + this.section + ", field=" + this.field + ')';
}
public SectionFieldMapping(ConversionsAPISection section, ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField) {
Intrinsics.checkNotNullParameter(section, "section");
this.section = section;
this.field = conversionsAPIUserAndAppDataField;
}
}
static {
Map<AppEventUserAndAppDataField, SectionFieldMapping> mapOf;
Map<CustomEventField, SectionCustomEventFieldMapping> mapOf2;
Map<String, ConversionsAPIEventName> mapOf3;
AppEventUserAndAppDataField appEventUserAndAppDataField = AppEventUserAndAppDataField.ANON_ID;
ConversionsAPISection conversionsAPISection = ConversionsAPISection.USER_DATA;
Pair pair = TuplesKt.to(appEventUserAndAppDataField, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.ANON_ID));
Pair pair2 = TuplesKt.to(AppEventUserAndAppDataField.APP_USER_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.FB_LOGIN_ID));
Pair pair3 = TuplesKt.to(AppEventUserAndAppDataField.ADVERTISER_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.MAD_ID));
Pair pair4 = TuplesKt.to(AppEventUserAndAppDataField.PAGE_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.PAGE_ID));
Pair pair5 = TuplesKt.to(AppEventUserAndAppDataField.PAGE_SCOPED_USER_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.PAGE_SCOPED_USER_ID));
AppEventUserAndAppDataField appEventUserAndAppDataField2 = AppEventUserAndAppDataField.ADV_TE;
ConversionsAPISection conversionsAPISection2 = ConversionsAPISection.APP_DATA;
mapOf = MapsKt__MapsKt.mapOf(pair, pair2, pair3, pair4, pair5, TuplesKt.to(appEventUserAndAppDataField2, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.ADV_TE)), TuplesKt.to(AppEventUserAndAppDataField.APP_TE, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.APP_TE)), TuplesKt.to(AppEventUserAndAppDataField.CONSIDER_VIEWS, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.CONSIDER_VIEWS)), TuplesKt.to(AppEventUserAndAppDataField.DEVICE_TOKEN, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.DEVICE_TOKEN)), TuplesKt.to(AppEventUserAndAppDataField.EXT_INFO, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.EXT_INFO)), TuplesKt.to(AppEventUserAndAppDataField.INCLUDE_DWELL_DATA, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INCLUDE_DWELL_DATA)), TuplesKt.to(AppEventUserAndAppDataField.INCLUDE_VIDEO_DATA, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INCLUDE_VIDEO_DATA)), TuplesKt.to(AppEventUserAndAppDataField.INSTALL_REFERRER, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INSTALL_REFERRER)), TuplesKt.to(AppEventUserAndAppDataField.INSTALLER_PACKAGE, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INSTALLER_PACKAGE)), TuplesKt.to(AppEventUserAndAppDataField.RECEIPT_DATA, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.RECEIPT_DATA)), TuplesKt.to(AppEventUserAndAppDataField.URL_SCHEMES, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.URL_SCHEMES)), TuplesKt.to(AppEventUserAndAppDataField.USER_DATA, new SectionFieldMapping(conversionsAPISection, null)));
topLevelTransformations = mapOf;
Pair pair6 = TuplesKt.to(CustomEventField.EVENT_TIME, new SectionCustomEventFieldMapping(null, ConversionsAPICustomEventField.EVENT_TIME));
Pair pair7 = TuplesKt.to(CustomEventField.EVENT_NAME, new SectionCustomEventFieldMapping(null, ConversionsAPICustomEventField.EVENT_NAME));
CustomEventField customEventField = CustomEventField.VALUE_TO_SUM;
ConversionsAPISection conversionsAPISection3 = ConversionsAPISection.CUSTOM_DATA;
mapOf2 = MapsKt__MapsKt.mapOf(pair6, pair7, TuplesKt.to(customEventField, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.VALUE_TO_SUM)), TuplesKt.to(CustomEventField.CONTENT_IDS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CONTENT_IDS)), TuplesKt.to(CustomEventField.CONTENTS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CONTENTS)), TuplesKt.to(CustomEventField.CONTENT_TYPE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CONTENT_TYPE)), TuplesKt.to(CustomEventField.CURRENCY, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CURRENCY)), TuplesKt.to(CustomEventField.DESCRIPTION, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.DESCRIPTION)), TuplesKt.to(CustomEventField.LEVEL, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.LEVEL)), TuplesKt.to(CustomEventField.MAX_RATING_VALUE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.MAX_RATING_VALUE)), TuplesKt.to(CustomEventField.NUM_ITEMS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.NUM_ITEMS)), TuplesKt.to(CustomEventField.PAYMENT_INFO_AVAILABLE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.PAYMENT_INFO_AVAILABLE)), TuplesKt.to(CustomEventField.REGISTRATION_METHOD, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.REGISTRATION_METHOD)), TuplesKt.to(CustomEventField.SEARCH_STRING, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.SEARCH_STRING)), TuplesKt.to(CustomEventField.SUCCESS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.SUCCESS)), TuplesKt.to(CustomEventField.ORDER_ID, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.ORDER_ID)), TuplesKt.to(CustomEventField.AD_TYPE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.AD_TYPE)));
customEventTransformations = mapOf2;
mapOf3 = MapsKt__MapsKt.mapOf(TuplesKt.to(AppEventsConstants.EVENT_NAME_UNLOCKED_ACHIEVEMENT, ConversionsAPIEventName.UNLOCKED_ACHIEVEMENT), TuplesKt.to(AppEventsConstants.EVENT_NAME_ACTIVATED_APP, ConversionsAPIEventName.ACTIVATED_APP), TuplesKt.to(AppEventsConstants.EVENT_NAME_ADDED_PAYMENT_INFO, ConversionsAPIEventName.ADDED_PAYMENT_INFO), TuplesKt.to(AppEventsConstants.EVENT_NAME_ADDED_TO_CART, ConversionsAPIEventName.ADDED_TO_CART), TuplesKt.to(AppEventsConstants.EVENT_NAME_ADDED_TO_WISHLIST, ConversionsAPIEventName.ADDED_TO_WISHLIST), TuplesKt.to(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION, ConversionsAPIEventName.COMPLETED_REGISTRATION), TuplesKt.to(AppEventsConstants.EVENT_NAME_VIEWED_CONTENT, ConversionsAPIEventName.VIEWED_CONTENT), TuplesKt.to(AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT, ConversionsAPIEventName.INITIATED_CHECKOUT), TuplesKt.to(AppEventsConstants.EVENT_NAME_ACHIEVED_LEVEL, ConversionsAPIEventName.ACHIEVED_LEVEL), TuplesKt.to(AppEventsConstants.EVENT_NAME_PURCHASED, ConversionsAPIEventName.PURCHASED), TuplesKt.to(AppEventsConstants.EVENT_NAME_RATED, ConversionsAPIEventName.RATED), TuplesKt.to(AppEventsConstants.EVENT_NAME_SEARCHED, ConversionsAPIEventName.SEARCHED), TuplesKt.to(AppEventsConstants.EVENT_NAME_SPENT_CREDITS, ConversionsAPIEventName.SPENT_CREDITS), TuplesKt.to(AppEventsConstants.EVENT_NAME_COMPLETED_TUTORIAL, ConversionsAPIEventName.COMPLETED_TUTORIAL));
standardEventTransformations = mapOf3;
}
public static final class SectionCustomEventFieldMapping {
private ConversionsAPICustomEventField field;
private ConversionsAPISection section;
public static /* synthetic */ SectionCustomEventFieldMapping copy$default(SectionCustomEventFieldMapping sectionCustomEventFieldMapping, ConversionsAPISection conversionsAPISection, ConversionsAPICustomEventField conversionsAPICustomEventField, int i, Object obj) {
if ((i & 1) != 0) {
conversionsAPISection = sectionCustomEventFieldMapping.section;
}
if ((i & 2) != 0) {
conversionsAPICustomEventField = sectionCustomEventFieldMapping.field;
}
return sectionCustomEventFieldMapping.copy(conversionsAPISection, conversionsAPICustomEventField);
}
public final ConversionsAPISection component1() {
return this.section;
}
public final ConversionsAPICustomEventField component2() {
return this.field;
}
public final SectionCustomEventFieldMapping copy(ConversionsAPISection conversionsAPISection, ConversionsAPICustomEventField field) {
Intrinsics.checkNotNullParameter(field, "field");
return new SectionCustomEventFieldMapping(conversionsAPISection, field);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SectionCustomEventFieldMapping)) {
return false;
}
SectionCustomEventFieldMapping sectionCustomEventFieldMapping = (SectionCustomEventFieldMapping) obj;
return this.section == sectionCustomEventFieldMapping.section && this.field == sectionCustomEventFieldMapping.field;
}
public final ConversionsAPICustomEventField getField() {
return this.field;
}
public final ConversionsAPISection getSection() {
return this.section;
}
public int hashCode() {
ConversionsAPISection conversionsAPISection = this.section;
return ((conversionsAPISection == null ? 0 : conversionsAPISection.hashCode()) * 31) + this.field.hashCode();
}
public final void setField(ConversionsAPICustomEventField conversionsAPICustomEventField) {
Intrinsics.checkNotNullParameter(conversionsAPICustomEventField, "<set-?>");
this.field = conversionsAPICustomEventField;
}
public final void setSection(ConversionsAPISection conversionsAPISection) {
this.section = conversionsAPISection;
}
public String toString() {
return "SectionCustomEventFieldMapping(section=" + this.section + ", field=" + this.field + ')';
}
public SectionCustomEventFieldMapping(ConversionsAPISection conversionsAPISection, ConversionsAPICustomEventField field) {
Intrinsics.checkNotNullParameter(field, "field");
this.section = conversionsAPISection;
this.field = field;
}
}
public enum DataProcessingParameterName {
OPTIONS(FacebookSdk.DATA_PROCESSION_OPTIONS),
COUNTRY(FacebookSdk.DATA_PROCESSION_OPTIONS_COUNTRY),
STATE(FacebookSdk.DATA_PROCESSION_OPTIONS_STATE);
public static final Companion Companion = new Companion(null);
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
DataProcessingParameterName(String str) {
this.rawValue = str;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final DataProcessingParameterName invoke(String rawValue) {
Intrinsics.checkNotNullParameter(rawValue, "rawValue");
for (DataProcessingParameterName dataProcessingParameterName : DataProcessingParameterName.valuesCustom()) {
if (Intrinsics.areEqual(dataProcessingParameterName.getRawValue(), rawValue)) {
return dataProcessingParameterName;
}
}
return null;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static DataProcessingParameterName[] valuesCustom() {
DataProcessingParameterName[] valuesCustom = values();
return (DataProcessingParameterName[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public enum ValueTransformationType {
ARRAY,
BOOL,
INT;
public static final Companion Companion = new Companion(null);
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final ValueTransformationType invoke(String rawValue) {
Intrinsics.checkNotNullParameter(rawValue, "rawValue");
if (!Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.EXT_INFO.getRawValue()) && !Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.URL_SCHEMES.getRawValue()) && !Intrinsics.areEqual(rawValue, CustomEventField.CONTENT_IDS.getRawValue()) && !Intrinsics.areEqual(rawValue, CustomEventField.CONTENTS.getRawValue()) && !Intrinsics.areEqual(rawValue, DataProcessingParameterName.OPTIONS.getRawValue())) {
if (!Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.ADV_TE.getRawValue()) && !Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.APP_TE.getRawValue())) {
if (Intrinsics.areEqual(rawValue, CustomEventField.EVENT_TIME.getRawValue())) {
return ValueTransformationType.INT;
}
return null;
}
return ValueTransformationType.BOOL;
}
return ValueTransformationType.ARRAY;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static ValueTransformationType[] valuesCustom() {
ValueTransformationType[] valuesCustom = values();
return (ValueTransformationType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v4, types: [java.lang.String] */
/* JADX WARN: Type inference failed for: r1v7, types: [java.util.List] */
/* JADX WARN: Type inference failed for: r1v8, types: [java.lang.Object] */
/* JADX WARN: Type inference failed for: r1v9, types: [java.util.Map] */
public static final Object transformValue$facebook_core_release(String field, Object value) {
Integer intOrNull;
Integer intOrNull2;
Intrinsics.checkNotNullParameter(field, "field");
Intrinsics.checkNotNullParameter(value, "value");
ValueTransformationType invoke = ValueTransformationType.Companion.invoke(field);
String str = value instanceof String ? (String) value : null;
if (invoke == null || str == null) {
return value;
}
int i = WhenMappings.$EnumSwitchMapping$0[invoke.ordinal()];
if (i != 1) {
if (i != 2) {
if (i != 3) {
throw new NoWhenBranchMatchedException();
}
intOrNull2 = StringsKt__StringNumberConversionsKt.toIntOrNull(value.toString());
return intOrNull2;
}
intOrNull = StringsKt__StringNumberConversionsKt.toIntOrNull(str);
if (intOrNull != null) {
return Boolean.valueOf(intOrNull.intValue() != 0);
}
return null;
}
try {
Utility utility = Utility.INSTANCE;
List<String> convertJSONArrayToList = Utility.convertJSONArrayToList(new JSONArray(str));
ArrayList arrayList = new ArrayList();
Iterator it = convertJSONArrayToList.iterator();
while (it.hasNext()) {
?? r1 = (String) it.next();
try {
try {
Utility utility2 = Utility.INSTANCE;
r1 = Utility.convertJSONObjectToHashMap(new JSONObject((String) r1));
} catch (JSONException unused) {
Utility utility3 = Utility.INSTANCE;
r1 = Utility.convertJSONArrayToList(new JSONArray((String) r1));
}
} catch (JSONException unused2) {
}
arrayList.add(r1);
}
return arrayList;
} catch (JSONException e) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "\n transformEvents JSONException: \n%s\n%s", value, e);
return Unit.INSTANCE;
}
}
public static final ArrayList<Map<String, Object>> transformEvents$facebook_core_release(String appEvents) {
String stackTraceToString;
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
ArrayList<Map> arrayList = new ArrayList();
try {
Utility utility = Utility.INSTANCE;
for (String str : Utility.convertJSONArrayToList(new JSONArray(appEvents))) {
Utility utility2 = Utility.INSTANCE;
arrayList.add(Utility.convertJSONObjectToHashMap(new JSONObject(str)));
}
if (arrayList.isEmpty()) {
return null;
}
ArrayList<Map<String, Object>> arrayList2 = new ArrayList<>();
for (Map map : arrayList) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
for (String str2 : map.keySet()) {
CustomEventField invoke = CustomEventField.Companion.invoke(str2);
SectionCustomEventFieldMapping sectionCustomEventFieldMapping = customEventTransformations.get(invoke);
if (invoke != null && sectionCustomEventFieldMapping != null) {
ConversionsAPISection section = sectionCustomEventFieldMapping.getSection();
if (section != null) {
if (section == ConversionsAPISection.CUSTOM_DATA) {
String rawValue = sectionCustomEventFieldMapping.getField().getRawValue();
Object obj = map.get(str2);
if (obj == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
Object transformValue$facebook_core_release = transformValue$facebook_core_release(str2, obj);
if (transformValue$facebook_core_release != null) {
linkedHashMap.put(rawValue, transformValue$facebook_core_release);
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
} else {
continue;
}
} else {
try {
String rawValue2 = sectionCustomEventFieldMapping.getField().getRawValue();
if (invoke == CustomEventField.EVENT_NAME && ((String) map.get(str2)) != null) {
AppEventsConversionsAPITransformer appEventsConversionsAPITransformer = INSTANCE;
Object obj2 = map.get(str2);
if (obj2 == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
linkedHashMap2.put(rawValue2, appEventsConversionsAPITransformer.transformEventName((String) obj2));
} else if (invoke == CustomEventField.EVENT_TIME && ((Integer) map.get(str2)) != null) {
Object obj3 = map.get(str2);
if (obj3 == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
Object transformValue$facebook_core_release2 = transformValue$facebook_core_release(str2, obj3);
if (transformValue$facebook_core_release2 != null) {
linkedHashMap2.put(rawValue2, transformValue$facebook_core_release2);
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
}
} catch (ClassCastException e) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
stackTraceToString = ExceptionsKt__ExceptionsKt.stackTraceToString(e);
companion.log(loggingBehavior, TAG, "\n transformEvents ClassCastException: \n %s ", stackTraceToString);
}
}
}
}
if (!linkedHashMap.isEmpty()) {
linkedHashMap2.put(ConversionsAPISection.CUSTOM_DATA.getRawValue(), linkedHashMap);
}
arrayList2.add(linkedHashMap2);
}
return arrayList2;
} catch (JSONException e2) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "\n transformEvents JSONException: \n%s\n%s", appEvents, e2);
return null;
}
}
private final void transformAndUpdateAppData(Map<String, Object> map, AppEventUserAndAppDataField appEventUserAndAppDataField, Object obj) {
SectionFieldMapping sectionFieldMapping = topLevelTransformations.get(appEventUserAndAppDataField);
ConversionsAPIUserAndAppDataField field = sectionFieldMapping == null ? null : sectionFieldMapping.getField();
if (field == null) {
return;
}
map.put(field.getRawValue(), obj);
}
private final void transformAndUpdateUserData(Map<String, Object> map, AppEventUserAndAppDataField appEventUserAndAppDataField, Object obj) {
if (appEventUserAndAppDataField == AppEventUserAndAppDataField.USER_DATA) {
try {
Utility utility = Utility.INSTANCE;
map.putAll(Utility.convertJSONObjectToHashMap(new JSONObject((String) obj)));
return;
} catch (JSONException e) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "\n transformEvents JSONException: \n%s\n%s", obj, e);
return;
}
}
SectionFieldMapping sectionFieldMapping = topLevelTransformations.get(appEventUserAndAppDataField);
ConversionsAPIUserAndAppDataField field = sectionFieldMapping == null ? null : sectionFieldMapping.getField();
if (field == null) {
return;
}
map.put(field.getRawValue(), obj);
}
public final void transformAndUpdateAppAndUserData$facebook_core_release(Map<String, Object> userData, Map<String, Object> appData, AppEventUserAndAppDataField field, Object value) {
Intrinsics.checkNotNullParameter(userData, "userData");
Intrinsics.checkNotNullParameter(appData, "appData");
Intrinsics.checkNotNullParameter(field, "field");
Intrinsics.checkNotNullParameter(value, "value");
SectionFieldMapping sectionFieldMapping = topLevelTransformations.get(field);
if (sectionFieldMapping == null) {
return;
}
int i = WhenMappings.$EnumSwitchMapping$1[sectionFieldMapping.getSection().ordinal()];
if (i == 1) {
transformAndUpdateAppData(appData, field, value);
} else {
if (i != 2) {
return;
}
transformAndUpdateUserData(userData, field, value);
}
}
private final String transformEventName(String str) {
Map<String, ConversionsAPIEventName> map = standardEventTransformations;
if (!map.containsKey(str)) {
return str;
}
ConversionsAPIEventName conversionsAPIEventName = map.get(str);
return conversionsAPIEventName == null ? "" : conversionsAPIEventName.getRawValue();
}
public final Map<String, Object> combineCommonFields$facebook_core_release(Map<String, ? extends Object> userData, Map<String, ? extends Object> appData, Map<String, ? extends Object> restOfData) {
Intrinsics.checkNotNullParameter(userData, "userData");
Intrinsics.checkNotNullParameter(appData, "appData");
Intrinsics.checkNotNullParameter(restOfData, "restOfData");
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.put(OtherEventConstants.ACTION_SOURCE.getRawValue(), OtherEventConstants.APP.getRawValue());
linkedHashMap.put(ConversionsAPISection.USER_DATA.getRawValue(), userData);
linkedHashMap.put(ConversionsAPISection.APP_DATA.getRawValue(), appData);
linkedHashMap.putAll(restOfData);
return linkedHashMap;
}
private final List<Map<String, Object>> combineAllTransformedDataForMobileAppInstall(Map<String, ? extends Object> map, Object obj) {
if (obj == null) {
return null;
}
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.putAll(map);
linkedHashMap.put(ConversionsAPICustomEventField.EVENT_NAME.getRawValue(), OtherEventConstants.MOBILE_APP_INSTALL.getRawValue());
linkedHashMap.put(ConversionsAPICustomEventField.EVENT_TIME.getRawValue(), obj);
return CollectionsKt__CollectionsJVMKt.listOf(linkedHashMap);
}
private final List<Map<String, Object>> combineAllTransformedDataForCustom(Map<String, ? extends Object> map, List<? extends Map<String, ? extends Object>> list) {
if (list.isEmpty()) {
return null;
}
ArrayList arrayList = new ArrayList();
Iterator<T> it = list.iterator();
while (it.hasNext()) {
Map map2 = (Map) it.next();
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.putAll(map);
linkedHashMap.putAll(map2);
arrayList.add(linkedHashMap);
}
return arrayList;
}
public final List<Map<String, Object>> combineAllTransformedData$facebook_core_release(AppEventType eventType, Map<String, Object> userData, Map<String, Object> appData, Map<String, Object> restOfData, List<? extends Map<String, ? extends Object>> customEvents, Object obj) {
Intrinsics.checkNotNullParameter(eventType, "eventType");
Intrinsics.checkNotNullParameter(userData, "userData");
Intrinsics.checkNotNullParameter(appData, "appData");
Intrinsics.checkNotNullParameter(restOfData, "restOfData");
Intrinsics.checkNotNullParameter(customEvents, "customEvents");
Map<String, Object> combineCommonFields$facebook_core_release = combineCommonFields$facebook_core_release(userData, appData, restOfData);
int i = WhenMappings.$EnumSwitchMapping$2[eventType.ordinal()];
if (i == 1) {
return combineAllTransformedDataForMobileAppInstall(combineCommonFields$facebook_core_release, obj);
}
if (i != 2) {
return null;
}
return combineAllTransformedDataForCustom(combineCommonFields$facebook_core_release, customEvents);
}
private final AppEventType splitAppEventParameters(Map<String, ? extends Object> map, Map<String, Object> map2, Map<String, Object> map3, ArrayList<Map<String, Object>> arrayList, Map<String, Object> map4) {
Object obj = map.get(OtherEventConstants.EVENT.getRawValue());
AppEventType.Companion companion = AppEventType.Companion;
if (obj != null) {
AppEventType invoke = companion.invoke((String) obj);
if (invoke == AppEventType.OTHER) {
return invoke;
}
for (Map.Entry<String, ? extends Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
AppEventUserAndAppDataField invoke2 = AppEventUserAndAppDataField.Companion.invoke(key);
if (invoke2 != null) {
INSTANCE.transformAndUpdateAppAndUserData$facebook_core_release(map2, map3, invoke2, value);
} else {
boolean areEqual = Intrinsics.areEqual(key, ConversionsAPISection.CUSTOM_EVENTS.getRawValue());
boolean z = value instanceof String;
if (invoke == AppEventType.CUSTOM && areEqual && z) {
ArrayList<Map<String, Object>> transformEvents$facebook_core_release = transformEvents$facebook_core_release((String) value);
if (transformEvents$facebook_core_release != null) {
arrayList.addAll(transformEvents$facebook_core_release);
}
} else if (DataProcessingParameterName.Companion.invoke(key) != null) {
map4.put(key, value);
}
}
}
return invoke;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
public final List<Map<String, Object>> conversionsAPICompatibleEvent$facebook_core_release(Map<String, ? extends Object> parameters) {
Intrinsics.checkNotNullParameter(parameters, "parameters");
LinkedHashMap linkedHashMap = new LinkedHashMap();
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
ArrayList<Map<String, Object>> arrayList = new ArrayList<>();
LinkedHashMap linkedHashMap3 = new LinkedHashMap();
AppEventType splitAppEventParameters = splitAppEventParameters(parameters, linkedHashMap, linkedHashMap2, arrayList, linkedHashMap3);
if (splitAppEventParameters == AppEventType.OTHER) {
return null;
}
return combineAllTransformedData$facebook_core_release(splitAppEventParameters, linkedHashMap, linkedHashMap2, linkedHashMap3, arrayList, parameters.get(OtherEventConstants.INSTALL_EVENT_TIME.getRawValue()));
}
}

View File

@@ -0,0 +1,54 @@
package com.facebook.appevents.cloudbridge;
import com.facebook.internal.Utility;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import kotlin.Unit;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
/* loaded from: classes2.dex */
public final class AppEventsConversionsAPITransformerWebRequests$transformGraphRequestAndSendToCAPIGEndPoint$1$1 extends Lambda implements Function2 {
final /* synthetic */ List<Map<String, Object>> $processedEvents;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public AppEventsConversionsAPITransformerWebRequests$transformGraphRequestAndSendToCAPIGEndPoint$1$1(List<? extends Map<String, ? extends Object>> list) {
super(2);
this.$processedEvents = list;
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
invoke((String) obj, (Integer) obj2);
return Unit.INSTANCE;
}
public final void invoke(String str, final Integer num) {
Utility utility = Utility.INSTANCE;
final List<Map<String, Object>> list = this.$processedEvents;
Utility.runOnNonUiThread(new Runnable() { // from class: com.facebook.appevents.cloudbridge.AppEventsConversionsAPITransformerWebRequests$transformGraphRequestAndSendToCAPIGEndPoint$1$1$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AppEventsConversionsAPITransformerWebRequests$transformGraphRequestAndSendToCAPIGEndPoint$1$1.m484invoke$lambda0(num, list);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: invoke$lambda-0, reason: not valid java name */
public static final void m484invoke$lambda0(Integer num, List processedEvents) {
HashSet hashSet;
boolean contains;
Intrinsics.checkNotNullParameter(processedEvents, "$processedEvents");
hashSet = AppEventsConversionsAPITransformerWebRequests.ACCEPTABLE_HTTP_RESPONSE;
contains = CollectionsKt___CollectionsKt.contains(hashSet, num);
if (contains) {
return;
}
AppEventsConversionsAPITransformerWebRequests.INSTANCE.handleError$facebook_core_release(num, processedEvents, 5);
}
}

View File

@@ -0,0 +1,321 @@
package com.facebook.appevents.cloudbridge;
import com.facebook.GraphRequest;
import com.facebook.LoggingBehavior;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import com.ironsource.nb;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.TuplesKt;
import kotlin.UninitializedPropertyAccessException;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.MapsKt__MapsJVMKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.collections.SetsKt__SetsKt;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.TypeIntrinsics;
import kotlin.ranges.IntRange;
import kotlin.text.StringsKt__StringsKt;
import org.apache.http.HttpStatus;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class AppEventsConversionsAPITransformerWebRequests {
private static final HashSet<Integer> ACCEPTABLE_HTTP_RESPONSE;
public static final AppEventsConversionsAPITransformerWebRequests INSTANCE = new AppEventsConversionsAPITransformerWebRequests();
public static final int MAX_CACHED_TRANSFORMED_EVENTS = 1000;
private static final int MAX_PROCESSED_TRANSFORMED_EVENTS = 10;
public static final int MAX_RETRY_COUNT = 5;
private static final HashSet<Integer> RETRY_EVENTS_HTTP_RESPONSE;
private static final String TAG = "CAPITransformerWebRequests";
private static final int TIMEOUT_INTERVAL = 60000;
public static CloudBridgeCredentials credentials;
private static int currentRetryCount;
public static List<Map<String, Object>> transformedEvents;
public final int getCurrentRetryCount$facebook_core_release() {
return currentRetryCount;
}
public final void setCredentials$facebook_core_release(CloudBridgeCredentials cloudBridgeCredentials) {
Intrinsics.checkNotNullParameter(cloudBridgeCredentials, "<set-?>");
credentials = cloudBridgeCredentials;
}
public final void setCurrentRetryCount$facebook_core_release(int i) {
currentRetryCount = i;
}
public final void setTransformedEvents$facebook_core_release(List<Map<String, Object>> list) {
Intrinsics.checkNotNullParameter(list, "<set-?>");
transformedEvents = list;
}
private AppEventsConversionsAPITransformerWebRequests() {
}
public static final class CloudBridgeCredentials {
private final String accessKey;
private final String cloudBridgeURL;
private final String datasetID;
public static /* synthetic */ CloudBridgeCredentials copy$default(CloudBridgeCredentials cloudBridgeCredentials, String str, String str2, String str3, int i, Object obj) {
if ((i & 1) != 0) {
str = cloudBridgeCredentials.datasetID;
}
if ((i & 2) != 0) {
str2 = cloudBridgeCredentials.cloudBridgeURL;
}
if ((i & 4) != 0) {
str3 = cloudBridgeCredentials.accessKey;
}
return cloudBridgeCredentials.copy(str, str2, str3);
}
public final String component1() {
return this.datasetID;
}
public final String component2() {
return this.cloudBridgeURL;
}
public final String component3() {
return this.accessKey;
}
public final CloudBridgeCredentials copy(String datasetID, String cloudBridgeURL, String accessKey) {
Intrinsics.checkNotNullParameter(datasetID, "datasetID");
Intrinsics.checkNotNullParameter(cloudBridgeURL, "cloudBridgeURL");
Intrinsics.checkNotNullParameter(accessKey, "accessKey");
return new CloudBridgeCredentials(datasetID, cloudBridgeURL, accessKey);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CloudBridgeCredentials)) {
return false;
}
CloudBridgeCredentials cloudBridgeCredentials = (CloudBridgeCredentials) obj;
return Intrinsics.areEqual(this.datasetID, cloudBridgeCredentials.datasetID) && Intrinsics.areEqual(this.cloudBridgeURL, cloudBridgeCredentials.cloudBridgeURL) && Intrinsics.areEqual(this.accessKey, cloudBridgeCredentials.accessKey);
}
public final String getAccessKey() {
return this.accessKey;
}
public final String getCloudBridgeURL() {
return this.cloudBridgeURL;
}
public final String getDatasetID() {
return this.datasetID;
}
public int hashCode() {
return (((this.datasetID.hashCode() * 31) + this.cloudBridgeURL.hashCode()) * 31) + this.accessKey.hashCode();
}
public String toString() {
return "CloudBridgeCredentials(datasetID=" + this.datasetID + ", cloudBridgeURL=" + this.cloudBridgeURL + ", accessKey=" + this.accessKey + ')';
}
public CloudBridgeCredentials(String datasetID, String cloudBridgeURL, String accessKey) {
Intrinsics.checkNotNullParameter(datasetID, "datasetID");
Intrinsics.checkNotNullParameter(cloudBridgeURL, "cloudBridgeURL");
Intrinsics.checkNotNullParameter(accessKey, "accessKey");
this.datasetID = datasetID;
this.cloudBridgeURL = cloudBridgeURL;
this.accessKey = accessKey;
}
}
static {
HashSet<Integer> hashSetOf;
HashSet<Integer> hashSetOf2;
hashSetOf = SetsKt__SetsKt.hashSetOf(200, 202);
ACCEPTABLE_HTTP_RESPONSE = hashSetOf;
hashSetOf2 = SetsKt__SetsKt.hashSetOf(Integer.valueOf(HttpStatus.SC_SERVICE_UNAVAILABLE), Integer.valueOf(HttpStatus.SC_GATEWAY_TIMEOUT), 429);
RETRY_EVENTS_HTTP_RESPONSE = hashSetOf2;
}
public final CloudBridgeCredentials getCredentials$facebook_core_release() {
CloudBridgeCredentials cloudBridgeCredentials = credentials;
if (cloudBridgeCredentials != null) {
return cloudBridgeCredentials;
}
Intrinsics.throwUninitializedPropertyAccessException("credentials");
throw null;
}
public final List<Map<String, Object>> getTransformedEvents$facebook_core_release() {
List<Map<String, Object>> list = transformedEvents;
if (list != null) {
return list;
}
Intrinsics.throwUninitializedPropertyAccessException("transformedEvents");
throw null;
}
public static final void configure(String datasetID, String url, String accessKey) {
Intrinsics.checkNotNullParameter(datasetID, "datasetID");
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(accessKey, "accessKey");
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, " \n\nCloudbridge Configured: \n================\ndatasetID: %s\nurl: %s\naccessKey: %s\n\n", datasetID, url, accessKey);
AppEventsConversionsAPITransformerWebRequests appEventsConversionsAPITransformerWebRequests = INSTANCE;
appEventsConversionsAPITransformerWebRequests.setCredentials$facebook_core_release(new CloudBridgeCredentials(datasetID, url, accessKey));
appEventsConversionsAPITransformerWebRequests.setTransformedEvents$facebook_core_release(new ArrayList());
}
public static final String getCredentials() {
try {
CloudBridgeCredentials credentials$facebook_core_release = INSTANCE.getCredentials$facebook_core_release();
if (credentials$facebook_core_release == null) {
return null;
}
return credentials$facebook_core_release.toString();
} catch (UninitializedPropertyAccessException unused) {
return null;
}
}
public static final void transformGraphRequestAndSendToCAPIGEndPoint(final GraphRequest request) {
Intrinsics.checkNotNullParameter(request, "request");
Utility utility = Utility.INSTANCE;
Utility.runOnNonUiThread(new Runnable() { // from class: com.facebook.appevents.cloudbridge.AppEventsConversionsAPITransformerWebRequests$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AppEventsConversionsAPITransformerWebRequests.m483transformGraphRequestAndSendToCAPIGEndPoint$lambda0(GraphRequest.this);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: transformGraphRequestAndSendToCAPIGEndPoint$lambda-0, reason: not valid java name */
public static final void m483transformGraphRequestAndSendToCAPIGEndPoint$lambda0(GraphRequest request) {
List slice;
Map<String, String> mapOf;
Intrinsics.checkNotNullParameter(request, "$request");
String graphPath = request.getGraphPath();
List split$default = graphPath == null ? null : StringsKt__StringsKt.split$default((CharSequence) graphPath, new String[]{"/"}, false, 0, 6, (Object) null);
if (split$default == null || split$default.size() != 2) {
Logger.Companion.log(LoggingBehavior.DEVELOPER_ERRORS, TAG, "\n GraphPathComponents Error when logging: \n%s", request);
return;
}
try {
AppEventsConversionsAPITransformerWebRequests appEventsConversionsAPITransformerWebRequests = INSTANCE;
String str = appEventsConversionsAPITransformerWebRequests.getCredentials$facebook_core_release().getCloudBridgeURL() + "/capi/" + appEventsConversionsAPITransformerWebRequests.getCredentials$facebook_core_release().getDatasetID() + "/events";
List<Map<String, Object>> transformAppEventRequestForCAPIG = appEventsConversionsAPITransformerWebRequests.transformAppEventRequestForCAPIG(request);
if (transformAppEventRequestForCAPIG == null) {
return;
}
appEventsConversionsAPITransformerWebRequests.appendEvents$facebook_core_release(transformAppEventRequestForCAPIG);
int min = Math.min(appEventsConversionsAPITransformerWebRequests.getTransformedEvents$facebook_core_release().size(), 10);
slice = CollectionsKt___CollectionsKt.slice(appEventsConversionsAPITransformerWebRequests.getTransformedEvents$facebook_core_release(), new IntRange(0, min - 1));
appEventsConversionsAPITransformerWebRequests.getTransformedEvents$facebook_core_release().subList(0, min).clear();
JSONArray jSONArray = new JSONArray((Collection) slice);
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.put("data", jSONArray);
linkedHashMap.put("accessKey", appEventsConversionsAPITransformerWebRequests.getCredentials$facebook_core_release().getAccessKey());
JSONObject jSONObject = new JSONObject(linkedHashMap);
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
String jSONObject2 = jSONObject.toString(2);
Intrinsics.checkNotNullExpressionValue(jSONObject2, "jsonBodyStr.toString(2)");
companion.log(loggingBehavior, TAG, "\nTransformed_CAPI_JSON:\nURL: %s\nFROM=========\n%s\n>>>>>>TO>>>>>>\n%s\n=============\n", str, request, jSONObject2);
String jSONObject3 = jSONObject.toString();
mapOf = MapsKt__MapsJVMKt.mapOf(TuplesKt.to("Content-Type", nb.L));
appEventsConversionsAPITransformerWebRequests.makeHttpRequest$facebook_core_release(str, "POST", jSONObject3, mapOf, 60000, new AppEventsConversionsAPITransformerWebRequests$transformGraphRequestAndSendToCAPIGEndPoint$1$1(slice));
} catch (UninitializedPropertyAccessException e) {
Logger.Companion.log(LoggingBehavior.DEVELOPER_ERRORS, TAG, "\n Credentials not initialized Error when logging: \n%s", e);
}
}
private final List<Map<String, Object>> transformAppEventRequestForCAPIG(GraphRequest graphRequest) {
Map<String, ? extends Object> mutableMap;
JSONObject graphObject = graphRequest.getGraphObject();
if (graphObject == null) {
return null;
}
mutableMap = MapsKt__MapsKt.toMutableMap(Utility.convertJSONObjectToHashMap(graphObject));
Object tag = graphRequest.getTag();
if (tag == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
mutableMap.put("custom_events", tag);
StringBuilder sb = new StringBuilder();
for (String str : mutableMap.keySet()) {
sb.append(str);
sb.append(" : ");
sb.append(mutableMap.get(str));
sb.append(System.getProperty("line.separator"));
}
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "\nGraph Request data: \n\n%s \n\n", sb);
return AppEventsConversionsAPITransformer.INSTANCE.conversionsAPICompatibleEvent$facebook_core_release(mutableMap);
}
public static /* synthetic */ void handleError$facebook_core_release$default(AppEventsConversionsAPITransformerWebRequests appEventsConversionsAPITransformerWebRequests, Integer num, List list, int i, int i2, Object obj) {
if ((i2 & 4) != 0) {
i = 5;
}
appEventsConversionsAPITransformerWebRequests.handleError$facebook_core_release(num, list, i);
}
public final void handleError$facebook_core_release(Integer num, List<? extends Map<String, ? extends Object>> processedEvents, int i) {
boolean contains;
Intrinsics.checkNotNullParameter(processedEvents, "processedEvents");
contains = CollectionsKt___CollectionsKt.contains(RETRY_EVENTS_HTTP_RESPONSE, num);
if (contains) {
if (currentRetryCount >= i) {
getTransformedEvents$facebook_core_release().clear();
currentRetryCount = 0;
} else {
getTransformedEvents$facebook_core_release().addAll(0, processedEvents);
currentRetryCount++;
}
}
}
public final void appendEvents$facebook_core_release(List<? extends Map<String, ? extends Object>> list) {
List drop;
if (list != null) {
getTransformedEvents$facebook_core_release().addAll(list);
}
int max = Math.max(0, getTransformedEvents$facebook_core_release().size() - 1000);
if (max > 0) {
drop = CollectionsKt___CollectionsKt.drop(getTransformedEvents$facebook_core_release(), max);
setTransformedEvents$facebook_core_release(TypeIntrinsics.asMutableList(drop));
}
}
public static /* synthetic */ void makeHttpRequest$facebook_core_release$default(AppEventsConversionsAPITransformerWebRequests appEventsConversionsAPITransformerWebRequests, String str, String str2, String str3, Map map, int i, Function2 function2, int i2, Object obj) {
if ((i2 & 16) != 0) {
i = 60000;
}
appEventsConversionsAPITransformerWebRequests.makeHttpRequest$facebook_core_release(str, str2, str3, map, i, function2);
}
/* JADX WARN: Removed duplicated region for block: B:16:0x00a7 A[Catch: IOException -> 0x0049, UnknownHostException -> 0x004c, TRY_LEAVE, TryCatch #4 {UnknownHostException -> 0x004c, IOException -> 0x0049, blocks: (B:3:0x000f, B:5:0x0020, B:8:0x004f, B:10:0x005d, B:14:0x006d, B:16:0x00a7, B:23:0x00c3, B:31:0x00c9, B:32:0x00cc, B:34:0x00cd, B:36:0x00f0, B:40:0x0028, B:43:0x002f, B:44:0x0033, B:46:0x0039, B:48:0x00fc, B:49:0x0103, B:28:0x00c7, B:18:0x00b5, B:20:0x00bb, B:22:0x00c1), top: B:2:0x000f, inners: #2, #3 }] */
/* JADX WARN: Removed duplicated region for block: B:36:0x00f0 A[Catch: IOException -> 0x0049, UnknownHostException -> 0x004c, TryCatch #4 {UnknownHostException -> 0x004c, IOException -> 0x0049, blocks: (B:3:0x000f, B:5:0x0020, B:8:0x004f, B:10:0x005d, B:14:0x006d, B:16:0x00a7, B:23:0x00c3, B:31:0x00c9, B:32:0x00cc, B:34:0x00cd, B:36:0x00f0, B:40:0x0028, B:43:0x002f, B:44:0x0033, B:46:0x0039, B:48:0x00fc, B:49:0x0103, B:28:0x00c7, B:18:0x00b5, B:20:0x00bb, B:22:0x00c1), top: B:2:0x000f, inners: #2, #3 }] */
/* JADX WARN: Removed duplicated region for block: B:38:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void makeHttpRequest$facebook_core_release(java.lang.String r6, java.lang.String r7, java.lang.String r8, java.util.Map<java.lang.String, java.lang.String> r9, int r10, kotlin.jvm.functions.Function2 r11) {
/*
Method dump skipped, instructions count: 307
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.cloudbridge.AppEventsConversionsAPITransformerWebRequests.makeHttpRequest$facebook_core_release(java.lang.String, java.lang.String, java.lang.String, java.util.Map, int, kotlin.jvm.functions.Function2):void");
}
}

View File

@@ -0,0 +1,42 @@
package com.facebook.appevents.cloudbridge;
import com.applovin.sdk.AppLovinEventTypes;
import com.tapjoy.TJAdUnitConstants;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum ConversionsAPICustomEventField {
VALUE_TO_SUM("value"),
EVENT_TIME("event_time"),
EVENT_NAME(TJAdUnitConstants.PARAM_PLACEMENT_NAME),
CONTENT_IDS("content_ids"),
CONTENTS("contents"),
CONTENT_TYPE("content_type"),
DESCRIPTION("description"),
LEVEL(AppLovinEventTypes.USER_COMPLETED_LEVEL),
MAX_RATING_VALUE("max_rating_value"),
NUM_ITEMS("num_items"),
PAYMENT_INFO_AVAILABLE("payment_info_available"),
REGISTRATION_METHOD("registration_method"),
SEARCH_STRING("search_string"),
SUCCESS("success"),
ORDER_ID("order_id"),
AD_TYPE("ad_type"),
CURRENCY("currency");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
ConversionsAPICustomEventField(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static ConversionsAPICustomEventField[] valuesCustom() {
ConversionsAPICustomEventField[] valuesCustom = values();
return (ConversionsAPICustomEventField[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,37 @@
package com.facebook.appevents.cloudbridge;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum ConversionsAPIEventName {
UNLOCKED_ACHIEVEMENT("AchievementUnlocked"),
ACTIVATED_APP("ActivateApp"),
ADDED_PAYMENT_INFO("AddPaymentInfo"),
ADDED_TO_CART("AddToCart"),
ADDED_TO_WISHLIST("AddToWishlist"),
COMPLETED_REGISTRATION("CompleteRegistration"),
VIEWED_CONTENT("ViewContent"),
INITIATED_CHECKOUT("InitiateCheckout"),
ACHIEVED_LEVEL("LevelAchieved"),
PURCHASED("Purchase"),
RATED("Rate"),
SEARCHED("Search"),
SPENT_CREDITS("SpentCredits"),
COMPLETED_TUTORIAL("TutorialCompletion");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
ConversionsAPIEventName(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static ConversionsAPIEventName[] valuesCustom() {
ConversionsAPIEventName[] valuesCustom = values();
return (ConversionsAPIEventName[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,27 @@
package com.facebook.appevents.cloudbridge;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum ConversionsAPISection {
USER_DATA("user_data"),
APP_DATA("app_data"),
CUSTOM_DATA("custom_data"),
CUSTOM_EVENTS("custom_events");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
ConversionsAPISection(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static ConversionsAPISection[] valuesCustom() {
ConversionsAPISection[] valuesCustom = values();
return (ConversionsAPISection[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,41 @@
package com.facebook.appevents.cloudbridge;
import com.applovin.sdk.AppLovinEventParameters;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum ConversionsAPIUserAndAppDataField {
ANON_ID("anon_id"),
FB_LOGIN_ID("fb_login_id"),
MAD_ID("madid"),
PAGE_ID("page_id"),
PAGE_SCOPED_USER_ID("page_scoped_user_id"),
USER_DATA("ud"),
ADV_TE("advertiser_tracking_enabled"),
APP_TE("application_tracking_enabled"),
CONSIDER_VIEWS("consider_views"),
DEVICE_TOKEN("device_token"),
EXT_INFO("extInfo"),
INCLUDE_DWELL_DATA("include_dwell_data"),
INCLUDE_VIDEO_DATA("include_video_data"),
INSTALL_REFERRER("install_referrer"),
INSTALLER_PACKAGE("installer_package"),
RECEIPT_DATA(AppLovinEventParameters.IN_APP_PURCHASE_DATA),
URL_SCHEMES("url_schemes");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
ConversionsAPIUserAndAppDataField(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static ConversionsAPIUserAndAppDataField[] valuesCustom() {
ConversionsAPIUserAndAppDataField[] valuesCustom = values();
return (ConversionsAPIUserAndAppDataField[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,64 @@
package com.facebook.appevents.cloudbridge;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.internal.Constants;
import java.util.Arrays;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public enum CustomEventField {
EVENT_TIME(Constants.LOG_TIME_APP_EVENT_KEY),
EVENT_NAME(Constants.EVENT_NAME_EVENT_KEY),
VALUE_TO_SUM(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM),
CONTENT_IDS(AppEventsConstants.EVENT_PARAM_CONTENT_ID),
CONTENTS(AppEventsConstants.EVENT_PARAM_CONTENT),
CONTENT_TYPE(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE),
DESCRIPTION(AppEventsConstants.EVENT_PARAM_DESCRIPTION),
LEVEL(AppEventsConstants.EVENT_PARAM_LEVEL),
MAX_RATING_VALUE(AppEventsConstants.EVENT_PARAM_MAX_RATING_VALUE),
NUM_ITEMS(AppEventsConstants.EVENT_PARAM_NUM_ITEMS),
PAYMENT_INFO_AVAILABLE(AppEventsConstants.EVENT_PARAM_PAYMENT_INFO_AVAILABLE),
REGISTRATION_METHOD(AppEventsConstants.EVENT_PARAM_REGISTRATION_METHOD),
SEARCH_STRING(AppEventsConstants.EVENT_PARAM_SEARCH_STRING),
SUCCESS(AppEventsConstants.EVENT_PARAM_SUCCESS),
ORDER_ID(AppEventsConstants.EVENT_PARAM_ORDER_ID),
AD_TYPE("ad_type"),
CURRENCY(AppEventsConstants.EVENT_PARAM_CURRENCY);
public static final Companion Companion = new Companion(null);
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
CustomEventField(String str) {
this.rawValue = str;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final CustomEventField invoke(String rawValue) {
Intrinsics.checkNotNullParameter(rawValue, "rawValue");
for (CustomEventField customEventField : CustomEventField.valuesCustom()) {
if (Intrinsics.areEqual(customEventField.getRawValue(), rawValue)) {
return customEventField;
}
}
return null;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static CustomEventField[] valuesCustom() {
CustomEventField[] valuesCustom = values();
return (CustomEventField[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,30 @@
package com.facebook.appevents.cloudbridge;
import androidx.core.app.NotificationCompat;
import com.mbridge.msdk.MBridgeConstans;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum OtherEventConstants {
EVENT(NotificationCompat.CATEGORY_EVENT),
ACTION_SOURCE("action_source"),
APP(MBridgeConstans.DYNAMIC_VIEW_WX_APP),
MOBILE_APP_INSTALL("MobileAppInstall"),
INSTALL_EVENT_TIME("install_timestamp");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
OtherEventConstants(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static OtherEventConstants[] valuesCustom() {
OtherEventConstants[] valuesCustom = values();
return (OtherEventConstants[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,28 @@
package com.facebook.appevents.cloudbridge;
import com.ironsource.nb;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum SettingsAPIFields {
URL(nb.r),
ENABLED("is_enabled"),
DATASETID("dataset_id"),
ACCESSKEY("access_key");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
SettingsAPIFields(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static SettingsAPIFields[] valuesCustom() {
SettingsAPIFields[] valuesCustom = values();
return (SettingsAPIFields[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,215 @@
package com.facebook.appevents.codeless;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.appevents.codeless.internal.Constants;
import com.facebook.appevents.codeless.internal.EventBinding;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.ref.WeakReference;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class CodelessLoggingEventListener {
public static final CodelessLoggingEventListener INSTANCE = new CodelessLoggingEventListener();
private CodelessLoggingEventListener() {
}
public static final AutoLoggingOnClickListener getOnClickListener(EventBinding mapping, View rootView, View hostView) {
if (CrashShieldHandler.isObjectCrashing(CodelessLoggingEventListener.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(mapping, "mapping");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
return new AutoLoggingOnClickListener(mapping, rootView, hostView);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessLoggingEventListener.class);
return null;
}
}
public static final AutoLoggingOnItemClickListener getOnItemClickListener(EventBinding mapping, View rootView, AdapterView<?> hostView) {
if (CrashShieldHandler.isObjectCrashing(CodelessLoggingEventListener.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(mapping, "mapping");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
return new AutoLoggingOnItemClickListener(mapping, rootView, hostView);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessLoggingEventListener.class);
return null;
}
}
public static final void logEvent$facebook_core_release(EventBinding mapping, View rootView, View hostView) {
if (CrashShieldHandler.isObjectCrashing(CodelessLoggingEventListener.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(mapping, "mapping");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
final String eventName = mapping.getEventName();
final Bundle parameters = CodelessMatcher.Companion.getParameters(mapping, rootView, hostView);
INSTANCE.updateParameters$facebook_core_release(parameters);
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.codeless.CodelessLoggingEventListener$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
CodelessLoggingEventListener.m485logEvent$lambda0(eventName, parameters);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessLoggingEventListener.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: logEvent$lambda-0, reason: not valid java name */
public static final void m485logEvent$lambda0(String eventName, Bundle parameters) {
if (CrashShieldHandler.isObjectCrashing(CodelessLoggingEventListener.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(eventName, "$eventName");
Intrinsics.checkNotNullParameter(parameters, "$parameters");
AppEventsLogger.Companion.newLogger(FacebookSdk.getApplicationContext()).logEvent(eventName, parameters);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessLoggingEventListener.class);
}
}
public final void updateParameters$facebook_core_release(Bundle parameters) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(parameters, "parameters");
String string = parameters.getString(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM);
if (string != null) {
parameters.putDouble(AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM, AppEventUtility.normalizePrice(string));
}
parameters.putString(Constants.IS_CODELESS_EVENT_KEY, "1");
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class AutoLoggingOnClickListener implements View.OnClickListener {
private View.OnClickListener existingOnClickListener;
private WeakReference<View> hostView;
private EventBinding mapping;
private WeakReference<View> rootView;
private boolean supportCodelessLogging;
public final boolean getSupportCodelessLogging() {
return this.supportCodelessLogging;
}
public final void setSupportCodelessLogging(boolean z) {
this.supportCodelessLogging = z;
}
public AutoLoggingOnClickListener(EventBinding mapping, View rootView, View hostView) {
Intrinsics.checkNotNullParameter(mapping, "mapping");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
this.mapping = mapping;
this.hostView = new WeakReference<>(hostView);
this.rootView = new WeakReference<>(rootView);
this.existingOnClickListener = ViewHierarchy.getExistingOnClickListener(hostView);
this.supportCodelessLogging = true;
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
View.OnClickListener onClickListener = this.existingOnClickListener;
if (onClickListener != null) {
onClickListener.onClick(view);
}
View view2 = this.rootView.get();
View view3 = this.hostView.get();
if (view2 == null || view3 == null) {
return;
}
CodelessLoggingEventListener codelessLoggingEventListener = CodelessLoggingEventListener.INSTANCE;
CodelessLoggingEventListener.logEvent$facebook_core_release(this.mapping, view2, view3);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
}
}
}
public static final class AutoLoggingOnItemClickListener implements AdapterView.OnItemClickListener {
private AdapterView.OnItemClickListener existingOnItemClickListener;
private WeakReference<AdapterView<?>> hostView;
private EventBinding mapping;
private WeakReference<View> rootView;
private boolean supportCodelessLogging;
public final boolean getSupportCodelessLogging() {
return this.supportCodelessLogging;
}
public final void setSupportCodelessLogging(boolean z) {
this.supportCodelessLogging = z;
}
public AutoLoggingOnItemClickListener(EventBinding mapping, View rootView, AdapterView<?> hostView) {
Intrinsics.checkNotNullParameter(mapping, "mapping");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
this.mapping = mapping;
this.hostView = new WeakReference<>(hostView);
this.rootView = new WeakReference<>(rootView);
this.existingOnItemClickListener = hostView.getOnItemClickListener();
this.supportCodelessLogging = true;
}
@Override // android.widget.AdapterView.OnItemClickListener
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
Intrinsics.checkNotNullParameter(view, "view");
AdapterView.OnItemClickListener onItemClickListener = this.existingOnItemClickListener;
if (onItemClickListener != null) {
onItemClickListener.onItemClick(adapterView, view, i, j);
}
View view2 = this.rootView.get();
AdapterView<?> adapterView2 = this.hostView.get();
if (view2 == null || adapterView2 == null) {
return;
}
CodelessLoggingEventListener codelessLoggingEventListener = CodelessLoggingEventListener.INSTANCE;
CodelessLoggingEventListener.logEvent$facebook_core_release(this.mapping, view2, adapterView2);
}
}
}

View File

@@ -0,0 +1,287 @@
package com.facebook.appevents.codeless;
import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.appevents.codeless.ViewIndexingTrigger;
import com.facebook.appevents.codeless.internal.Constants;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.internal.AttributionIdentifiers;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.Arrays;
import java.util.Locale;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class CodelessManager {
private static String deviceSessionID;
private static volatile boolean isCheckingSession;
private static SensorManager sensorManager;
private static ViewIndexer viewIndexer;
public static final CodelessManager INSTANCE = new CodelessManager();
private static final ViewIndexingTrigger viewIndexingTrigger = new ViewIndexingTrigger();
private static final AtomicBoolean isCodelessEnabled = new AtomicBoolean(true);
private static final AtomicBoolean isAppIndexingEnabled = new AtomicBoolean(false);
private final boolean isDebugOnEmulator() {
CrashShieldHandler.isObjectCrashing(this);
return false;
}
private CodelessManager() {
}
public static final void onActivityResumed(Activity activity) {
CodelessManager codelessManager;
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
if (isCodelessEnabled.get()) {
CodelessMatcher.Companion.getInstance().add(activity);
Context applicationContext = activity.getApplicationContext();
final String applicationId = FacebookSdk.getApplicationId();
final FetchedAppSettings appSettingsWithoutQuery = FetchedAppSettingsManager.getAppSettingsWithoutQuery(applicationId);
if (!Intrinsics.areEqual(appSettingsWithoutQuery == null ? null : Boolean.valueOf(appSettingsWithoutQuery.getCodelessEventsEnabled()), Boolean.TRUE)) {
if (INSTANCE.isDebugOnEmulator()) {
}
codelessManager = INSTANCE;
if (codelessManager.isDebugOnEmulator() || isAppIndexingEnabled.get()) {
}
codelessManager.checkCodelessSession(applicationId);
return;
}
SensorManager sensorManager2 = (SensorManager) applicationContext.getSystemService("sensor");
if (sensorManager2 == null) {
return;
}
sensorManager = sensorManager2;
Sensor defaultSensor = sensorManager2.getDefaultSensor(1);
ViewIndexer viewIndexer2 = new ViewIndexer(activity);
viewIndexer = viewIndexer2;
ViewIndexingTrigger viewIndexingTrigger2 = viewIndexingTrigger;
viewIndexingTrigger2.setOnShakeListener(new ViewIndexingTrigger.OnShakeListener() { // from class: com.facebook.appevents.codeless.CodelessManager$$ExternalSyntheticLambda1
@Override // com.facebook.appevents.codeless.ViewIndexingTrigger.OnShakeListener
public final void onShake() {
CodelessManager.m488onActivityResumed$lambda0(FetchedAppSettings.this, applicationId);
}
});
sensorManager2.registerListener(viewIndexingTrigger2, defaultSensor, 2);
if (appSettingsWithoutQuery != null && appSettingsWithoutQuery.getCodelessEventsEnabled()) {
viewIndexer2.schedule();
}
codelessManager = INSTANCE;
if (codelessManager.isDebugOnEmulator()) {
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityResumed$lambda-0, reason: not valid java name */
public static final void m488onActivityResumed$lambda0(FetchedAppSettings fetchedAppSettings, String appId) {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(appId, "$appId");
boolean z = fetchedAppSettings != null && fetchedAppSettings.getCodelessEventsEnabled();
boolean codelessSetupEnabled = FacebookSdk.getCodelessSetupEnabled();
if (z && codelessSetupEnabled) {
INSTANCE.checkCodelessSession(appId);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
public static final void onActivityPaused(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
if (isCodelessEnabled.get()) {
CodelessMatcher.Companion.getInstance().remove(activity);
ViewIndexer viewIndexer2 = viewIndexer;
if (viewIndexer2 != null) {
viewIndexer2.unschedule();
}
SensorManager sensorManager2 = sensorManager;
if (sensorManager2 == null) {
return;
}
sensorManager2.unregisterListener(viewIndexingTrigger);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
public static final void onActivityDestroyed(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
CodelessMatcher.Companion.getInstance().destroy(activity);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
isCodelessEnabled.set(true);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
public static final void disable() {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
isCodelessEnabled.set(false);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
private final void checkCodelessSession(final String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (isCheckingSession) {
return;
}
isCheckingSession = true;
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.codeless.CodelessManager$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
CodelessManager.m487checkCodelessSession$lambda1(str);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: checkCodelessSession$lambda-1, reason: not valid java name */
public static final void m487checkCodelessSession$lambda1(String str) {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
Bundle bundle = new Bundle();
AttributionIdentifiers attributionIdentifiers = AttributionIdentifiers.Companion.getAttributionIdentifiers(FacebookSdk.getApplicationContext());
JSONArray jSONArray = new JSONArray();
String str2 = Build.MODEL;
if (str2 == null) {
str2 = "";
}
jSONArray.put(str2);
if ((attributionIdentifiers == null ? null : attributionIdentifiers.getAndroidAdvertiserId()) != null) {
jSONArray.put(attributionIdentifiers.getAndroidAdvertiserId());
} else {
jSONArray.put("");
}
jSONArray.put("0");
jSONArray.put(AppEventUtility.isEmulator() ? "1" : "0");
Locale currentLocale = Utility.getCurrentLocale();
jSONArray.put(currentLocale.getLanguage() + '_' + ((Object) currentLocale.getCountry()));
String jSONArray2 = jSONArray.toString();
Intrinsics.checkNotNullExpressionValue(jSONArray2, "extInfoArray.toString()");
bundle.putString(Constants.DEVICE_SESSION_ID, getCurrentDeviceSessionID$facebook_core_release());
bundle.putString(Constants.EXTINFO, jSONArray2);
GraphRequest.Companion companion = GraphRequest.Companion;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
boolean z = true;
String format = String.format(Locale.US, "%s/app_indexing_session", Arrays.copyOf(new Object[]{str}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
JSONObject jSONObject = companion.newPostRequestWithBundle(null, format, bundle, null).executeAndWait().getJSONObject();
AtomicBoolean atomicBoolean = isAppIndexingEnabled;
if (jSONObject == null || !jSONObject.optBoolean(Constants.APP_INDEXING_ENABLED, false)) {
z = false;
}
atomicBoolean.set(z);
if (atomicBoolean.get()) {
ViewIndexer viewIndexer2 = viewIndexer;
if (viewIndexer2 != null) {
viewIndexer2.schedule();
}
} else {
deviceSessionID = null;
}
isCheckingSession = false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
public static final String getCurrentDeviceSessionID$facebook_core_release() {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return null;
}
try {
if (deviceSessionID == null) {
deviceSessionID = UUID.randomUUID().toString();
}
String str = deviceSessionID;
if (str != null) {
return str;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
return null;
}
}
public static final boolean getIsAppIndexingEnabled$facebook_core_release() {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return false;
}
try {
return isAppIndexingEnabled.get();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
return false;
}
}
public static final void updateAppIndexing$facebook_core_release(boolean z) {
if (CrashShieldHandler.isObjectCrashing(CodelessManager.class)) {
return;
}
try {
isAppIndexingEnabled.set(z);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessManager.class);
}
}
}

View File

@@ -0,0 +1,652 @@
package com.facebook.appevents.codeless;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.ListView;
import androidx.annotation.UiThread;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.appevents.codeless.CodelessLoggingEventListener;
import com.facebook.appevents.codeless.RCTCodelessLoggingEventListener;
import com.facebook.appevents.codeless.internal.Constants;
import com.facebook.appevents.codeless.internal.EventBinding;
import com.facebook.appevents.codeless.internal.ParameterComponent;
import com.facebook.appevents.codeless.internal.PathComponent;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.InternalSettings;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.WeakHashMap;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes2.dex */
public final class CodelessMatcher {
private static final String CURRENT_CLASS_NAME = ".";
private static final String PARENT_CLASS_NAME = "..";
private static CodelessMatcher codelessMatcher;
private final Set<Activity> activitiesSet;
private final HashMap<Integer, HashSet<String>> activityToListenerMap;
private HashSet<String> listenerSet;
private final Handler uiThreadHandler;
private final Set<ViewMatcher> viewMatchers;
public static final Companion Companion = new Companion(null);
private static final String TAG = CodelessMatcher.class.getCanonicalName();
public /* synthetic */ CodelessMatcher(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final synchronized CodelessMatcher getInstance() {
synchronized (CodelessMatcher.class) {
if (CrashShieldHandler.isObjectCrashing(CodelessMatcher.class)) {
return null;
}
try {
return Companion.getInstance();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessMatcher.class);
return null;
}
}
}
@UiThread
public static final Bundle getParameters(EventBinding eventBinding, View view, View view2) {
if (CrashShieldHandler.isObjectCrashing(CodelessMatcher.class)) {
return null;
}
try {
return Companion.getParameters(eventBinding, view, view2);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessMatcher.class);
return null;
}
}
private CodelessMatcher() {
this.uiThreadHandler = new Handler(Looper.getMainLooper());
Set<Activity> newSetFromMap = Collections.newSetFromMap(new WeakHashMap());
Intrinsics.checkNotNullExpressionValue(newSetFromMap, "newSetFromMap(WeakHashMap())");
this.activitiesSet = newSetFromMap;
this.viewMatchers = new LinkedHashSet();
this.listenerSet = new HashSet<>();
this.activityToListenerMap = new HashMap<>();
}
public static final /* synthetic */ CodelessMatcher access$getCodelessMatcher$cp() {
if (CrashShieldHandler.isObjectCrashing(CodelessMatcher.class)) {
return null;
}
try {
return codelessMatcher;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessMatcher.class);
return null;
}
}
public static final /* synthetic */ String access$getTAG$cp() {
if (CrashShieldHandler.isObjectCrashing(CodelessMatcher.class)) {
return null;
}
try {
return TAG;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessMatcher.class);
return null;
}
}
public static final /* synthetic */ void access$setCodelessMatcher$cp(CodelessMatcher codelessMatcher2) {
if (CrashShieldHandler.isObjectCrashing(CodelessMatcher.class)) {
return;
}
try {
codelessMatcher = codelessMatcher2;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessMatcher.class);
}
}
@UiThread
public final void add(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
if (InternalSettings.isUnityApp()) {
return;
}
if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
throw new FacebookException("Can't add activity to CodelessMatcher on non-UI thread");
}
this.activitiesSet.add(activity);
this.listenerSet.clear();
HashSet<String> hashSet = this.activityToListenerMap.get(Integer.valueOf(activity.hashCode()));
if (hashSet != null) {
this.listenerSet = hashSet;
}
startTracking();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@UiThread
public final void remove(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
if (InternalSettings.isUnityApp()) {
return;
}
if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
throw new FacebookException("Can't remove activity from CodelessMatcher on non-UI thread");
}
this.activitiesSet.remove(activity);
this.viewMatchers.clear();
this.activityToListenerMap.put(Integer.valueOf(activity.hashCode()), (HashSet) this.listenerSet.clone());
this.listenerSet.clear();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@UiThread
public final void destroy(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
this.activityToListenerMap.remove(Integer.valueOf(activity.hashCode()));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void startTracking() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
matchViews();
} else {
this.uiThreadHandler.post(new Runnable() { // from class: com.facebook.appevents.codeless.CodelessMatcher$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
CodelessMatcher.m490startTracking$lambda1(CodelessMatcher.this);
}
});
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: startTracking$lambda-1, reason: not valid java name */
public static final void m490startTracking$lambda1(CodelessMatcher this$0) {
if (CrashShieldHandler.isObjectCrashing(CodelessMatcher.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.matchViews();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CodelessMatcher.class);
}
}
private final void matchViews() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
for (Activity activity : this.activitiesSet) {
if (activity != null) {
View rootView = AppEventUtility.getRootView(activity);
String activityName = activity.getClass().getSimpleName();
Handler handler = this.uiThreadHandler;
HashSet<String> hashSet = this.listenerSet;
Intrinsics.checkNotNullExpressionValue(activityName, "activityName");
this.viewMatchers.add(new ViewMatcher(rootView, handler, hashSet, activityName));
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class MatchedView {
private final WeakReference<View> view;
private final String viewMapKey;
public final String getViewMapKey() {
return this.viewMapKey;
}
public MatchedView(View view, String viewMapKey) {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(viewMapKey, "viewMapKey");
this.view = new WeakReference<>(view);
this.viewMapKey = viewMapKey;
}
public final View getView() {
WeakReference<View> weakReference = this.view;
if (weakReference == null) {
return null;
}
return weakReference.get();
}
}
@UiThread
public static final class ViewMatcher implements ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnScrollChangedListener, Runnable {
public static final Companion Companion = new Companion(null);
private final String activityName;
private List<EventBinding> eventBindings;
private final Handler handler;
private final HashSet<String> listenerSet;
private final WeakReference<View> rootView;
public static final List<MatchedView> findViewByPath(EventBinding eventBinding, View view, List<PathComponent> list, int i, int i2, String str) {
return Companion.findViewByPath(eventBinding, view, list, i, i2, str);
}
public ViewMatcher(View view, Handler handler, HashSet<String> listenerSet, String activityName) {
Intrinsics.checkNotNullParameter(handler, "handler");
Intrinsics.checkNotNullParameter(listenerSet, "listenerSet");
Intrinsics.checkNotNullParameter(activityName, "activityName");
this.rootView = new WeakReference<>(view);
this.handler = handler;
this.listenerSet = listenerSet;
this.activityName = activityName;
handler.postDelayed(this, 200L);
}
@Override // java.lang.Runnable
public void run() {
View view;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettings appSettingsWithoutQuery = FetchedAppSettingsManager.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
if (appSettingsWithoutQuery != null && appSettingsWithoutQuery.getCodelessEventsEnabled()) {
List<EventBinding> parseArray = EventBinding.Companion.parseArray(appSettingsWithoutQuery.getEventBindings());
this.eventBindings = parseArray;
if (parseArray == null || (view = this.rootView.get()) == null) {
return;
}
ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.addOnGlobalLayoutListener(this);
viewTreeObserver.addOnScrollChangedListener(this);
}
startMatch();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
}
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
public void onGlobalLayout() {
startMatch();
}
@Override // android.view.ViewTreeObserver.OnScrollChangedListener
public void onScrollChanged() {
startMatch();
}
private final void startMatch() {
int size;
List<EventBinding> list = this.eventBindings;
if (list == null || this.rootView.get() == null || list.size() - 1 < 0) {
return;
}
int i = 0;
while (true) {
int i2 = i + 1;
findView(list.get(i), this.rootView.get());
if (i2 > size) {
return;
} else {
i = i2;
}
}
}
private final void findView(EventBinding eventBinding, View view) {
if (eventBinding == null || view == null) {
return;
}
String activityName = eventBinding.getActivityName();
if (activityName == null || activityName.length() == 0 || Intrinsics.areEqual(eventBinding.getActivityName(), this.activityName)) {
List<PathComponent> viewPath = eventBinding.getViewPath();
if (viewPath.size() > 25) {
return;
}
Iterator<MatchedView> it = Companion.findViewByPath(eventBinding, view, viewPath, 0, -1, this.activityName).iterator();
while (it.hasNext()) {
attachListener(it.next(), view, eventBinding);
}
}
}
private final void attachListener(MatchedView matchedView, View view, EventBinding eventBinding) {
if (eventBinding == null) {
return;
}
try {
View view2 = matchedView.getView();
if (view2 == null) {
return;
}
View findRCTRootView = ViewHierarchy.findRCTRootView(view2);
if (findRCTRootView != null && ViewHierarchy.INSTANCE.isRCTButton(view2, findRCTRootView)) {
attachRCTListener(matchedView, view, eventBinding);
return;
}
String name = view2.getClass().getName();
Intrinsics.checkNotNullExpressionValue(name, "view.javaClass.name");
if (StringsKt__StringsJVMKt.startsWith$default(name, "com.facebook.react", false, 2, null)) {
return;
}
if (!(view2 instanceof AdapterView)) {
attachOnClickListener(matchedView, view, eventBinding);
} else if (view2 instanceof ListView) {
attachOnItemClickListener(matchedView, view, eventBinding);
}
} catch (Exception e) {
Utility utility = Utility.INSTANCE;
Utility.logd(CodelessMatcher.access$getTAG$cp(), e);
}
}
private final void attachOnClickListener(MatchedView matchedView, View view, EventBinding eventBinding) {
boolean z;
View view2 = matchedView.getView();
if (view2 == null) {
return;
}
String viewMapKey = matchedView.getViewMapKey();
View.OnClickListener existingOnClickListener = ViewHierarchy.getExistingOnClickListener(view2);
if (existingOnClickListener instanceof CodelessLoggingEventListener.AutoLoggingOnClickListener) {
if (existingOnClickListener == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.appevents.codeless.CodelessLoggingEventListener.AutoLoggingOnClickListener");
}
if (((CodelessLoggingEventListener.AutoLoggingOnClickListener) existingOnClickListener).getSupportCodelessLogging()) {
z = true;
if (!this.listenerSet.contains(viewMapKey) || z) {
}
view2.setOnClickListener(CodelessLoggingEventListener.getOnClickListener(eventBinding, view, view2));
this.listenerSet.add(viewMapKey);
return;
}
}
z = false;
if (this.listenerSet.contains(viewMapKey)) {
}
}
private final void attachOnItemClickListener(MatchedView matchedView, View view, EventBinding eventBinding) {
boolean z;
AdapterView adapterView = (AdapterView) matchedView.getView();
if (adapterView == null) {
return;
}
String viewMapKey = matchedView.getViewMapKey();
AdapterView.OnItemClickListener onItemClickListener = adapterView.getOnItemClickListener();
if (onItemClickListener instanceof CodelessLoggingEventListener.AutoLoggingOnItemClickListener) {
if (onItemClickListener == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.appevents.codeless.CodelessLoggingEventListener.AutoLoggingOnItemClickListener");
}
if (((CodelessLoggingEventListener.AutoLoggingOnItemClickListener) onItemClickListener).getSupportCodelessLogging()) {
z = true;
if (!this.listenerSet.contains(viewMapKey) || z) {
}
adapterView.setOnItemClickListener(CodelessLoggingEventListener.getOnItemClickListener(eventBinding, view, adapterView));
this.listenerSet.add(viewMapKey);
return;
}
}
z = false;
if (this.listenerSet.contains(viewMapKey)) {
}
}
private final void attachRCTListener(MatchedView matchedView, View view, EventBinding eventBinding) {
boolean z;
View view2 = matchedView.getView();
if (view2 == null) {
return;
}
String viewMapKey = matchedView.getViewMapKey();
View.OnTouchListener existingOnTouchListener = ViewHierarchy.getExistingOnTouchListener(view2);
if (existingOnTouchListener instanceof RCTCodelessLoggingEventListener.AutoLoggingOnTouchListener) {
if (existingOnTouchListener == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.appevents.codeless.RCTCodelessLoggingEventListener.AutoLoggingOnTouchListener");
}
if (((RCTCodelessLoggingEventListener.AutoLoggingOnTouchListener) existingOnTouchListener).getSupportCodelessLogging()) {
z = true;
if (!this.listenerSet.contains(viewMapKey) || z) {
}
view2.setOnTouchListener(RCTCodelessLoggingEventListener.getOnTouchListener(eventBinding, view, view2));
this.listenerSet.add(viewMapKey);
return;
}
}
z = false;
if (this.listenerSet.contains(viewMapKey)) {
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final List<MatchedView> findViewByPath(EventBinding eventBinding, View view, List<PathComponent> path, int i, int i2, String mapKey) {
List<View> findVisibleChildren;
int size;
List<View> findVisibleChildren2;
int size2;
Intrinsics.checkNotNullParameter(path, "path");
Intrinsics.checkNotNullParameter(mapKey, "mapKey");
String str = mapKey + '.' + i2;
ArrayList arrayList = new ArrayList();
if (view == null) {
return arrayList;
}
if (i >= path.size()) {
arrayList.add(new MatchedView(view, str));
} else {
PathComponent pathComponent = path.get(i);
if (Intrinsics.areEqual(pathComponent.getClassName(), CodelessMatcher.PARENT_CLASS_NAME)) {
ViewParent parent = view.getParent();
if ((parent instanceof ViewGroup) && (size = (findVisibleChildren = findVisibleChildren((ViewGroup) parent)).size()) > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
arrayList.addAll(findViewByPath(eventBinding, findVisibleChildren.get(i3), path, i + 1, i3, str));
if (i4 >= size) {
break;
}
i3 = i4;
}
}
return arrayList;
}
if (Intrinsics.areEqual(pathComponent.getClassName(), ".")) {
arrayList.add(new MatchedView(view, str));
return arrayList;
}
if (!isTheSameView(view, pathComponent, i2)) {
return arrayList;
}
if (i == path.size() - 1) {
arrayList.add(new MatchedView(view, str));
}
}
if ((view instanceof ViewGroup) && (size2 = (findVisibleChildren2 = findVisibleChildren((ViewGroup) view)).size()) > 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
arrayList.addAll(findViewByPath(eventBinding, findVisibleChildren2.get(i5), path, i + 1, i5, str));
if (i6 >= size2) {
break;
}
i5 = i6;
}
}
return arrayList;
}
/* JADX WARN: Code restructure failed: missing block: B:14:0x0066, code lost:
if (kotlin.jvm.internal.Intrinsics.areEqual(r10.getClass().getSimpleName(), (java.lang.String) r12.get(r12.size() - 1)) == false) goto L15;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final boolean isTheSameView(android.view.View r10, com.facebook.appevents.codeless.internal.PathComponent r11, int r12) {
/*
Method dump skipped, instructions count: 324
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.codeless.CodelessMatcher.ViewMatcher.Companion.isTheSameView(android.view.View, com.facebook.appevents.codeless.internal.PathComponent, int):boolean");
}
private final List<View> findVisibleChildren(ViewGroup viewGroup) {
ArrayList arrayList = new ArrayList();
int childCount = viewGroup.getChildCount();
if (childCount > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
View child = viewGroup.getChildAt(i);
if (child.getVisibility() == 0) {
Intrinsics.checkNotNullExpressionValue(child, "child");
arrayList.add(child);
}
if (i2 >= childCount) {
break;
}
i = i2;
}
}
return arrayList;
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final synchronized CodelessMatcher getInstance() {
CodelessMatcher access$getCodelessMatcher$cp;
try {
if (CodelessMatcher.access$getCodelessMatcher$cp() == null) {
CodelessMatcher.access$setCodelessMatcher$cp(new CodelessMatcher(null));
}
access$getCodelessMatcher$cp = CodelessMatcher.access$getCodelessMatcher$cp();
if (access$getCodelessMatcher$cp == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.appevents.codeless.CodelessMatcher");
}
} catch (Throwable th) {
throw th;
}
return access$getCodelessMatcher$cp;
}
@UiThread
public final Bundle getParameters(EventBinding eventBinding, View rootView, View hostView) {
List<ParameterComponent> viewParameters;
List<MatchedView> findViewByPath;
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
Bundle bundle = new Bundle();
if (eventBinding != null && (viewParameters = eventBinding.getViewParameters()) != null) {
for (ParameterComponent parameterComponent : viewParameters) {
if (parameterComponent.getValue() != null && parameterComponent.getValue().length() > 0) {
bundle.putString(parameterComponent.getName(), parameterComponent.getValue());
} else if (parameterComponent.getPath().size() > 0) {
if (Intrinsics.areEqual(parameterComponent.getPathType(), Constants.PATH_TYPE_RELATIVE)) {
ViewMatcher.Companion companion = ViewMatcher.Companion;
List<PathComponent> path = parameterComponent.getPath();
String simpleName = hostView.getClass().getSimpleName();
Intrinsics.checkNotNullExpressionValue(simpleName, "hostView.javaClass.simpleName");
findViewByPath = companion.findViewByPath(eventBinding, hostView, path, 0, -1, simpleName);
} else {
ViewMatcher.Companion companion2 = ViewMatcher.Companion;
List<PathComponent> path2 = parameterComponent.getPath();
String simpleName2 = rootView.getClass().getSimpleName();
Intrinsics.checkNotNullExpressionValue(simpleName2, "rootView.javaClass.simpleName");
findViewByPath = companion2.findViewByPath(eventBinding, rootView, path2, 0, -1, simpleName2);
}
Iterator<MatchedView> it = findViewByPath.iterator();
while (true) {
if (it.hasNext()) {
MatchedView next = it.next();
if (next.getView() != null) {
ViewHierarchy viewHierarchy = ViewHierarchy.INSTANCE;
String textOfView = ViewHierarchy.getTextOfView(next.getView());
if (textOfView.length() > 0) {
bundle.putString(parameterComponent.getName(), textOfView);
break;
}
}
}
}
}
}
}
return bundle;
}
}
}

View File

@@ -0,0 +1,73 @@
package com.facebook.appevents.codeless;
import android.view.MotionEvent;
import android.view.View;
import com.facebook.appevents.codeless.internal.EventBinding;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.ref.WeakReference;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class RCTCodelessLoggingEventListener {
public static final RCTCodelessLoggingEventListener INSTANCE = new RCTCodelessLoggingEventListener();
private RCTCodelessLoggingEventListener() {
}
public static final AutoLoggingOnTouchListener getOnTouchListener(EventBinding mapping, View rootView, View hostView) {
if (CrashShieldHandler.isObjectCrashing(RCTCodelessLoggingEventListener.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(mapping, "mapping");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
return new AutoLoggingOnTouchListener(mapping, rootView, hostView);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RCTCodelessLoggingEventListener.class);
return null;
}
}
public static final class AutoLoggingOnTouchListener implements View.OnTouchListener {
private final View.OnTouchListener existingOnTouchListener;
private final WeakReference<View> hostView;
private final EventBinding mapping;
private final WeakReference<View> rootView;
private boolean supportCodelessLogging;
public final boolean getSupportCodelessLogging() {
return this.supportCodelessLogging;
}
public final void setSupportCodelessLogging(boolean z) {
this.supportCodelessLogging = z;
}
public AutoLoggingOnTouchListener(EventBinding mapping, View rootView, View hostView) {
Intrinsics.checkNotNullParameter(mapping, "mapping");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(hostView, "hostView");
this.mapping = mapping;
this.hostView = new WeakReference<>(hostView);
this.rootView = new WeakReference<>(rootView);
this.existingOnTouchListener = ViewHierarchy.getExistingOnTouchListener(hostView);
this.supportCodelessLogging = true;
}
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(motionEvent, "motionEvent");
View view2 = this.rootView.get();
View view3 = this.hostView.get();
if (view2 != null && view3 != null && motionEvent.getAction() == 1) {
CodelessLoggingEventListener codelessLoggingEventListener = CodelessLoggingEventListener.INSTANCE;
CodelessLoggingEventListener.logEvent$facebook_core_release(this.mapping, view2, view3);
}
View.OnTouchListener onTouchListener = this.existingOnTouchListener;
return onTouchListener != null && onTouchListener.onTouch(view, motionEvent);
}
}
}

View File

@@ -0,0 +1,411 @@
package com.facebook.appevents.codeless;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import androidx.annotation.RestrictTo;
import com.facebook.AccessToken;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.codeless.ViewIndexer;
import com.facebook.appevents.codeless.internal.Constants;
import com.facebook.appevents.codeless.internal.UnityReflection;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.internal.InternalSettings;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.ByteArrayOutputStream;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class ViewIndexer {
private static final String APP_VERSION_PARAM = "app_version";
public static final Companion Companion = new Companion(null);
private static final String PLATFORM_PARAM = "platform";
private static final String REQUEST_TYPE = "request_type";
private static final String SUCCESS = "success";
private static final String TAG;
private static final String TREE_PARAM = "tree";
private static ViewIndexer instance;
private final WeakReference<Activity> activityReference;
private Timer indexingTimer;
private String previousDigest;
private final Handler uiThreadHandler;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final GraphRequest buildAppIndexingRequest(String str, AccessToken accessToken, String str2, String str3) {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return null;
}
try {
return Companion.buildAppIndexingRequest(str, accessToken, str2, str3);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
return null;
}
}
public static final void sendToServerUnityInstance(String str) {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return;
}
try {
Companion.sendToServerUnityInstance(str);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
}
}
public ViewIndexer(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
this.activityReference = new WeakReference<>(activity);
this.previousDigest = null;
this.uiThreadHandler = new Handler(Looper.getMainLooper());
instance = this;
}
public static final /* synthetic */ WeakReference access$getActivityReference$p(ViewIndexer viewIndexer) {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return null;
}
try {
return viewIndexer.activityReference;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
return null;
}
}
public static final /* synthetic */ ViewIndexer access$getInstance$cp() {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return null;
}
try {
return instance;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
return null;
}
}
public static final /* synthetic */ String access$getTAG$cp() {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return null;
}
try {
return TAG;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
return null;
}
}
public static final /* synthetic */ Handler access$getUiThreadHandler$p(ViewIndexer viewIndexer) {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return null;
}
try {
return viewIndexer.uiThreadHandler;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
return null;
}
}
public static final /* synthetic */ void access$sendToServer(ViewIndexer viewIndexer, String str) {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return;
}
try {
viewIndexer.sendToServer(str);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
}
}
public final void schedule() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
final TimerTask timerTask = new TimerTask() { // from class: com.facebook.appevents.codeless.ViewIndexer$schedule$indexingTask$1
@Override // java.util.TimerTask, java.lang.Runnable
public void run() {
try {
Activity activity = (Activity) ViewIndexer.access$getActivityReference$p(ViewIndexer.this).get();
View rootView = AppEventUtility.getRootView(activity);
if (activity != null && rootView != null) {
String simpleName = activity.getClass().getSimpleName();
if (CodelessManager.getIsAppIndexingEnabled$facebook_core_release()) {
if (InternalSettings.isUnityApp()) {
UnityReflection.captureViewHierarchy();
return;
}
FutureTask futureTask = new FutureTask(new ViewIndexer.ScreenshotTaker(rootView));
ViewIndexer.access$getUiThreadHandler$p(ViewIndexer.this).post(futureTask);
String str = "";
try {
str = (String) futureTask.get(1L, TimeUnit.SECONDS);
} catch (Exception e) {
Log.e(ViewIndexer.access$getTAG$cp(), "Failed to take screenshot.", e);
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(ViewHierarchyConstants.SCREEN_NAME_KEY, simpleName);
jSONObject.put("screenshot", str);
JSONArray jSONArray = new JSONArray();
jSONArray.put(ViewHierarchy.getDictionaryOfView(rootView));
jSONObject.put("view", jSONArray);
} catch (JSONException unused) {
Log.e(ViewIndexer.access$getTAG$cp(), "Failed to create JSONObject");
}
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "viewTree.toString()");
ViewIndexer.access$sendToServer(ViewIndexer.this, jSONObject2);
}
}
} catch (Exception e2) {
Log.e(ViewIndexer.access$getTAG$cp(), "UI Component tree indexing failure!", e2);
}
}
};
try {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.codeless.ViewIndexer$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ViewIndexer.m492schedule$lambda0(ViewIndexer.this, timerTask);
}
});
} catch (RejectedExecutionException e) {
Log.e(TAG, "Error scheduling indexing job", e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: schedule$lambda-0, reason: not valid java name */
public static final void m492schedule$lambda0(ViewIndexer this$0, TimerTask indexingTask) {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(indexingTask, "$indexingTask");
try {
Timer timer = this$0.indexingTimer;
if (timer != null) {
timer.cancel();
}
this$0.previousDigest = null;
Timer timer2 = new Timer();
timer2.scheduleAtFixedRate(indexingTask, 0L, 1000L);
this$0.indexingTimer = timer2;
} catch (Exception e) {
Log.e(TAG, "Error scheduling indexing job", e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
}
}
public final void unschedule() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (this.activityReference.get() == null) {
return;
}
try {
Timer timer = this.indexingTimer;
if (timer != null) {
timer.cancel();
}
this.indexingTimer = null;
} catch (Exception e) {
Log.e(TAG, "Error unscheduling indexing job", e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void sendToServer(final String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.codeless.ViewIndexer$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ViewIndexer.m493sendToServer$lambda1(str, this);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendToServer$lambda-1, reason: not valid java name */
public static final void m493sendToServer$lambda1(String tree, ViewIndexer this$0) {
if (CrashShieldHandler.isObjectCrashing(ViewIndexer.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(tree, "$tree");
Intrinsics.checkNotNullParameter(this$0, "this$0");
String md5hash = Utility.md5hash(tree);
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (md5hash == null || !Intrinsics.areEqual(md5hash, this$0.previousDigest)) {
this$0.processRequest(Companion.buildAppIndexingRequest(tree, currentAccessToken, FacebookSdk.getApplicationId(), Constants.APP_INDEXING), md5hash);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewIndexer.class);
}
}
public final void processRequest(GraphRequest graphRequest, String str) {
if (CrashShieldHandler.isObjectCrashing(this) || graphRequest == null) {
return;
}
try {
GraphResponse executeAndWait = graphRequest.executeAndWait();
try {
JSONObject jSONObject = executeAndWait.getJSONObject();
if (jSONObject != null) {
if (Intrinsics.areEqual("true", jSONObject.optString("success"))) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "Successfully send UI component tree to server");
this.previousDigest = str;
}
if (jSONObject.has(Constants.APP_INDEXING_ENABLED)) {
CodelessManager.updateAppIndexing$facebook_core_release(jSONObject.getBoolean(Constants.APP_INDEXING_ENABLED));
return;
}
return;
}
Log.e(TAG, Intrinsics.stringPlus("Error sending UI component tree to Facebook: ", executeAndWait.getError()));
} catch (JSONException e) {
Log.e(TAG, "Error decoding server response.", e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class ScreenshotTaker implements Callable<String> {
private final WeakReference<View> rootView;
public ScreenshotTaker(View rootView) {
Intrinsics.checkNotNullParameter(rootView, "rootView");
this.rootView = new WeakReference<>(rootView);
}
@Override // java.util.concurrent.Callable
public String call() {
View view = this.rootView.get();
if (view == null || view.getWidth() == 0 || view.getHeight() == 0) {
return "";
}
Bitmap createBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.RGB_565);
view.draw(new Canvas(createBitmap));
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
createBitmap.compress(Bitmap.CompressFormat.JPEG, 10, byteArrayOutputStream);
String encodeToString = Base64.encodeToString(byteArrayOutputStream.toByteArray(), 2);
Intrinsics.checkNotNullExpressionValue(encodeToString, "encodeToString(outputStream.toByteArray(), Base64.NO_WRAP)");
return encodeToString;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final void sendToServerUnityInstance(String tree) {
Intrinsics.checkNotNullParameter(tree, "tree");
ViewIndexer access$getInstance$cp = ViewIndexer.access$getInstance$cp();
if (access$getInstance$cp == null) {
return;
}
ViewIndexer.access$sendToServer(access$getInstance$cp, tree);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final GraphRequest buildAppIndexingRequest(String str, AccessToken accessToken, String str2, String requestType) {
Intrinsics.checkNotNullParameter(requestType, "requestType");
if (str == null) {
return null;
}
GraphRequest.Companion companion = GraphRequest.Companion;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, "%s/app_indexing", Arrays.copyOf(new Object[]{str2}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
GraphRequest newPostRequest = companion.newPostRequest(accessToken, format, null, null);
Bundle parameters = newPostRequest.getParameters();
if (parameters == null) {
parameters = new Bundle();
}
parameters.putString(ViewIndexer.TREE_PARAM, str);
parameters.putString(ViewIndexer.APP_VERSION_PARAM, AppEventUtility.getAppVersion());
parameters.putString("platform", "android");
parameters.putString(ViewIndexer.REQUEST_TYPE, requestType);
if (Intrinsics.areEqual(requestType, Constants.APP_INDEXING)) {
parameters.putString(Constants.DEVICE_SESSION_ID, CodelessManager.getCurrentDeviceSessionID$facebook_core_release());
}
newPostRequest.setParameters(parameters);
newPostRequest.setCallback(new GraphRequest.Callback() { // from class: com.facebook.appevents.codeless.ViewIndexer$Companion$$ExternalSyntheticLambda0
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
ViewIndexer.Companion.m495buildAppIndexingRequest$lambda0(graphResponse);
}
});
return newPostRequest;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: buildAppIndexingRequest$lambda-0, reason: not valid java name */
public static final void m495buildAppIndexingRequest$lambda0(GraphResponse it) {
Intrinsics.checkNotNullParameter(it, "it");
Logger.Companion.log(LoggingBehavior.APP_EVENTS, ViewIndexer.access$getTAG$cp(), "App index sent to FB!");
}
}
static {
String canonicalName = ViewIndexer.class.getCanonicalName();
if (canonicalName == null) {
canonicalName = "";
}
TAG = canonicalName;
}
}

View File

@@ -0,0 +1,74 @@
package com.facebook.appevents.codeless;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ViewIndexingTrigger implements SensorEventListener {
public static final Companion Companion = new Companion(null);
private static final double SHAKE_THRESHOLD_GRAVITY = 2.3d;
private OnShakeListener onShakeListener;
public interface OnShakeListener {
void onShake();
}
public final void setOnShakeListener(OnShakeListener onShakeListener) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
this.onShakeListener = onShakeListener;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // android.hardware.SensorEventListener
public void onSensorChanged(SensorEvent event) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(event, "event");
OnShakeListener onShakeListener = this.onShakeListener;
if (onShakeListener == null) {
return;
}
float[] fArr = event.values;
double d = fArr[0] / 9.80665f;
double d2 = fArr[1] / 9.80665f;
double d3 = fArr[2] / 9.80665f;
if (Math.sqrt((d * d) + (d2 * d2) + (d3 * d3)) > SHAKE_THRESHOLD_GRAVITY) {
onShakeListener.onShake();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // android.hardware.SensorEventListener
public void onAccuracyChanged(Sensor sensor, int i) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(sensor, "sensor");
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,21 @@
package com.facebook.appevents.codeless.internal;
/* loaded from: classes2.dex */
public final class Constants {
public static final String APP_INDEXING = "app_indexing";
public static final String APP_INDEXING_ENABLED = "is_app_indexing_enabled";
public static final int APP_INDEXING_SCHEDULE_INTERVAL_MS = 1000;
public static final String BUTTON_SAMPLING = "button_sampling";
public static final String DEVICE_SESSION_ID = "device_session_id";
public static final String EVENT_MAPPING_PATH_TYPE_KEY = "path_type";
public static final String EXTINFO = "extinfo";
public static final Constants INSTANCE = new Constants();
public static final String IS_CODELESS_EVENT_KEY = "_is_fb_codeless";
public static final int MAX_TREE_DEPTH = 25;
public static final String PATH_TYPE_ABSOLUTE = "absolute";
public static final String PATH_TYPE_RELATIVE = "relative";
public static final String PLATFORM = "android";
private Constants() {
}
}

View File

@@ -0,0 +1,212 @@
package com.facebook.appevents.codeless.internal;
import com.tapjoy.TJAdUnitConstants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class EventBinding {
public static final Companion Companion = new Companion(null);
private final String activityName;
private final String appVersion;
private final String componentId;
private final String eventName;
private final MappingMethod method;
private final List<ParameterComponent> parameters;
private final List<PathComponent> path;
private final String pathType;
private final ActionType type;
public static final EventBinding getInstanceFromJson(JSONObject jSONObject) throws JSONException, IllegalArgumentException {
return Companion.getInstanceFromJson(jSONObject);
}
public static final List<EventBinding> parseArray(JSONArray jSONArray) {
return Companion.parseArray(jSONArray);
}
public final String getActivityName() {
return this.activityName;
}
public final String getAppVersion() {
return this.appVersion;
}
public final String getComponentId() {
return this.componentId;
}
public final String getEventName() {
return this.eventName;
}
public final MappingMethod getMethod() {
return this.method;
}
public final String getPathType() {
return this.pathType;
}
public final ActionType getType() {
return this.type;
}
public EventBinding(String eventName, MappingMethod method, ActionType type, String appVersion, List<PathComponent> path, List<ParameterComponent> parameters, String componentId, String pathType, String activityName) {
Intrinsics.checkNotNullParameter(eventName, "eventName");
Intrinsics.checkNotNullParameter(method, "method");
Intrinsics.checkNotNullParameter(type, "type");
Intrinsics.checkNotNullParameter(appVersion, "appVersion");
Intrinsics.checkNotNullParameter(path, "path");
Intrinsics.checkNotNullParameter(parameters, "parameters");
Intrinsics.checkNotNullParameter(componentId, "componentId");
Intrinsics.checkNotNullParameter(pathType, "pathType");
Intrinsics.checkNotNullParameter(activityName, "activityName");
this.eventName = eventName;
this.method = method;
this.type = type;
this.appVersion = appVersion;
this.path = path;
this.parameters = parameters;
this.componentId = componentId;
this.pathType = pathType;
this.activityName = activityName;
}
public final List<PathComponent> getViewPath() {
List<PathComponent> unmodifiableList = Collections.unmodifiableList(this.path);
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "unmodifiableList(path)");
return unmodifiableList;
}
public final List<ParameterComponent> getViewParameters() {
List<ParameterComponent> unmodifiableList = Collections.unmodifiableList(this.parameters);
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "unmodifiableList(parameters)");
return unmodifiableList;
}
public enum MappingMethod {
MANUAL,
INFERENCE;
/* renamed from: values, reason: to resolve conflict with enum method */
public static MappingMethod[] valuesCustom() {
MappingMethod[] valuesCustom = values();
return (MappingMethod[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public enum ActionType {
CLICK,
SELECTED,
TEXT_CHANGED;
/* renamed from: values, reason: to resolve conflict with enum method */
public static ActionType[] valuesCustom() {
ActionType[] valuesCustom = values();
return (ActionType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final List<EventBinding> parseArray(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
if (jSONArray != null) {
try {
int length = jSONArray.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
JSONObject jSONObject = jSONArray.getJSONObject(i);
Intrinsics.checkNotNullExpressionValue(jSONObject, "array.getJSONObject(i)");
arrayList.add(getInstanceFromJson(jSONObject));
if (i2 >= length) {
break;
}
i = i2;
}
}
} catch (IllegalArgumentException | JSONException unused) {
}
}
return arrayList;
}
public final EventBinding getInstanceFromJson(JSONObject mapping) throws JSONException, IllegalArgumentException {
int length;
Intrinsics.checkNotNullParameter(mapping, "mapping");
String eventName = mapping.getString(TJAdUnitConstants.PARAM_PLACEMENT_NAME);
String string = mapping.getString("method");
Intrinsics.checkNotNullExpressionValue(string, "mapping.getString(\"method\")");
Locale ENGLISH = Locale.ENGLISH;
Intrinsics.checkNotNullExpressionValue(ENGLISH, "ENGLISH");
String upperCase = string.toUpperCase(ENGLISH);
Intrinsics.checkNotNullExpressionValue(upperCase, "(this as java.lang.String).toUpperCase(locale)");
MappingMethod valueOf = MappingMethod.valueOf(upperCase);
String string2 = mapping.getString("event_type");
Intrinsics.checkNotNullExpressionValue(string2, "mapping.getString(\"event_type\")");
Intrinsics.checkNotNullExpressionValue(ENGLISH, "ENGLISH");
String upperCase2 = string2.toUpperCase(ENGLISH);
Intrinsics.checkNotNullExpressionValue(upperCase2, "(this as java.lang.String).toUpperCase(locale)");
ActionType valueOf2 = ActionType.valueOf(upperCase2);
String appVersion = mapping.getString("app_version");
JSONArray jSONArray = mapping.getJSONArray("path");
ArrayList arrayList = new ArrayList();
int length2 = jSONArray.length();
int i = 0;
if (length2 > 0) {
int i2 = 0;
while (true) {
int i3 = i2 + 1;
JSONObject jsonPath = jSONArray.getJSONObject(i2);
Intrinsics.checkNotNullExpressionValue(jsonPath, "jsonPath");
arrayList.add(new PathComponent(jsonPath));
if (i3 >= length2) {
break;
}
i2 = i3;
}
}
String pathType = mapping.optString(Constants.EVENT_MAPPING_PATH_TYPE_KEY, Constants.PATH_TYPE_ABSOLUTE);
JSONArray optJSONArray = mapping.optJSONArray("parameters");
ArrayList arrayList2 = new ArrayList();
if (optJSONArray != null && (length = optJSONArray.length()) > 0) {
while (true) {
int i4 = i + 1;
JSONObject jsonParameter = optJSONArray.getJSONObject(i);
Intrinsics.checkNotNullExpressionValue(jsonParameter, "jsonParameter");
arrayList2.add(new ParameterComponent(jsonParameter));
if (i4 >= length) {
break;
}
i = i4;
}
}
String componentId = mapping.optString("component_id");
String activityName = mapping.optString("activity_name");
Intrinsics.checkNotNullExpressionValue(eventName, "eventName");
Intrinsics.checkNotNullExpressionValue(appVersion, "appVersion");
Intrinsics.checkNotNullExpressionValue(componentId, "componentId");
Intrinsics.checkNotNullExpressionValue(pathType, "pathType");
Intrinsics.checkNotNullExpressionValue(activityName, "activityName");
return new EventBinding(eventName, valueOf, valueOf2, appVersion, arrayList, arrayList2, componentId, pathType, activityName);
}
}
}

View File

@@ -0,0 +1,76 @@
package com.facebook.appevents.codeless.internal;
import java.util.ArrayList;
import java.util.List;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class ParameterComponent {
public static final Companion Companion = new Companion(null);
private static final String PARAMETER_NAME_KEY = "name";
private static final String PARAMETER_PATH_KEY = "path";
private static final String PARAMETER_VALUE_KEY = "value";
private final String name;
private final List<PathComponent> path;
private final String pathType;
private final String value;
public final String getName() {
return this.name;
}
public final List<PathComponent> getPath() {
return this.path;
}
public final String getPathType() {
return this.pathType;
}
public final String getValue() {
return this.value;
}
public ParameterComponent(JSONObject component) {
int length;
Intrinsics.checkNotNullParameter(component, "component");
String string = component.getString("name");
Intrinsics.checkNotNullExpressionValue(string, "component.getString(PARAMETER_NAME_KEY)");
this.name = string;
String optString = component.optString("value");
Intrinsics.checkNotNullExpressionValue(optString, "component.optString(PARAMETER_VALUE_KEY)");
this.value = optString;
String optString2 = component.optString(Constants.EVENT_MAPPING_PATH_TYPE_KEY, Constants.PATH_TYPE_ABSOLUTE);
Intrinsics.checkNotNullExpressionValue(optString2, "component.optString(Constants.EVENT_MAPPING_PATH_TYPE_KEY, Constants.PATH_TYPE_ABSOLUTE)");
this.pathType = optString2;
ArrayList arrayList = new ArrayList();
JSONArray optJSONArray = component.optJSONArray("path");
if (optJSONArray != null && (length = optJSONArray.length()) > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
JSONObject jSONObject = optJSONArray.getJSONObject(i);
Intrinsics.checkNotNullExpressionValue(jSONObject, "jsonPathArray.getJSONObject(i)");
arrayList.add(new PathComponent(jSONObject));
if (i2 >= length) {
break;
} else {
i = i2;
}
}
}
this.path = arrayList;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,114 @@
package com.facebook.appevents.codeless.internal;
import java.util.Arrays;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class PathComponent {
public static final Companion Companion = new Companion(null);
private static final String PATH_CLASS_NAME_KEY = "class_name";
private static final String PATH_DESCRIPTION_KEY = "description";
private static final String PATH_HINT_KEY = "hint";
private static final String PATH_ID_KEY = "id";
private static final String PATH_INDEX_KEY = "index";
private static final String PATH_MATCH_BITMASK_KEY = "match_bitmask";
private static final String PATH_TAG_KEY = "tag";
private static final String PATH_TEXT_KEY = "text";
private final String className;
private final String description;
private final String hint;
private final int id;
private final int index;
private final int matchBitmask;
private final String tag;
private final String text;
public final String getClassName() {
return this.className;
}
public final String getDescription() {
return this.description;
}
public final String getHint() {
return this.hint;
}
public final int getId() {
return this.id;
}
public final int getIndex() {
return this.index;
}
public final int getMatchBitmask() {
return this.matchBitmask;
}
public final String getTag() {
return this.tag;
}
public final String getText() {
return this.text;
}
public enum MatchBitmaskType {
ID(1),
TEXT(2),
TAG(4),
DESCRIPTION(8),
HINT(16);
private final int value;
public final int getValue() {
return this.value;
}
MatchBitmaskType(int i) {
this.value = i;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static MatchBitmaskType[] valuesCustom() {
MatchBitmaskType[] valuesCustom = values();
return (MatchBitmaskType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public PathComponent(JSONObject component) {
Intrinsics.checkNotNullParameter(component, "component");
String string = component.getString(PATH_CLASS_NAME_KEY);
Intrinsics.checkNotNullExpressionValue(string, "component.getString(PATH_CLASS_NAME_KEY)");
this.className = string;
this.index = component.optInt(PATH_INDEX_KEY, -1);
this.id = component.optInt("id");
String optString = component.optString("text");
Intrinsics.checkNotNullExpressionValue(optString, "component.optString(PATH_TEXT_KEY)");
this.text = optString;
String optString2 = component.optString("tag");
Intrinsics.checkNotNullExpressionValue(optString2, "component.optString(PATH_TAG_KEY)");
this.tag = optString2;
String optString3 = component.optString("description");
Intrinsics.checkNotNullExpressionValue(optString3, "component.optString(PATH_DESCRIPTION_KEY)");
this.description = optString3;
String optString4 = component.optString("hint");
Intrinsics.checkNotNullExpressionValue(optString4, "component.optString(PATH_HINT_KEY)");
this.hint = optString4;
this.matchBitmask = component.optInt(PATH_MATCH_BITMASK_KEY);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,151 @@
package com.facebook.appevents.codeless.internal;
import android.text.method.PasswordTransformationMethod;
import android.util.Patterns;
import android.view.View;
import android.widget.TextView;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.text.CharsKt__CharKt;
import kotlin.text.Regex;
/* loaded from: classes2.dex */
public final class SensitiveUserDataUtils {
public static final SensitiveUserDataUtils INSTANCE = new SensitiveUserDataUtils();
private SensitiveUserDataUtils() {
}
public static final boolean isSensitiveUserData(View view) {
if (CrashShieldHandler.isObjectCrashing(SensitiveUserDataUtils.class)) {
return false;
}
try {
if (!(view instanceof TextView)) {
return false;
}
SensitiveUserDataUtils sensitiveUserDataUtils = INSTANCE;
if (!sensitiveUserDataUtils.isPassword((TextView) view) && !sensitiveUserDataUtils.isCreditCard((TextView) view) && !sensitiveUserDataUtils.isPersonName((TextView) view) && !sensitiveUserDataUtils.isPostalAddress((TextView) view) && !sensitiveUserDataUtils.isPhoneNumber((TextView) view)) {
if (!sensitiveUserDataUtils.isEmail((TextView) view)) {
return false;
}
}
return true;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SensitiveUserDataUtils.class);
return false;
}
}
private final boolean isPassword(TextView textView) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
if (textView.getInputType() == 128) {
return true;
}
return textView.getTransformationMethod() instanceof PasswordTransformationMethod;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean isEmail(TextView textView) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
if (textView.getInputType() == 32) {
return true;
}
String textOfView = ViewHierarchy.getTextOfView(textView);
if (textOfView != null && textOfView.length() != 0) {
return Patterns.EMAIL_ADDRESS.matcher(textOfView).matches();
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean isPersonName(TextView textView) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return textView.getInputType() == 96;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean isPostalAddress(TextView textView) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return textView.getInputType() == 112;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean isPhoneNumber(TextView textView) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return textView.getInputType() == 3;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean isCreditCard(TextView textView) {
int i;
int digitToInt;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
String replace = new Regex("\\s").replace(ViewHierarchy.getTextOfView(textView), "");
int length = replace.length();
if (length >= 12 && length <= 19) {
int i2 = length - 1;
if (i2 >= 0) {
boolean z = false;
i = 0;
while (true) {
int i3 = i2 - 1;
char charAt = replace.charAt(i2);
if (!Character.isDigit(charAt)) {
return false;
}
digitToInt = CharsKt__CharKt.digitToInt(charAt);
if (z && (digitToInt = digitToInt * 2) > 9) {
digitToInt = (digitToInt % 10) + 1;
}
i += digitToInt;
z = !z;
if (i3 < 0) {
break;
}
i2 = i3;
}
} else {
i = 0;
}
return i % 10 == 0;
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
}

View File

@@ -0,0 +1,58 @@
package com.facebook.appevents.codeless.internal;
import android.util.Log;
import java.lang.reflect.Method;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class UnityReflection {
private static final String CAPTURE_VIEW_HIERARCHY_METHOD = "CaptureViewHierarchy";
private static final String EVENT_MAPPING_METHOD = "OnReceiveMapping";
private static final String FB_UNITY_GAME_OBJECT = "UnityFacebookSDKPlugin";
public static final UnityReflection INSTANCE = new UnityReflection();
private static final String TAG = UnityReflection.class.getCanonicalName();
private static final String UNITY_PLAYER_CLASS = "com.unity3d.player.UnityPlayer";
private static final String UNITY_SEND_MESSAGE_METHOD = "UnitySendMessage";
private static Class<?> unityPlayer;
private UnityReflection() {
}
private final Class<?> getUnityPlayerClass() {
Class<?> cls = Class.forName("com.unity3d.player.UnityPlayer");
Intrinsics.checkNotNullExpressionValue(cls, "forName(UNITY_PLAYER_CLASS)");
return cls;
}
public static final void sendMessage(String str, String str2, String str3) {
try {
if (unityPlayer == null) {
unityPlayer = INSTANCE.getUnityPlayerClass();
}
Class<?> cls = unityPlayer;
if (cls != null) {
Method method = cls.getMethod(UNITY_SEND_MESSAGE_METHOD, String.class, String.class, String.class);
Class<?> cls2 = unityPlayer;
if (cls2 != null) {
method.invoke(cls2, str, str2, str3);
return;
} else {
Intrinsics.throwUninitializedPropertyAccessException("unityPlayer");
throw null;
}
}
Intrinsics.throwUninitializedPropertyAccessException("unityPlayer");
throw null;
} catch (Exception e) {
Log.e(TAG, "Failed to send message to Unity", e);
}
}
public static final void captureViewHierarchy() {
sendMessage(FB_UNITY_GAME_OBJECT, CAPTURE_VIEW_HIERARCHY_METHOD, "");
}
public static final void sendEventMapping(String str) {
sendMessage(FB_UNITY_GAME_OBJECT, EVENT_MAPPING_METHOD, str);
}
}

View File

@@ -0,0 +1,712 @@
package com.facebook.appevents.codeless.internal;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.AdapterView;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RatingBar;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.TimePicker;
import androidx.annotation.RestrictTo;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.ByteArrayOutputStream;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ViewHierarchy {
private static final String CLASS_RCTROOTVIEW = "com.facebook.react.ReactRootView";
private static final String CLASS_RCTVIEWGROUP = "com.facebook.react.views.view.ReactViewGroup";
private static final String CLASS_TOUCHTARGETHELPER = "com.facebook.react.uimanager.TouchTargetHelper";
private static final int ICON_MAX_EDGE_LENGTH = 44;
private static final String METHOD_FIND_TOUCHTARGET_VIEW = "findTouchTargetView";
private static Method methodFindTouchTargetView;
public static final ViewHierarchy INSTANCE = new ViewHierarchy();
private static final String TAG = ViewHierarchy.class.getCanonicalName();
private static WeakReference<View> RCTRootViewReference = new WeakReference<>(null);
private ViewHierarchy() {
}
public static final ViewGroup getParentOfView(View view) {
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class) || view == null) {
return null;
}
try {
ViewParent parent = view.getParent();
if (parent instanceof ViewGroup) {
return (ViewGroup) parent;
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return null;
}
}
public static final List<View> getChildrenOfView(View view) {
int childCount;
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return null;
}
try {
ArrayList arrayList = new ArrayList();
if ((view instanceof ViewGroup) && (childCount = ((ViewGroup) view).getChildCount()) > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
arrayList.add(((ViewGroup) view).getChildAt(i));
if (i2 >= childCount) {
break;
}
i = i2;
}
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return null;
}
}
public static final void updateBasicInfoOfView(View view, JSONObject json) {
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(json, "json");
try {
String textOfView = getTextOfView(view);
String hintOfView = getHintOfView(view);
Object tag = view.getTag();
CharSequence contentDescription = view.getContentDescription();
json.put(ViewHierarchyConstants.CLASS_NAME_KEY, view.getClass().getCanonicalName());
json.put(ViewHierarchyConstants.CLASS_TYPE_BITMASK_KEY, getClassTypeBitmask(view));
json.put("id", view.getId());
if (!SensitiveUserDataUtils.isSensitiveUserData(view)) {
json.put("text", Utility.coerceValueIfNullOrEmpty(Utility.sha256hash(textOfView), ""));
} else {
json.put("text", "");
json.put(ViewHierarchyConstants.IS_USER_INPUT_KEY, true);
}
json.put(ViewHierarchyConstants.HINT_KEY, Utility.coerceValueIfNullOrEmpty(Utility.sha256hash(hintOfView), ""));
if (tag != null) {
json.put("tag", Utility.coerceValueIfNullOrEmpty(Utility.sha256hash(tag.toString()), ""));
}
if (contentDescription != null) {
json.put("description", Utility.coerceValueIfNullOrEmpty(Utility.sha256hash(contentDescription.toString()), ""));
}
json.put(ViewHierarchyConstants.DIMENSION_KEY, INSTANCE.getDimensionOfView(view));
} catch (JSONException e) {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
}
}
public static final void updateAppearanceOfView(View view, JSONObject json, float f) {
Bitmap bitmap;
Typeface typeface;
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(json, "json");
try {
JSONObject jSONObject = new JSONObject();
if ((view instanceof TextView) && (typeface = ((TextView) view).getTypeface()) != null) {
jSONObject.put(ViewHierarchyConstants.TEXT_SIZE, ((TextView) view).getTextSize());
jSONObject.put(ViewHierarchyConstants.TEXT_IS_BOLD, typeface.isBold());
jSONObject.put(ViewHierarchyConstants.TEXT_IS_ITALIC, typeface.isItalic());
json.put(ViewHierarchyConstants.TEXT_STYLE, jSONObject);
}
if (view instanceof ImageView) {
Drawable drawable = ((ImageView) view).getDrawable();
if (drawable instanceof BitmapDrawable) {
float f2 = 44;
if (view.getHeight() / f > f2 || view.getWidth() / f > f2 || (bitmap = ((BitmapDrawable) drawable).getBitmap()) == null) {
return;
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
json.put(ViewHierarchyConstants.ICON_BITMAP, Base64.encodeToString(byteArrayOutputStream.toByteArray(), 0));
}
}
} catch (JSONException e) {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, e);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
}
}
public static final JSONObject getDictionaryOfView(View view) {
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
if (Intrinsics.areEqual(view.getClass().getName(), CLASS_RCTROOTVIEW)) {
RCTRootViewReference = new WeakReference<>(view);
}
JSONObject jSONObject = new JSONObject();
try {
updateBasicInfoOfView(view, jSONObject);
JSONArray jSONArray = new JSONArray();
List<View> childrenOfView = getChildrenOfView(view);
int size = childrenOfView.size() - 1;
if (size >= 0) {
int i = 0;
while (true) {
int i2 = i + 1;
jSONArray.put(getDictionaryOfView(childrenOfView.get(i)));
if (i2 > size) {
break;
}
i = i2;
}
}
jSONObject.put(ViewHierarchyConstants.CHILDREN_VIEW_KEY, jSONArray);
} catch (JSONException e) {
Log.e(TAG, "Failed to create JSONObject for view.", e);
}
return jSONObject;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return null;
}
}
/* JADX WARN: Removed duplicated region for block: B:24:0x004a A[Catch: all -> 0x0044, TryCatch #0 {all -> 0x0044, blocks: (B:6:0x000a, B:9:0x0016, B:11:0x001c, B:12:0x001e, B:14:0x0024, B:15:0x0026, B:17:0x002a, B:19:0x0030, B:21:0x0036, B:22:0x0046, B:24:0x004a, B:27:0x0039, B:29:0x003d, B:31:0x004d, B:33:0x0051, B:36:0x0056, B:38:0x005a, B:40:0x005e, B:42:0x0062, B:44:0x0065, B:46:0x0069), top: B:5:0x000a }] */
/* JADX WARN: Removed duplicated region for block: B:26:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final int getClassTypeBitmask(android.view.View r5) {
/*
java.lang.Class<com.facebook.appevents.codeless.internal.ViewHierarchy> r0 = com.facebook.appevents.codeless.internal.ViewHierarchy.class
boolean r1 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r0)
r2 = 0
if (r1 == 0) goto La
return r2
La:
java.lang.String r1 = "view"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r5, r1) // Catch: java.lang.Throwable -> L44
boolean r1 = r5 instanceof android.widget.ImageView // Catch: java.lang.Throwable -> L44
if (r1 == 0) goto L15
r1 = 2
goto L16
L15:
r1 = r2
L16:
boolean r3 = r5.isClickable() // Catch: java.lang.Throwable -> L44
if (r3 == 0) goto L1e
r1 = r1 | 32
L1e:
boolean r3 = isAdapterViewItem(r5) // Catch: java.lang.Throwable -> L44
if (r3 == 0) goto L26
r1 = r1 | 512(0x200, float:7.17E-43)
L26:
boolean r3 = r5 instanceof android.widget.TextView // Catch: java.lang.Throwable -> L44
if (r3 == 0) goto L4d
r3 = r1 | 1025(0x401, float:1.436E-42)
boolean r4 = r5 instanceof android.widget.Button // Catch: java.lang.Throwable -> L44
if (r4 == 0) goto L42
r3 = r1 | 1029(0x405, float:1.442E-42)
boolean r4 = r5 instanceof android.widget.Switch // Catch: java.lang.Throwable -> L44
if (r4 == 0) goto L39
r1 = r1 | 9221(0x2405, float:1.2921E-41)
goto L46
L39:
boolean r4 = r5 instanceof android.widget.CheckBox // Catch: java.lang.Throwable -> L44
if (r4 == 0) goto L42
r3 = 33797(0x8405, float:4.736E-41)
r1 = r1 | r3
goto L46
L42:
r1 = r3
goto L46
L44:
r5 = move-exception
goto L7f
L46:
boolean r5 = r5 instanceof android.widget.EditText // Catch: java.lang.Throwable -> L44
if (r5 == 0) goto L7e
r1 = r1 | 2048(0x800, float:2.87E-42)
goto L7e
L4d:
boolean r3 = r5 instanceof android.widget.Spinner // Catch: java.lang.Throwable -> L44
if (r3 != 0) goto L7c
boolean r3 = r5 instanceof android.widget.DatePicker // Catch: java.lang.Throwable -> L44
if (r3 == 0) goto L56
goto L7c
L56:
boolean r3 = r5 instanceof android.widget.RatingBar // Catch: java.lang.Throwable -> L44
if (r3 == 0) goto L5e
r5 = 65536(0x10000, float:9.1835E-41)
r1 = r1 | r5
goto L7e
L5e:
boolean r3 = r5 instanceof android.widget.RadioGroup // Catch: java.lang.Throwable -> L44
if (r3 == 0) goto L65
r1 = r1 | 16384(0x4000, float:2.2959E-41)
goto L7e
L65:
boolean r3 = r5 instanceof android.view.ViewGroup // Catch: java.lang.Throwable -> L44
if (r3 == 0) goto L7e
com.facebook.appevents.codeless.internal.ViewHierarchy r3 = com.facebook.appevents.codeless.internal.ViewHierarchy.INSTANCE // Catch: java.lang.Throwable -> L44
java.lang.ref.WeakReference<android.view.View> r4 = com.facebook.appevents.codeless.internal.ViewHierarchy.RCTRootViewReference // Catch: java.lang.Throwable -> L44
java.lang.Object r4 = r4.get() // Catch: java.lang.Throwable -> L44
android.view.View r4 = (android.view.View) r4 // Catch: java.lang.Throwable -> L44
boolean r5 = r3.isRCTButton(r5, r4) // Catch: java.lang.Throwable -> L44
if (r5 == 0) goto L7e
r1 = r1 | 64
goto L7e
L7c:
r1 = r1 | 4096(0x1000, float:5.74E-42)
L7e:
return r1
L7f:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r5, r0)
return r2
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.codeless.internal.ViewHierarchy.getClassTypeBitmask(android.view.View):int");
}
private static final boolean isAdapterViewItem(View view) {
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return false;
}
try {
ViewParent parent = view.getParent();
if (parent instanceof AdapterView) {
return true;
}
ViewHierarchy viewHierarchy = INSTANCE;
Class<?> existingClass = viewHierarchy.getExistingClass("android.support.v4.view.NestedScrollingChild");
if (existingClass != null && existingClass.isInstance(parent)) {
return true;
}
Class<?> existingClass2 = viewHierarchy.getExistingClass("androidx.core.view.NestedScrollingChild");
if (existingClass2 != null) {
return existingClass2.isInstance(parent);
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return false;
}
}
public static final String getTextOfView(View view) {
CharSequence valueOf;
Object selectedItem;
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return null;
}
try {
if (view instanceof TextView) {
valueOf = ((TextView) view).getText();
if (view instanceof Switch) {
valueOf = ((Switch) view).isChecked() ? "1" : "0";
}
} else if (view instanceof Spinner) {
if (((Spinner) view).getCount() > 0 && (selectedItem = ((Spinner) view).getSelectedItem()) != null) {
valueOf = selectedItem.toString();
}
valueOf = null;
} else {
int i = 0;
if (view instanceof DatePicker) {
int year = ((DatePicker) view).getYear();
int month = ((DatePicker) view).getMonth();
int dayOfMonth = ((DatePicker) view).getDayOfMonth();
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
valueOf = String.format("%04d-%02d-%02d", Arrays.copyOf(new Object[]{Integer.valueOf(year), Integer.valueOf(month), Integer.valueOf(dayOfMonth)}, 3));
Intrinsics.checkNotNullExpressionValue(valueOf, "java.lang.String.format(format, *args)");
} else if (view instanceof TimePicker) {
Integer currentHour = ((TimePicker) view).getCurrentHour();
Intrinsics.checkNotNullExpressionValue(currentHour, "view.currentHour");
int intValue = currentHour.intValue();
Integer currentMinute = ((TimePicker) view).getCurrentMinute();
Intrinsics.checkNotNullExpressionValue(currentMinute, "view.currentMinute");
int intValue2 = currentMinute.intValue();
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
valueOf = String.format("%02d:%02d", Arrays.copyOf(new Object[]{Integer.valueOf(intValue), Integer.valueOf(intValue2)}, 2));
Intrinsics.checkNotNullExpressionValue(valueOf, "java.lang.String.format(format, *args)");
} else if (view instanceof RadioGroup) {
int checkedRadioButtonId = ((RadioGroup) view).getCheckedRadioButtonId();
int childCount = ((RadioGroup) view).getChildCount();
if (childCount > 0) {
while (true) {
int i2 = i + 1;
View childAt = ((RadioGroup) view).getChildAt(i);
if (childAt.getId() == checkedRadioButtonId && (childAt instanceof RadioButton)) {
valueOf = ((RadioButton) childAt).getText();
break;
}
if (i2 >= childCount) {
break;
}
i = i2;
}
}
valueOf = null;
} else {
if (view instanceof RatingBar) {
valueOf = String.valueOf(((RatingBar) view).getRating());
}
valueOf = null;
}
}
if (valueOf == null) {
return "";
}
String obj = valueOf.toString();
return obj == null ? "" : obj;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return null;
}
}
public static final String getHintOfView(View view) {
CharSequence hint;
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return null;
}
try {
if (view instanceof EditText) {
hint = ((EditText) view).getHint();
} else {
hint = view instanceof TextView ? ((TextView) view).getHint() : null;
}
if (hint == null) {
return "";
}
String obj = hint.toString();
return obj == null ? "" : obj;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return null;
}
}
private final JSONObject getDimensionOfView(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("top", view.getTop());
jSONObject.put("left", view.getLeft());
jSONObject.put("width", view.getWidth());
jSONObject.put("height", view.getHeight());
jSONObject.put(ViewHierarchyConstants.DIMENSION_SCROLL_X_KEY, view.getScrollX());
jSONObject.put(ViewHierarchyConstants.DIMENSION_SCROLL_Y_KEY, view.getScrollY());
jSONObject.put(ViewHierarchyConstants.DIMENSION_VISIBILITY_KEY, view.getVisibility());
} catch (JSONException e) {
Log.e(TAG, "Failed to create JSONObject for dimension.", e);
}
return jSONObject;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final View.OnClickListener getExistingOnClickListener(View view) {
Field declaredField;
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return null;
}
try {
Field declaredField2 = Class.forName("android.view.View").getDeclaredField("mListenerInfo");
if (declaredField2 != null) {
declaredField2.setAccessible(true);
}
Object obj = declaredField2.get(view);
if (obj == null || (declaredField = Class.forName("android.view.View$ListenerInfo").getDeclaredField("mOnClickListener")) == null) {
return null;
}
declaredField.setAccessible(true);
Object obj2 = declaredField.get(obj);
if (obj2 != null) {
return (View.OnClickListener) obj2;
}
throw new NullPointerException("null cannot be cast to non-null type android.view.View.OnClickListener");
} catch (ClassNotFoundException | IllegalAccessException | NoSuchFieldException unused) {
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return null;
}
}
public static final void setOnClickListener(View view, View.OnClickListener onClickListener) {
Field field;
Field field2;
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
Object obj = null;
try {
try {
field = Class.forName("android.view.View").getDeclaredField("mListenerInfo");
try {
field2 = Class.forName("android.view.View$ListenerInfo").getDeclaredField("mOnClickListener");
} catch (ClassNotFoundException | NoSuchFieldException unused) {
field2 = null;
if (field != null) {
}
view.setOnClickListener(onClickListener);
return;
}
} catch (Exception unused2) {
return;
}
} catch (ClassNotFoundException | NoSuchFieldException unused3) {
field = null;
}
if (field != null || field2 == null) {
view.setOnClickListener(onClickListener);
return;
}
field.setAccessible(true);
field2.setAccessible(true);
try {
field.setAccessible(true);
obj = field.get(view);
} catch (IllegalAccessException unused4) {
}
if (obj == null) {
view.setOnClickListener(onClickListener);
} else {
field2.set(obj, onClickListener);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
}
}
public static final View.OnTouchListener getExistingOnTouchListener(View view) {
Field declaredField;
try {
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return null;
}
try {
try {
Field declaredField2 = Class.forName("android.view.View").getDeclaredField("mListenerInfo");
if (declaredField2 != null) {
declaredField2.setAccessible(true);
}
Object obj = declaredField2.get(view);
if (obj == null || (declaredField = Class.forName("android.view.View$ListenerInfo").getDeclaredField("mOnTouchListener")) == null) {
return null;
}
declaredField.setAccessible(true);
Object obj2 = declaredField.get(obj);
if (obj2 != null) {
return (View.OnTouchListener) obj2;
}
throw new NullPointerException("null cannot be cast to non-null type android.view.View.OnTouchListener");
} catch (NoSuchFieldException e) {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, e);
return null;
}
} catch (ClassNotFoundException e2) {
Utility utility2 = Utility.INSTANCE;
Utility.logd(TAG, e2);
return null;
} catch (IllegalAccessException e3) {
Utility utility3 = Utility.INSTANCE;
Utility.logd(TAG, e3);
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
return null;
}
}
private final View getTouchReactView(float[] fArr, View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
initTouchTargetHelperMethods();
Method method = methodFindTouchTargetView;
if (method != null && view != null) {
try {
if (method == null) {
throw new IllegalStateException("Required value was null.".toString());
}
Object invoke = method.invoke(null, fArr, view);
if (invoke == null) {
throw new NullPointerException("null cannot be cast to non-null type android.view.View");
}
View view2 = (View) invoke;
if (view2.getId() > 0) {
Object parent = view2.getParent();
if (parent != null) {
return (View) parent;
}
throw new NullPointerException("null cannot be cast to non-null type android.view.View");
}
} catch (IllegalAccessException e) {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, e);
} catch (InvocationTargetException e2) {
Utility utility2 = Utility.INSTANCE;
Utility.logd(TAG, e2);
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final boolean isRCTButton(View view, View view2) {
View touchReactView;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
if (!Intrinsics.areEqual(view.getClass().getName(), CLASS_RCTVIEWGROUP) || (touchReactView = getTouchReactView(getViewLocationOnScreen(view), view2)) == null) {
return false;
}
return touchReactView.getId() == view.getId();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean isRCTRootView(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return Intrinsics.areEqual(view.getClass().getName(), CLASS_RCTROOTVIEW);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final View findRCTRootView(View view) {
if (CrashShieldHandler.isObjectCrashing(ViewHierarchy.class)) {
return null;
}
while (view != null) {
try {
if (!INSTANCE.isRCTRootView(view)) {
Object parent = view.getParent();
if (!(parent instanceof View)) {
break;
}
view = (View) parent;
} else {
return view;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewHierarchy.class);
}
}
return null;
}
private final float[] getViewLocationOnScreen(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
view.getLocationOnScreen(new int[2]);
return new float[]{r2[0], r2[1]};
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final void initTouchTargetHelperMethods() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (methodFindTouchTargetView != null) {
return;
}
try {
Method declaredMethod = Class.forName(CLASS_TOUCHTARGETHELPER).getDeclaredMethod(METHOD_FIND_TOUCHTARGET_VIEW, float[].class, ViewGroup.class);
methodFindTouchTargetView = declaredMethod;
if (declaredMethod == null) {
throw new IllegalStateException("Required value was null.".toString());
}
declaredMethod.setAccessible(true);
} catch (ClassNotFoundException e) {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, e);
} catch (NoSuchMethodException e2) {
Utility utility2 = Utility.INSTANCE;
Utility.logd(TAG, e2);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final Class<?> getExistingClass(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return Class.forName(str);
} catch (ClassNotFoundException unused) {
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,158 @@
package com.facebook.appevents.eventdeactivation;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEvent;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class EventDeactivationManager {
private static boolean enabled;
public static final EventDeactivationManager INSTANCE = new EventDeactivationManager();
private static final List<DeprecatedParamFilter> deprecatedParamFilters = new ArrayList();
private static final Set<String> deprecatedEvents = new HashSet();
private EventDeactivationManager() {
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(EventDeactivationManager.class)) {
return;
}
try {
enabled = true;
INSTANCE.initialize();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, EventDeactivationManager.class);
}
}
private final synchronized void initialize() {
FetchedAppSettings queryAppSettings;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
} catch (Exception unused) {
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return;
}
if (queryAppSettings == null) {
return;
}
String restrictiveDataSetting = queryAppSettings.getRestrictiveDataSetting();
if (restrictiveDataSetting != null && restrictiveDataSetting.length() > 0) {
JSONObject jSONObject = new JSONObject(restrictiveDataSetting);
deprecatedParamFilters.clear();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String key = keys.next();
JSONObject jSONObject2 = jSONObject.getJSONObject(key);
if (jSONObject2 != null) {
if (jSONObject2.optBoolean("is_deprecated_event")) {
Set<String> set = deprecatedEvents;
Intrinsics.checkNotNullExpressionValue(key, "key");
set.add(key);
} else {
JSONArray optJSONArray = jSONObject2.optJSONArray("deprecated_param");
Intrinsics.checkNotNullExpressionValue(key, "key");
DeprecatedParamFilter deprecatedParamFilter = new DeprecatedParamFilter(key, new ArrayList());
if (optJSONArray != null) {
deprecatedParamFilter.setDeprecateParams(Utility.convertJSONArrayToList(optJSONArray));
}
deprecatedParamFilters.add(deprecatedParamFilter);
}
}
}
}
}
public static final void processEvents(List<AppEvent> events) {
if (CrashShieldHandler.isObjectCrashing(EventDeactivationManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(events, "events");
if (enabled) {
Iterator<AppEvent> it = events.iterator();
while (it.hasNext()) {
if (deprecatedEvents.contains(it.next().getName())) {
it.remove();
}
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, EventDeactivationManager.class);
}
}
public static final void processDeprecatedParameters(Map<String, String> parameters, String eventName) {
if (CrashShieldHandler.isObjectCrashing(EventDeactivationManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(parameters, "parameters");
Intrinsics.checkNotNullParameter(eventName, "eventName");
if (enabled) {
ArrayList<String> arrayList = new ArrayList(parameters.keySet());
for (DeprecatedParamFilter deprecatedParamFilter : new ArrayList(deprecatedParamFilters)) {
if (Intrinsics.areEqual(deprecatedParamFilter.getEventName(), eventName)) {
for (String str : arrayList) {
if (deprecatedParamFilter.getDeprecateParams().contains(str)) {
parameters.remove(str);
}
}
}
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, EventDeactivationManager.class);
}
}
public static final class DeprecatedParamFilter {
private List<String> deprecateParams;
private String eventName;
public final List<String> getDeprecateParams() {
return this.deprecateParams;
}
public final String getEventName() {
return this.eventName;
}
public final void setDeprecateParams(List<String> list) {
Intrinsics.checkNotNullParameter(list, "<set-?>");
this.deprecateParams = list;
}
public final void setEventName(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.eventName = str;
}
public DeprecatedParamFilter(String eventName, List<String> deprecateParams) {
Intrinsics.checkNotNullParameter(eventName, "eventName");
Intrinsics.checkNotNullParameter(deprecateParams, "deprecateParams");
this.eventName = eventName;
this.deprecateParams = deprecateParams;
}
}
}

View File

@@ -0,0 +1,101 @@
package com.facebook.appevents.iap;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import com.facebook.FacebookSdk;
import java.util.ArrayList;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2 implements Application.ActivityLifecycleCallbacks {
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(outState, "outState");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
try {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2.m496onActivityResumed$lambda0();
}
});
} catch (Exception unused) {
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityResumed$lambda-0, reason: not valid java name */
public static final void m496onActivityResumed$lambda0() {
Object obj;
Object obj2;
Context applicationContext = FacebookSdk.getApplicationContext();
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
obj = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
ArrayList<String> purchasesInapp = InAppPurchaseEventManager.getPurchasesInapp(applicationContext, obj);
InAppPurchaseActivityLifecycleTracker inAppPurchaseActivityLifecycleTracker = InAppPurchaseActivityLifecycleTracker.INSTANCE;
inAppPurchaseActivityLifecycleTracker.logPurchase(applicationContext, purchasesInapp, false);
obj2 = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
inAppPurchaseActivityLifecycleTracker.logPurchase(applicationContext, InAppPurchaseEventManager.getPurchasesSubs(applicationContext, obj2), true);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
Boolean bool;
Intrinsics.checkNotNullParameter(activity, "activity");
try {
bool = InAppPurchaseActivityLifecycleTracker.hasBillingActivity;
if (Intrinsics.areEqual(bool, Boolean.TRUE) && Intrinsics.areEqual(activity.getLocalClassName(), "com.android.billingclient.api.ProxyBillingActivity")) {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2.m497onActivityStopped$lambda1();
}
});
}
} catch (Exception unused) {
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityStopped$lambda-1, reason: not valid java name */
public static final void m497onActivityStopped$lambda1() {
Object obj;
Object obj2;
Context applicationContext = FacebookSdk.getApplicationContext();
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
obj = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
ArrayList<String> purchasesInapp = InAppPurchaseEventManager.getPurchasesInapp(applicationContext, obj);
if (purchasesInapp.isEmpty()) {
obj2 = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
purchasesInapp = InAppPurchaseEventManager.getPurchaseHistoryInapp(applicationContext, obj2);
}
InAppPurchaseActivityLifecycleTracker.INSTANCE.logPurchase(applicationContext, purchasesInapp, false);
}
}

View File

@@ -0,0 +1,137 @@
package com.facebook.appevents.iap;
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;
import com.facebook.FacebookSdk;
import com.facebook.appevents.internal.AutomaticAnalyticsLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class InAppPurchaseActivityLifecycleTracker {
private static final String BILLING_ACTIVITY_NAME = "com.android.billingclient.api.ProxyBillingActivity";
private static final String SERVICE_INTERFACE_NAME = "com.android.vending.billing.IInAppBillingService$Stub";
private static Application.ActivityLifecycleCallbacks callbacks;
private static Boolean hasBillingActivity;
private static Boolean hasBillingService;
private static Object inAppBillingObj;
private static Intent intent;
private static ServiceConnection serviceConnection;
public static final InAppPurchaseActivityLifecycleTracker INSTANCE = new InAppPurchaseActivityLifecycleTracker();
private static final String TAG = InAppPurchaseActivityLifecycleTracker.class.getCanonicalName();
private static final AtomicBoolean isTracking = new AtomicBoolean(false);
private InAppPurchaseActivityLifecycleTracker() {
}
public static final void startIapLogging() {
InAppPurchaseActivityLifecycleTracker inAppPurchaseActivityLifecycleTracker = INSTANCE;
inAppPurchaseActivityLifecycleTracker.initializeIfNotInitialized();
if (!Intrinsics.areEqual(hasBillingService, Boolean.FALSE) && AutomaticAnalyticsLogger.isImplicitPurchaseLoggingEnabled()) {
inAppPurchaseActivityLifecycleTracker.startTracking();
}
}
private final void initializeIfNotInitialized() {
if (hasBillingService != null) {
return;
}
Boolean valueOf = Boolean.valueOf(InAppPurchaseUtils.getClass(SERVICE_INTERFACE_NAME) != null);
hasBillingService = valueOf;
if (Intrinsics.areEqual(valueOf, Boolean.FALSE)) {
return;
}
hasBillingActivity = Boolean.valueOf(InAppPurchaseUtils.getClass(BILLING_ACTIVITY_NAME) != null);
InAppPurchaseEventManager.clearSkuDetailsCache();
Intent intent2 = new Intent("com.android.vending.billing.InAppBillingService.BIND").setPackage("com.android.vending");
Intrinsics.checkNotNullExpressionValue(intent2, "Intent(\"com.android.vending.billing.InAppBillingService.BIND\")\n .setPackage(\"com.android.vending\")");
intent = intent2;
serviceConnection = new ServiceConnection() { // from class: com.facebook.appevents.iap.InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$1
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName name) {
Intrinsics.checkNotNullParameter(name, "name");
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName name, IBinder service) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(service, "service");
InAppPurchaseActivityLifecycleTracker inAppPurchaseActivityLifecycleTracker = InAppPurchaseActivityLifecycleTracker.INSTANCE;
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
InAppPurchaseActivityLifecycleTracker.inAppBillingObj = InAppPurchaseEventManager.asInterface(FacebookSdk.getApplicationContext(), service);
}
};
callbacks = new InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2();
}
private final void startTracking() {
if (isTracking.compareAndSet(false, true)) {
Context applicationContext = FacebookSdk.getApplicationContext();
if (applicationContext instanceof Application) {
Application application = (Application) applicationContext;
Application.ActivityLifecycleCallbacks activityLifecycleCallbacks = callbacks;
if (activityLifecycleCallbacks == null) {
Intrinsics.throwUninitializedPropertyAccessException("callbacks");
throw null;
}
application.registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
Intent intent2 = intent;
if (intent2 == null) {
Intrinsics.throwUninitializedPropertyAccessException(SDKConstants.PARAM_INTENT);
throw null;
}
ServiceConnection serviceConnection2 = serviceConnection;
if (serviceConnection2 != null) {
applicationContext.bindService(intent2, serviceConnection2, 1);
} else {
Intrinsics.throwUninitializedPropertyAccessException("serviceConnection");
throw null;
}
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void logPurchase(Context context, ArrayList<String> arrayList, boolean z) {
if (arrayList.isEmpty()) {
return;
}
HashMap hashMap = new HashMap();
ArrayList arrayList2 = new ArrayList();
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
String purchase = it.next();
try {
String sku = new JSONObject(purchase).getString(InAppPurchaseMetaData.KEY_PRODUCT_ID);
Intrinsics.checkNotNullExpressionValue(sku, "sku");
Intrinsics.checkNotNullExpressionValue(purchase, "purchase");
hashMap.put(sku, purchase);
arrayList2.add(sku);
} catch (JSONException e) {
Log.e(TAG, "Error parsing in-app purchase data.", e);
}
}
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
for (Map.Entry<String, String> entry : InAppPurchaseEventManager.getSkuDetails(context, arrayList2, inAppBillingObj, z).entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
String str = (String) hashMap.get(key);
if (str != null) {
AutomaticAnalyticsLogger.logPurchase(str, value, z);
}
}
}
}

View File

@@ -0,0 +1,88 @@
package com.facebook.appevents.iap;
import android.content.Context;
import androidx.annotation.RestrictTo;
import com.facebook.appevents.iap.InAppPurchaseBillingClientWrapper;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseAutoLogger {
private static final String BILLING_CLIENT_PURCHASE_NAME = "com.android.billingclient.api.Purchase";
public static final InAppPurchaseAutoLogger INSTANCE = new InAppPurchaseAutoLogger();
private InAppPurchaseAutoLogger() {
}
public static final void startIapLogging(Context context) {
InAppPurchaseBillingClientWrapper.Companion companion;
InAppPurchaseBillingClientWrapper orCreateInstance;
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseAutoLogger.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
if (InAppPurchaseUtils.getClass(BILLING_CLIENT_PURCHASE_NAME) == null || (orCreateInstance = (companion = InAppPurchaseBillingClientWrapper.Companion).getOrCreateInstance(context)) == null || !companion.isServiceConnected().get()) {
return;
}
if (InAppPurchaseLoggerManager.eligibleQueryPurchaseHistory()) {
orCreateInstance.queryPurchaseHistory("inapp", new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseAutoLogger$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseAutoLogger.m500startIapLogging$lambda0();
}
});
} else {
orCreateInstance.queryPurchase("inapp", new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseAutoLogger$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseAutoLogger.m501startIapLogging$lambda1();
}
});
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseAutoLogger.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: startIapLogging$lambda-0, reason: not valid java name */
public static final void m500startIapLogging$lambda0() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseAutoLogger.class)) {
return;
}
try {
INSTANCE.logPurchase();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseAutoLogger.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: startIapLogging$lambda-1, reason: not valid java name */
public static final void m501startIapLogging$lambda1() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseAutoLogger.class)) {
return;
}
try {
INSTANCE.logPurchase();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseAutoLogger.class);
}
}
private final void logPurchase() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
InAppPurchaseLoggerManager inAppPurchaseLoggerManager = InAppPurchaseLoggerManager.INSTANCE;
InAppPurchaseBillingClientWrapper.Companion companion = InAppPurchaseBillingClientWrapper.Companion;
InAppPurchaseLoggerManager.filterPurchaseLogging(companion.getPurchaseDetailsMap(), companion.getSkuDetailsMap());
companion.getPurchaseDetailsMap().clear();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
}

View File

@@ -0,0 +1,683 @@
package com.facebook.appevents.iap;
import android.content.Context;
import androidx.annotation.RestrictTo;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseBillingClientWrapper {
private static final String CLASSNAME_BILLING_CLIENT = "com.android.billingclient.api.BillingClient";
private static final String CLASSNAME_BILLING_CLIENT_BUILDER = "com.android.billingclient.api.BillingClient$Builder";
private static final String CLASSNAME_BILLING_CLIENT_STATE_LISTENER = "com.android.billingclient.api.BillingClientStateListener";
private static final String CLASSNAME_PURCHASE = "com.android.billingclient.api.Purchase";
private static final String CLASSNAME_PURCHASES_RESULT = "com.android.billingclient.api.Purchase$PurchasesResult";
private static final String CLASSNAME_PURCHASE_HISTORY_RECORD = "com.android.billingclient.api.PurchaseHistoryRecord";
private static final String CLASSNAME_PURCHASE_HISTORY_RESPONSE_LISTENER = "com.android.billingclient.api.PurchaseHistoryResponseListener";
private static final String CLASSNAME_PURCHASE_UPDATED_LISTENER = "com.android.billingclient.api.PurchasesUpdatedListener";
private static final String CLASSNAME_SKU_DETAILS = "com.android.billingclient.api.SkuDetails";
private static final String CLASSNAME_SKU_DETAILS_RESPONSE_LISTENER = "com.android.billingclient.api.SkuDetailsResponseListener";
private static final String IN_APP = "inapp";
private static final String METHOD_BUILD = "build";
private static final String METHOD_ENABLE_PENDING_PURCHASES = "enablePendingPurchases";
private static final String METHOD_GET_ORIGINAL_JSON = "getOriginalJson";
private static final String METHOD_GET_PURCHASE_LIST = "getPurchasesList";
private static final String METHOD_NEW_BUILDER = "newBuilder";
private static final String METHOD_ON_BILLING_SERVICE_DISCONNECTED = "onBillingServiceDisconnected";
private static final String METHOD_ON_BILLING_SETUP_FINISHED = "onBillingSetupFinished";
private static final String METHOD_ON_PURCHASE_HISTORY_RESPONSE = "onPurchaseHistoryResponse";
private static final String METHOD_ON_SKU_DETAILS_RESPONSE = "onSkuDetailsResponse";
private static final String METHOD_QUERY_PURCHASES = "queryPurchases";
private static final String METHOD_QUERY_PURCHASE_HISTORY_ASYNC = "queryPurchaseHistoryAsync";
private static final String METHOD_QUERY_SKU_DETAILS_ASYNC = "querySkuDetailsAsync";
private static final String METHOD_SET_LISTENER = "setListener";
private static final String METHOD_START_CONNECTION = "startConnection";
private static final String PACKAGE_NAME = "packageName";
private static final String PRODUCT_ID = "productId";
private static InAppPurchaseBillingClientWrapper instance;
private final Object billingClient;
private final Class<?> billingClientClazz;
private final Context context;
private final Method getOriginalJsonMethod;
private final Method getOriginalJsonPurchaseHistoryMethod;
private final Method getOriginalJsonSkuMethod;
private final Method getPurchaseListMethod;
private final Set<String> historyPurchaseSet;
private final InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper;
private final Class<?> purchaseClazz;
private final Class<?> purchaseHistoryRecordClazz;
private final Class<?> purchaseHistoryResponseListenerClazz;
private final Class<?> purchaseResultClazz;
private final Method queryPurchaseHistoryAsyncMethod;
private final Method queryPurchasesMethod;
private final Method querySkuDetailsAsyncMethod;
private final Class<?> skuDetailsClazz;
private final Class<?> skuDetailsResponseListenerClazz;
public static final Companion Companion = new Companion(null);
private static final AtomicBoolean initialized = new AtomicBoolean(false);
private static final AtomicBoolean isServiceConnected = new AtomicBoolean(false);
private static final Map<String, JSONObject> purchaseDetailsMap = new ConcurrentHashMap();
private static final Map<String, JSONObject> skuDetailsMap = new ConcurrentHashMap();
public /* synthetic */ InAppPurchaseBillingClientWrapper(Context context, Object obj, Class cls, Class cls2, Class cls3, Class cls4, Class cls5, Class cls6, Class cls7, Method method, Method method2, Method method3, Method method4, Method method5, Method method6, Method method7, InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper, DefaultConstructorMarker defaultConstructorMarker) {
this(context, obj, cls, cls2, cls3, cls4, cls5, cls6, cls7, method, method2, method3, method4, method5, method6, method7, inAppPurchaseSkuDetailsWrapper);
}
public static final synchronized InAppPurchaseBillingClientWrapper getOrCreateInstance(Context context) {
synchronized (InAppPurchaseBillingClientWrapper.class) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return Companion.getOrCreateInstance(context);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
}
private InAppPurchaseBillingClientWrapper(Context context, Object obj, Class<?> cls, Class<?> cls2, Class<?> cls3, Class<?> cls4, Class<?> cls5, Class<?> cls6, Class<?> cls7, Method method, Method method2, Method method3, Method method4, Method method5, Method method6, Method method7, InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper) {
this.context = context;
this.billingClient = obj;
this.billingClientClazz = cls;
this.purchaseResultClazz = cls2;
this.purchaseClazz = cls3;
this.skuDetailsClazz = cls4;
this.purchaseHistoryRecordClazz = cls5;
this.skuDetailsResponseListenerClazz = cls6;
this.purchaseHistoryResponseListenerClazz = cls7;
this.queryPurchasesMethod = method;
this.getPurchaseListMethod = method2;
this.getOriginalJsonMethod = method3;
this.getOriginalJsonSkuMethod = method4;
this.getOriginalJsonPurchaseHistoryMethod = method5;
this.querySkuDetailsAsyncMethod = method6;
this.queryPurchaseHistoryAsyncMethod = method7;
this.inAppPurchaseSkuDetailsWrapper = inAppPurchaseSkuDetailsWrapper;
this.historyPurchaseSet = new CopyOnWriteArraySet();
}
public static final /* synthetic */ Context access$getContext$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.context;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Method access$getGetOriginalJsonPurchaseHistoryMethod$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.getOriginalJsonPurchaseHistoryMethod;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Method access$getGetOriginalJsonSkuMethod$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.getOriginalJsonSkuMethod;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Set access$getHistoryPurchaseSet$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.historyPurchaseSet;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ AtomicBoolean access$getInitialized$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return initialized;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ InAppPurchaseBillingClientWrapper access$getInstance$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return instance;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Map access$getPurchaseDetailsMap$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return purchaseDetailsMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Class access$getPurchaseHistoryRecordClazz$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.purchaseHistoryRecordClazz;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Class access$getSkuDetailsClazz$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.skuDetailsClazz;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Map access$getSkuDetailsMap$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return skuDetailsMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ AtomicBoolean access$isServiceConnected$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return isServiceConnected;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ void access$setInstance$cp(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return;
}
try {
instance = inAppPurchaseBillingClientWrapper;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
}
}
public static final /* synthetic */ void access$startConnection(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return;
}
try {
inAppPurchaseBillingClientWrapper.startConnection();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
}
}
public final void queryPurchaseHistory(String skuType, final Runnable queryPurchaseHistoryRunnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(skuType, "skuType");
Intrinsics.checkNotNullParameter(queryPurchaseHistoryRunnable, "queryPurchaseHistoryRunnable");
queryPurchaseHistoryAsync(skuType, new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseBillingClientWrapper$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseBillingClientWrapper.m503queryPurchaseHistory$lambda0(InAppPurchaseBillingClientWrapper.this, queryPurchaseHistoryRunnable);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: queryPurchaseHistory$lambda-0, reason: not valid java name */
public static final void m503queryPurchaseHistory$lambda0(InAppPurchaseBillingClientWrapper this$0, Runnable queryPurchaseHistoryRunnable) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(queryPurchaseHistoryRunnable, "$queryPurchaseHistoryRunnable");
this$0.querySkuDetailsAsync("inapp", new ArrayList(this$0.historyPurchaseSet), queryPurchaseHistoryRunnable);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
}
}
public final void queryPurchase(String skuType, Runnable querySkuRunnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(skuType, "skuType");
Intrinsics.checkNotNullParameter(querySkuRunnable, "querySkuRunnable");
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod = InAppPurchaseUtils.invokeMethod(this.purchaseResultClazz, this.getPurchaseListMethod, InAppPurchaseUtils.invokeMethod(this.billingClientClazz, this.queryPurchasesMethod, this.billingClient, "inapp"), new Object[0]);
List list = invokeMethod instanceof List ? (List) invokeMethod : null;
if (list == null) {
return;
}
try {
ArrayList arrayList = new ArrayList();
for (Object obj : list) {
InAppPurchaseUtils inAppPurchaseUtils2 = InAppPurchaseUtils.INSTANCE;
Object invokeMethod2 = InAppPurchaseUtils.invokeMethod(this.purchaseClazz, this.getOriginalJsonMethod, obj, new Object[0]);
String str = invokeMethod2 instanceof String ? (String) invokeMethod2 : null;
if (str != null) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("productId")) {
String skuID = jSONObject.getString("productId");
arrayList.add(skuID);
Map<String, JSONObject> map = purchaseDetailsMap;
Intrinsics.checkNotNullExpressionValue(skuID, "skuID");
map.put(skuID, jSONObject);
}
}
}
querySkuDetailsAsync(skuType, arrayList, querySkuRunnable);
} catch (JSONException unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void querySkuDetailsAsync(String str, List<String> list, Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Object newProxyInstance = Proxy.newProxyInstance(this.skuDetailsResponseListenerClazz.getClassLoader(), new Class[]{this.skuDetailsResponseListenerClazz}, new SkuDetailsResponseListenerWrapper(this, runnable));
Object skuDetailsParams = this.inAppPurchaseSkuDetailsWrapper.getSkuDetailsParams(str, list);
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
InAppPurchaseUtils.invokeMethod(this.billingClientClazz, this.querySkuDetailsAsyncMethod, this.billingClient, skuDetailsParams, newProxyInstance);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void queryPurchaseHistoryAsync(String str, Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Object newProxyInstance = Proxy.newProxyInstance(this.purchaseHistoryResponseListenerClazz.getClassLoader(), new Class[]{this.purchaseHistoryResponseListenerClazz}, new PurchaseHistoryResponseListenerWrapper(this, runnable));
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
InAppPurchaseUtils.invokeMethod(this.billingClientClazz, this.queryPurchaseHistoryAsyncMethod, this.billingClient, str, newProxyInstance);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void startConnection() {
Method method;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Class<?> cls = InAppPurchaseUtils.getClass(CLASSNAME_BILLING_CLIENT_STATE_LISTENER);
if (cls == null || (method = InAppPurchaseUtils.getMethod(this.billingClientClazz, METHOD_START_CONNECTION, cls)) == null) {
return;
}
InAppPurchaseUtils.invokeMethod(this.billingClientClazz, method, this.billingClient, Proxy.newProxyInstance(cls.getClassLoader(), new Class[]{cls}, new BillingClientStateListenerWrapper()));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class BillingClientStateListenerWrapper implements InvocationHandler {
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method m, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(m, "m");
if (Intrinsics.areEqual(m.getName(), InAppPurchaseBillingClientWrapper.METHOD_ON_BILLING_SETUP_FINISHED)) {
InAppPurchaseBillingClientWrapper.Companion.isServiceConnected().set(true);
} else {
String name = m.getName();
Intrinsics.checkNotNullExpressionValue(name, "m.name");
if (StringsKt__StringsJVMKt.endsWith$default(name, InAppPurchaseBillingClientWrapper.METHOD_ON_BILLING_SERVICE_DISCONNECTED, false, 2, null)) {
InAppPurchaseBillingClientWrapper.Companion.isServiceConnected().set(false);
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}
public static final class PurchasesUpdatedListenerWrapper implements InvocationHandler {
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method m, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(m, "m");
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}
public final class PurchaseHistoryResponseListenerWrapper implements InvocationHandler {
private Runnable runnable;
final /* synthetic */ InAppPurchaseBillingClientWrapper this$0;
public PurchaseHistoryResponseListenerWrapper(InAppPurchaseBillingClientWrapper this$0, Runnable runnable) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(runnable, "runnable");
this.this$0 = this$0;
this.runnable = runnable;
}
public final Runnable getRunnable() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setRunnable(Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(runnable, "<set-?>");
this.runnable = runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method method, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(method, "method");
if (Intrinsics.areEqual(method.getName(), InAppPurchaseBillingClientWrapper.METHOD_ON_PURCHASE_HISTORY_RESPONSE)) {
Object obj = objArr == null ? null : objArr[1];
if (obj != null && (obj instanceof List)) {
getPurchaseHistoryRecord((List) obj);
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final void getPurchaseHistoryRecord(List<?> list) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
for (Object obj : list) {
try {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod = InAppPurchaseUtils.invokeMethod(InAppPurchaseBillingClientWrapper.access$getPurchaseHistoryRecordClazz$p(this.this$0), InAppPurchaseBillingClientWrapper.access$getGetOriginalJsonPurchaseHistoryMethod$p(this.this$0), obj, new Object[0]);
String str = invokeMethod instanceof String ? (String) invokeMethod : null;
if (str != null) {
JSONObject jSONObject = new JSONObject(str);
jSONObject.put("packageName", InAppPurchaseBillingClientWrapper.access$getContext$p(this.this$0).getPackageName());
if (jSONObject.has("productId")) {
String skuID = jSONObject.getString("productId");
InAppPurchaseBillingClientWrapper.access$getHistoryPurchaseSet$p(this.this$0).add(skuID);
Map<String, JSONObject> purchaseDetailsMap = InAppPurchaseBillingClientWrapper.Companion.getPurchaseDetailsMap();
Intrinsics.checkNotNullExpressionValue(skuID, "skuID");
purchaseDetailsMap.put(skuID, jSONObject);
}
}
} catch (Exception unused) {
}
}
this.runnable.run();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
}
public final class SkuDetailsResponseListenerWrapper implements InvocationHandler {
private Runnable runnable;
final /* synthetic */ InAppPurchaseBillingClientWrapper this$0;
public SkuDetailsResponseListenerWrapper(InAppPurchaseBillingClientWrapper this$0, Runnable runnable) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(runnable, "runnable");
this.this$0 = this$0;
this.runnable = runnable;
}
public final Runnable getRunnable() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setRunnable(Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(runnable, "<set-?>");
this.runnable = runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method m, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(m, "m");
if (Intrinsics.areEqual(m.getName(), InAppPurchaseBillingClientWrapper.METHOD_ON_SKU_DETAILS_RESPONSE)) {
Object obj = objArr == null ? null : objArr[1];
if (obj != null && (obj instanceof List)) {
parseSkuDetails((List) obj);
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void parseSkuDetails(List<?> skuDetailsObjectList) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(skuDetailsObjectList, "skuDetailsObjectList");
for (Object obj : skuDetailsObjectList) {
try {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod = InAppPurchaseUtils.invokeMethod(InAppPurchaseBillingClientWrapper.access$getSkuDetailsClazz$p(this.this$0), InAppPurchaseBillingClientWrapper.access$getGetOriginalJsonSkuMethod$p(this.this$0), obj, new Object[0]);
String str = invokeMethod instanceof String ? (String) invokeMethod : null;
if (str != null) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("productId")) {
String skuID = jSONObject.getString("productId");
Map<String, JSONObject> skuDetailsMap = InAppPurchaseBillingClientWrapper.Companion.getSkuDetailsMap();
Intrinsics.checkNotNullExpressionValue(skuID, "skuID");
skuDetailsMap.put(skuID, jSONObject);
}
}
} catch (Exception unused) {
}
}
this.runnable.run();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final AtomicBoolean isServiceConnected() {
return InAppPurchaseBillingClientWrapper.access$isServiceConnected$cp();
}
public final Map<String, JSONObject> getPurchaseDetailsMap() {
return InAppPurchaseBillingClientWrapper.access$getPurchaseDetailsMap$cp();
}
public final Map<String, JSONObject> getSkuDetailsMap() {
return InAppPurchaseBillingClientWrapper.access$getSkuDetailsMap$cp();
}
public final synchronized InAppPurchaseBillingClientWrapper getOrCreateInstance(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
if (InAppPurchaseBillingClientWrapper.access$getInitialized$cp().get()) {
return InAppPurchaseBillingClientWrapper.access$getInstance$cp();
}
createInstance(context);
InAppPurchaseBillingClientWrapper.access$getInitialized$cp().set(true);
return InAppPurchaseBillingClientWrapper.access$getInstance$cp();
}
private final void createInstance(Context context) {
Object createBillingClient;
InAppPurchaseSkuDetailsWrapper orCreateInstance = InAppPurchaseSkuDetailsWrapper.Companion.getOrCreateInstance();
if (orCreateInstance == null) {
return;
}
Class<?> cls = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_BILLING_CLIENT);
Class<?> cls2 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE);
Class<?> cls3 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASES_RESULT);
Class<?> cls4 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_SKU_DETAILS);
Class<?> cls5 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE_HISTORY_RECORD);
Class<?> cls6 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_SKU_DETAILS_RESPONSE_LISTENER);
Class<?> cls7 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE_HISTORY_RESPONSE_LISTENER);
if (cls == null || cls3 == null || cls2 == null || cls4 == null || cls6 == null || cls5 == null || cls7 == null) {
return;
}
Method method = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_QUERY_PURCHASES, String.class);
Method method2 = InAppPurchaseUtils.getMethod(cls3, InAppPurchaseBillingClientWrapper.METHOD_GET_PURCHASE_LIST, new Class[0]);
Method method3 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_GET_ORIGINAL_JSON, new Class[0]);
Method method4 = InAppPurchaseUtils.getMethod(cls4, InAppPurchaseBillingClientWrapper.METHOD_GET_ORIGINAL_JSON, new Class[0]);
Method method5 = InAppPurchaseUtils.getMethod(cls5, InAppPurchaseBillingClientWrapper.METHOD_GET_ORIGINAL_JSON, new Class[0]);
Method method6 = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_QUERY_SKU_DETAILS_ASYNC, orCreateInstance.getSkuDetailsParamsClazz(), cls6);
Method method7 = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_QUERY_PURCHASE_HISTORY_ASYNC, String.class, cls7);
if (method == null || method2 == null || method3 == null || method4 == null || method5 == null || method6 == null || method7 == null || (createBillingClient = createBillingClient(context, cls)) == null) {
return;
}
InAppPurchaseBillingClientWrapper.access$setInstance$cp(new InAppPurchaseBillingClientWrapper(context, createBillingClient, cls, cls3, cls2, cls4, cls5, cls6, cls7, method, method2, method3, method4, method5, method6, method7, orCreateInstance, null));
InAppPurchaseBillingClientWrapper access$getInstance$cp = InAppPurchaseBillingClientWrapper.access$getInstance$cp();
if (access$getInstance$cp == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.appevents.iap.InAppPurchaseBillingClientWrapper");
}
InAppPurchaseBillingClientWrapper.access$startConnection(access$getInstance$cp);
}
private final Object createBillingClient(Context context, Class<?> cls) {
Object invokeMethod;
Object invokeMethod2;
Object invokeMethod3;
Class<?> cls2 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_BILLING_CLIENT_BUILDER);
Class<?> cls3 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE_UPDATED_LISTENER);
if (cls2 == null || cls3 == null) {
return null;
}
Method method = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_NEW_BUILDER, Context.class);
Method method2 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_ENABLE_PENDING_PURCHASES, new Class[0]);
Method method3 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_SET_LISTENER, cls3);
Method method4 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_BUILD, new Class[0]);
if (method == null || method2 == null || method3 == null || method4 == null || (invokeMethod = InAppPurchaseUtils.invokeMethod(cls, method, null, context)) == null || (invokeMethod2 = InAppPurchaseUtils.invokeMethod(cls2, method3, invokeMethod, Proxy.newProxyInstance(cls3.getClassLoader(), new Class[]{cls3}, new PurchasesUpdatedListenerWrapper()))) == null || (invokeMethod3 = InAppPurchaseUtils.invokeMethod(cls2, method2, invokeMethod2, new Object[0])) == null) {
return null;
}
return InAppPurchaseUtils.invokeMethod(cls2, method4, invokeMethod3, new Object[0]);
}
}
}

View File

@@ -0,0 +1,559 @@
package com.facebook.appevents.iap;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.IBinder;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseEventManager {
private static final String AS_INTERFACE = "asInterface";
private static final int CACHE_CLEAR_TIME_LIMIT_SEC = 604800;
private static final String DETAILS_LIST = "DETAILS_LIST";
private static final String GET_PURCHASES = "getPurchases";
private static final String GET_PURCHASE_HISTORY = "getPurchaseHistory";
private static final String GET_SKU_DETAILS = "getSkuDetails";
private static final String INAPP = "inapp";
private static final String INAPP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN";
private static final String INAPP_PURCHASE_DATA_LIST = "INAPP_PURCHASE_DATA_LIST";
private static final String IN_APP_BILLING_SERVICE = "com.android.vending.billing.IInAppBillingService";
private static final String IN_APP_BILLING_SERVICE_STUB = "com.android.vending.billing.IInAppBillingService$Stub";
private static final String IS_BILLING_SUPPORTED = "isBillingSupported";
private static final String ITEM_ID_LIST = "ITEM_ID_LIST";
private static final String LAST_CLEARED_TIME = "LAST_CLEARED_TIME";
private static final int MAX_QUERY_PURCHASE_NUM = 30;
private static final int PURCHASE_EXPIRE_TIME_SEC = 86400;
private static final int PURCHASE_STOP_QUERY_TIME_SEC = 1200;
private static final String RESPONSE_CODE = "RESPONSE_CODE";
private static final int SKU_DETAIL_EXPIRE_TIME_SEC = 43200;
private static final String SUBSCRIPTION = "subs";
public static final InAppPurchaseEventManager INSTANCE = new InAppPurchaseEventManager();
private static final HashMap<String, Method> methodMap = new HashMap<>();
private static final HashMap<String, Class<?>> classMap = new HashMap<>();
private static final String PACKAGE_NAME = FacebookSdk.getApplicationContext().getPackageName();
private static final String SKU_DETAILS_STORE = "com.facebook.internal.SKU_DETAILS";
private static final SharedPreferences skuDetailSharedPrefs = FacebookSdk.getApplicationContext().getSharedPreferences(SKU_DETAILS_STORE, 0);
private static final String PURCHASE_INAPP_STORE = "com.facebook.internal.PURCHASE";
private static final SharedPreferences purchaseInappSharedPrefs = FacebookSdk.getApplicationContext().getSharedPreferences(PURCHASE_INAPP_STORE, 0);
private InAppPurchaseEventManager() {
}
public static final Object asInterface(Context context, IBinder iBinder) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
return INSTANCE.invokeMethod(context, IN_APP_BILLING_SERVICE_STUB, AS_INTERFACE, null, new Object[]{iBinder});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
public static final Map<String, String> getSkuDetails(Context context, ArrayList<String> skuList, Object obj, boolean z) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(skuList, "skuList");
Map<String, String> readSkuDetailsFromCache = INSTANCE.readSkuDetailsFromCache(skuList);
ArrayList<String> arrayList = new ArrayList<>();
Iterator<String> it = skuList.iterator();
while (it.hasNext()) {
String next = it.next();
if (!readSkuDetailsFromCache.containsKey(next)) {
arrayList.add(next);
}
}
readSkuDetailsFromCache.putAll(INSTANCE.getSkuDetailsFromGoogle(context, arrayList, obj, z));
return readSkuDetailsFromCache;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
private final Map<String, String> getSkuDetailsFromGoogle(Context context, ArrayList<String> arrayList, Object obj, boolean z) {
int size;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Map<String, String> linkedHashMap = new LinkedHashMap<>();
if (obj != null && !arrayList.isEmpty()) {
Bundle bundle = new Bundle();
bundle.putStringArrayList("ITEM_ID_LIST", arrayList);
Object[] objArr = new Object[4];
int i = 0;
objArr[0] = 3;
objArr[1] = PACKAGE_NAME;
objArr[2] = z ? "subs" : "inapp";
objArr[3] = bundle;
Object invokeMethod = invokeMethod(context, IN_APP_BILLING_SERVICE, GET_SKU_DETAILS, obj, objArr);
if (invokeMethod != null) {
Bundle bundle2 = (Bundle) invokeMethod;
if (bundle2.getInt("RESPONSE_CODE") == 0) {
ArrayList<String> stringArrayList = bundle2.getStringArrayList("DETAILS_LIST");
if (stringArrayList != null && arrayList.size() == stringArrayList.size() && arrayList.size() - 1 >= 0) {
while (true) {
int i2 = i + 1;
String str = arrayList.get(i);
Intrinsics.checkNotNullExpressionValue(str, "skuList[i]");
String str2 = stringArrayList.get(i);
Intrinsics.checkNotNullExpressionValue(str2, "skuDetailsList[i]");
linkedHashMap.put(str, str2);
if (i2 > size) {
break;
}
i = i2;
}
}
writeSkuDetailsToCache(linkedHashMap);
}
}
}
return linkedHashMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final Map<String, String> readSkuDetailsFromCache(ArrayList<String> arrayList) {
List split$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
LinkedHashMap linkedHashMap = new LinkedHashMap();
long currentTimeMillis = System.currentTimeMillis() / 1000;
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
String sku = it.next();
String string = skuDetailSharedPrefs.getString(sku, null);
if (string != null) {
split$default = StringsKt__StringsKt.split$default((CharSequence) string, new String[]{";"}, false, 2, 2, (Object) null);
if (currentTimeMillis - Long.parseLong((String) split$default.get(0)) < 43200) {
Intrinsics.checkNotNullExpressionValue(sku, "sku");
linkedHashMap.put(sku, split$default.get(1));
}
}
}
return linkedHashMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final void writeSkuDetailsToCache(Map<String, String> map) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences.Editor edit = skuDetailSharedPrefs.edit();
for (Map.Entry<String, String> entry : map.entrySet()) {
edit.putString(entry.getKey(), currentTimeMillis + ';' + entry.getValue());
}
edit.apply();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final boolean isBillingSupported(Context context, Object obj, String str) {
if (CrashShieldHandler.isObjectCrashing(this) || obj == null) {
return false;
}
try {
Object invokeMethod = invokeMethod(context, IN_APP_BILLING_SERVICE, IS_BILLING_SUPPORTED, obj, new Object[]{3, PACKAGE_NAME, str});
if (invokeMethod != null) {
return ((Integer) invokeMethod).intValue() == 0;
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final ArrayList<String> getPurchasesInapp(Context context, Object obj) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
InAppPurchaseEventManager inAppPurchaseEventManager = INSTANCE;
return inAppPurchaseEventManager.filterPurchases(inAppPurchaseEventManager.getPurchases(context, obj, "inapp"));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
public static final ArrayList<String> getPurchasesSubs(Context context, Object obj) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
InAppPurchaseEventManager inAppPurchaseEventManager = INSTANCE;
return inAppPurchaseEventManager.filterPurchases(inAppPurchaseEventManager.getPurchases(context, obj, "subs"));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
/* JADX WARN: Removed duplicated region for block: B:21:0x0062 A[ADDED_TO_REGION] */
/* JADX WARN: Removed duplicated region for block: B:24:0x0064 A[EDGE_INSN: B:24:0x0064->B:28:0x0064 BREAK A[LOOP:0: B:12:0x0019->B:23:?], SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final java.util.ArrayList<java.lang.String> getPurchases(android.content.Context r13, java.lang.Object r14, java.lang.String r15) {
/*
r12 = this;
boolean r0 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r12)
r1 = 0
if (r0 == 0) goto L8
return r1
L8:
java.util.ArrayList r0 = new java.util.ArrayList // Catch: java.lang.Throwable -> L5b
r0.<init>() // Catch: java.lang.Throwable -> L5b
if (r14 != 0) goto L10
return r0
L10:
boolean r2 = r12.isBillingSupported(r13, r14, r15) // Catch: java.lang.Throwable -> L5b
if (r2 == 0) goto L64
r2 = 0
r3 = r1
r4 = r2
L19:
r5 = 4
java.lang.Object[] r11 = new java.lang.Object[r5] // Catch: java.lang.Throwable -> L5b
r5 = 3
java.lang.Integer r6 = java.lang.Integer.valueOf(r5) // Catch: java.lang.Throwable -> L5b
r11[r2] = r6 // Catch: java.lang.Throwable -> L5b
java.lang.String r6 = com.facebook.appevents.iap.InAppPurchaseEventManager.PACKAGE_NAME // Catch: java.lang.Throwable -> L5b
r7 = 1
r11[r7] = r6 // Catch: java.lang.Throwable -> L5b
r6 = 2
r11[r6] = r15 // Catch: java.lang.Throwable -> L5b
r11[r5] = r3 // Catch: java.lang.Throwable -> L5b
java.lang.String r8 = "com.android.vending.billing.IInAppBillingService"
java.lang.String r9 = "getPurchases"
r6 = r12
r7 = r13
r10 = r14
java.lang.Object r3 = r6.invokeMethod(r7, r8, r9, r10, r11) // Catch: java.lang.Throwable -> L5b
if (r3 == 0) goto L5d
android.os.Bundle r3 = (android.os.Bundle) r3 // Catch: java.lang.Throwable -> L5b
java.lang.String r5 = "RESPONSE_CODE"
int r5 = r3.getInt(r5) // Catch: java.lang.Throwable -> L5b
if (r5 != 0) goto L5d
java.lang.String r5 = "INAPP_PURCHASE_DATA_LIST"
java.util.ArrayList r5 = r3.getStringArrayList(r5) // Catch: java.lang.Throwable -> L5b
if (r5 == 0) goto L64
int r6 = r5.size() // Catch: java.lang.Throwable -> L5b
int r4 = r4 + r6
r0.addAll(r5) // Catch: java.lang.Throwable -> L5b
java.lang.String r5 = "INAPP_CONTINUATION_TOKEN"
java.lang.String r3 = r3.getString(r5) // Catch: java.lang.Throwable -> L5b
goto L5e
L5b:
r13 = move-exception
goto L65
L5d:
r3 = r1
L5e:
r5 = 30
if (r4 >= r5) goto L64
if (r3 != 0) goto L19
L64:
return r0
L65:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r13, r12)
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.iap.InAppPurchaseEventManager.getPurchases(android.content.Context, java.lang.Object, java.lang.String):java.util.ArrayList");
}
public final boolean hasFreeTrialPeirod(String skuDetail) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(skuDetail, "skuDetail");
try {
String optString = new JSONObject(skuDetail).optString("freeTrialPeriod");
if (optString != null) {
return optString.length() > 0;
}
return false;
} catch (JSONException unused) {
return false;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final ArrayList<String> getPurchaseHistoryInapp(Context context, Object obj) {
InAppPurchaseEventManager inAppPurchaseEventManager;
Class<?> cls;
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
ArrayList<String> arrayList = new ArrayList<>();
return (obj == null || (cls = (inAppPurchaseEventManager = INSTANCE).getClass(context, IN_APP_BILLING_SERVICE)) == null || inAppPurchaseEventManager.getMethod(cls, GET_PURCHASE_HISTORY) == null) ? arrayList : inAppPurchaseEventManager.filterPurchases(inAppPurchaseEventManager.getPurchaseHistory(context, obj, "inapp"));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
private final ArrayList<String> getPurchaseHistory(Context context, Object obj, String str) {
ArrayList<String> stringArrayList;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ArrayList<String> arrayList = new ArrayList<>();
if (isBillingSupported(context, obj, str)) {
String str2 = null;
int i = 0;
boolean z = false;
do {
Object invokeMethod = invokeMethod(context, IN_APP_BILLING_SERVICE, GET_PURCHASE_HISTORY, obj, new Object[]{6, PACKAGE_NAME, str, str2, new Bundle()});
if (invokeMethod != null) {
long currentTimeMillis = System.currentTimeMillis() / 1000;
Bundle bundle = (Bundle) invokeMethod;
if (bundle.getInt("RESPONSE_CODE") == 0 && (stringArrayList = bundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST")) != null) {
Iterator<String> it = stringArrayList.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
String next = it.next();
if (currentTimeMillis - (new JSONObject(next).getLong("purchaseTime") / 1000) > 1200) {
z = true;
break;
}
arrayList.add(next);
i++;
}
str2 = bundle.getString("INAPP_CONTINUATION_TOKEN");
if (i < 30 || str2 == null) {
break;
break;
}
}
}
str2 = null;
if (i < 30) {
break;
}
} while (!z);
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final ArrayList<String> filterPurchases(ArrayList<String> arrayList) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ArrayList<String> arrayList2 = new ArrayList<>();
SharedPreferences.Editor edit = purchaseInappSharedPrefs.edit();
long currentTimeMillis = System.currentTimeMillis() / 1000;
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
String next = it.next();
try {
JSONObject jSONObject = new JSONObject(next);
String string = jSONObject.getString(InAppPurchaseMetaData.KEY_PRODUCT_ID);
long j = jSONObject.getLong("purchaseTime");
String string2 = jSONObject.getString(SDKConstants.PARAM_PURCHASE_TOKEN);
if (currentTimeMillis - (j / 1000) <= 86400 && !Intrinsics.areEqual(purchaseInappSharedPrefs.getString(string, ""), string2)) {
edit.putString(string, string2);
arrayList2.add(next);
}
} catch (JSONException unused) {
}
}
edit.apply();
return arrayList2;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
private final Method getMethod(Class<?> cls, String str) {
Class[] clsArr;
Method declaredMethod$facebook_core_release;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
HashMap<String, Method> hashMap = methodMap;
Method method = hashMap.get(str);
if (method != null) {
return method;
}
switch (str.hashCode()) {
case -1801122596:
if (str.equals(GET_PURCHASES)) {
Class TYPE = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE, "TYPE");
clsArr = new Class[]{TYPE, String.class, String.class, String.class};
break;
}
clsArr = null;
break;
case -1450694211:
if (!str.equals(IS_BILLING_SUPPORTED)) {
clsArr = null;
break;
} else {
Class TYPE2 = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE2, "TYPE");
clsArr = new Class[]{TYPE2, String.class, String.class};
break;
}
case -1123215065:
if (!str.equals(AS_INTERFACE)) {
clsArr = null;
break;
} else {
clsArr = new Class[]{IBinder.class};
break;
}
case -594356707:
if (!str.equals(GET_PURCHASE_HISTORY)) {
clsArr = null;
break;
} else {
Class TYPE3 = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE3, "TYPE");
clsArr = new Class[]{TYPE3, String.class, String.class, String.class, Bundle.class};
break;
}
case -573310373:
if (!str.equals(GET_SKU_DETAILS)) {
clsArr = null;
break;
} else {
Class TYPE4 = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE4, "TYPE");
clsArr = new Class[]{TYPE4, String.class, String.class, Bundle.class};
break;
}
default:
clsArr = null;
break;
}
if (clsArr == null) {
declaredMethod$facebook_core_release = InAppPurchaseUtils.getDeclaredMethod$facebook_core_release(cls, str, null);
} else {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
declaredMethod$facebook_core_release = InAppPurchaseUtils.getDeclaredMethod$facebook_core_release(cls, str, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
}
if (declaredMethod$facebook_core_release != null) {
hashMap.put(str, declaredMethod$facebook_core_release);
}
return declaredMethod$facebook_core_release;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final Class<?> getClass(Context context, String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
HashMap<String, Class<?>> hashMap = classMap;
Class<?> cls = hashMap.get(str);
if (cls != null) {
return cls;
}
Class<?> classFromContext$facebook_core_release = InAppPurchaseUtils.getClassFromContext$facebook_core_release(context, str);
if (classFromContext$facebook_core_release != null) {
hashMap.put(str, classFromContext$facebook_core_release);
}
return classFromContext$facebook_core_release;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final Object invokeMethod(Context context, String str, String str2, Object obj, Object[] objArr) {
Method method;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Class<?> cls = getClass(context, str);
if (cls == null || (method = getMethod(cls, str2)) == null) {
return null;
}
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
return InAppPurchaseUtils.invokeMethod(cls, method, obj, Arrays.copyOf(objArr, objArr.length));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final void clearSkuDetailsCache() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return;
}
try {
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences sharedPreferences = skuDetailSharedPrefs;
long j = sharedPreferences.getLong(LAST_CLEARED_TIME, 0L);
if (j == 0) {
sharedPreferences.edit().putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
} else if (currentTimeMillis - j > CACHE_CLEAR_TIME_LIMIT_SEC) {
sharedPreferences.edit().clear().putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
}
}
}

View File

@@ -0,0 +1,265 @@
package com.facebook.appevents.iap;
import android.content.SharedPreferences;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.appevents.internal.AutomaticAnalyticsLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseLoggerManager {
private static final int CACHE_CLEAR_TIME_LIMIT_SEC = 604800;
private static final String LAST_CLEARED_TIME = "LAST_CLEARED_TIME";
private static final String LAST_QUERY_PURCHASE_HISTORY_TIME = "LAST_QUERY_PURCHASE_HISTORY_TIME";
private static final String PRODUCT_DETAILS_STORE = "com.facebook.internal.iap.PRODUCT_DETAILS";
private static final String PURCHASE_DETAILS_SET = "PURCHASE_DETAILS_SET";
private static final int PURCHASE_IN_CACHE_INTERVAL = 86400;
private static final String PURCHASE_TIME = "purchaseTime";
private static SharedPreferences sharedPreferences;
public static final InAppPurchaseLoggerManager INSTANCE = new InAppPurchaseLoggerManager();
private static final Set<String> cachedPurchaseSet = new CopyOnWriteArraySet();
private static final Map<String, Long> cachedPurchaseMap = new ConcurrentHashMap();
private InAppPurchaseLoggerManager() {
}
/* JADX WARN: Multi-variable type inference failed */
private final void readPurchaseCache() {
List split$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
SharedPreferences sharedPreferences2 = FacebookSdk.getApplicationContext().getSharedPreferences("com.facebook.internal.SKU_DETAILS", 0);
SharedPreferences sharedPreferences3 = FacebookSdk.getApplicationContext().getSharedPreferences("com.facebook.internal.PURCHASE", 0);
if (sharedPreferences2.contains(LAST_CLEARED_TIME)) {
sharedPreferences2.edit().clear().apply();
sharedPreferences3.edit().clear().apply();
}
SharedPreferences sharedPreferences4 = FacebookSdk.getApplicationContext().getSharedPreferences(PRODUCT_DETAILS_STORE, 0);
Intrinsics.checkNotNullExpressionValue(sharedPreferences4, "getApplicationContext().getSharedPreferences(PRODUCT_DETAILS_STORE, Context.MODE_PRIVATE)");
sharedPreferences = sharedPreferences4;
Set<String> set = cachedPurchaseSet;
if (sharedPreferences4 != null) {
Set<String> stringSet = sharedPreferences4.getStringSet(PURCHASE_DETAILS_SET, new HashSet());
if (stringSet == null) {
stringSet = new HashSet<>();
}
set.addAll(stringSet);
Iterator<String> it = set.iterator();
while (it.hasNext()) {
split$default = StringsKt__StringsKt.split$default((CharSequence) it.next(), new String[]{";"}, false, 2, 2, (Object) null);
cachedPurchaseMap.put(split$default.get(0), Long.valueOf(Long.parseLong((String) split$default.get(1))));
}
clearOutdatedProductInfoInCache$facebook_core_release();
return;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final void filterPurchaseLogging(Map<String, JSONObject> purchaseDetailsMap, Map<String, ? extends JSONObject> skuDetailsMap) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseLoggerManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(purchaseDetailsMap, "purchaseDetailsMap");
Intrinsics.checkNotNullParameter(skuDetailsMap, "skuDetailsMap");
InAppPurchaseLoggerManager inAppPurchaseLoggerManager = INSTANCE;
inAppPurchaseLoggerManager.readPurchaseCache();
inAppPurchaseLoggerManager.logPurchases(inAppPurchaseLoggerManager.constructLoggingReadyMap$facebook_core_release(inAppPurchaseLoggerManager.cacheDeDupPurchase$facebook_core_release(purchaseDetailsMap), skuDetailsMap));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseLoggerManager.class);
}
}
private final void logPurchases(Map<String, String> map) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key != null && value != null) {
AutomaticAnalyticsLogger.logPurchase(key, value, false);
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@VisibleForTesting(otherwise = 2)
public final Map<String, JSONObject> cacheDeDupPurchase$facebook_core_release(Map<String, JSONObject> purchaseDetailsMap) {
Map map;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(purchaseDetailsMap, "purchaseDetailsMap");
long currentTimeMillis = System.currentTimeMillis() / 1000;
map = MapsKt__MapsKt.toMap(purchaseDetailsMap);
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
JSONObject jSONObject = (JSONObject) entry.getValue();
try {
if (jSONObject.has(SDKConstants.PARAM_PURCHASE_TOKEN)) {
String string = jSONObject.getString(SDKConstants.PARAM_PURCHASE_TOKEN);
if (cachedPurchaseMap.containsKey(string)) {
purchaseDetailsMap.remove(str);
} else {
Set<String> set = cachedPurchaseSet;
StringBuilder sb = new StringBuilder();
sb.append((Object) string);
sb.append(';');
sb.append(currentTimeMillis);
set.add(sb.toString());
}
}
} catch (Exception unused) {
}
}
SharedPreferences sharedPreferences2 = sharedPreferences;
if (sharedPreferences2 != null) {
sharedPreferences2.edit().putStringSet(PURCHASE_DETAILS_SET, cachedPurchaseSet).apply();
return new HashMap(purchaseDetailsMap);
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
@VisibleForTesting(otherwise = 2)
public final void clearOutdatedProductInfoInCache$facebook_core_release() {
Map map;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences sharedPreferences2 = sharedPreferences;
if (sharedPreferences2 != null) {
long j = sharedPreferences2.getLong(LAST_CLEARED_TIME, 0L);
if (j == 0) {
SharedPreferences sharedPreferences3 = sharedPreferences;
if (sharedPreferences3 != null) {
sharedPreferences3.edit().putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
return;
} else {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
}
}
if (currentTimeMillis - j > 604800) {
map = MapsKt__MapsKt.toMap(cachedPurchaseMap);
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
long longValue = ((Number) entry.getValue()).longValue();
if (currentTimeMillis - longValue > 86400) {
cachedPurchaseSet.remove(str + ';' + longValue);
cachedPurchaseMap.remove(str);
}
}
SharedPreferences sharedPreferences4 = sharedPreferences;
if (sharedPreferences4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
}
sharedPreferences4.edit().putStringSet(PURCHASE_DETAILS_SET, cachedPurchaseSet).putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
return;
}
return;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final boolean eligibleQueryPurchaseHistory() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseLoggerManager.class)) {
return false;
}
try {
INSTANCE.readPurchaseCache();
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences sharedPreferences2 = sharedPreferences;
if (sharedPreferences2 != null) {
long j = sharedPreferences2.getLong(LAST_QUERY_PURCHASE_HISTORY_TIME, 0L);
if (j != 0 && currentTimeMillis - j < PURCHASE_IN_CACHE_INTERVAL) {
return false;
}
SharedPreferences sharedPreferences3 = sharedPreferences;
if (sharedPreferences3 != null) {
sharedPreferences3.edit().putLong(LAST_QUERY_PURCHASE_HISTORY_TIME, currentTimeMillis).apply();
return true;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseLoggerManager.class);
return false;
}
}
@VisibleForTesting(otherwise = 2)
public final Map<String, String> constructLoggingReadyMap$facebook_core_release(Map<String, ? extends JSONObject> purchaseDetailsMap, Map<String, ? extends JSONObject> skuDetailsMap) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(purchaseDetailsMap, "purchaseDetailsMap");
Intrinsics.checkNotNullParameter(skuDetailsMap, "skuDetailsMap");
long currentTimeMillis = System.currentTimeMillis() / 1000;
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (Map.Entry<String, ? extends JSONObject> entry : purchaseDetailsMap.entrySet()) {
String key = entry.getKey();
JSONObject value = entry.getValue();
JSONObject jSONObject = skuDetailsMap.get(key);
if (value != null && value.has(PURCHASE_TIME)) {
try {
if (currentTimeMillis - (value.getLong(PURCHASE_TIME) / 1000) <= 86400 && jSONObject != null) {
String jSONObject2 = value.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "purchaseDetail.toString()");
String jSONObject3 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject3, "skuDetail.toString()");
linkedHashMap.put(jSONObject2, jSONObject3);
}
} catch (Exception unused) {
}
}
}
return linkedHashMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,80 @@
package com.facebook.appevents.iap;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import csdk.gluads.Consts;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseManager {
private static final String GOOGLE_BILLINGCLIENT_VERSION = "com.google.android.play.billingclient.version";
public static final InAppPurchaseManager INSTANCE = new InAppPurchaseManager();
private static final AtomicBoolean enabled = new AtomicBoolean(false);
private InAppPurchaseManager() {
}
public static final void enableAutoLogging() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseManager.class)) {
return;
}
try {
enabled.set(true);
startTracking();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseManager.class);
}
}
public static final void startTracking() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseManager.class)) {
return;
}
try {
if (enabled.get()) {
if (INSTANCE.usingBillingLib2Plus()) {
FeatureManager featureManager = FeatureManager.INSTANCE;
if (FeatureManager.isEnabled(FeatureManager.Feature.IapLoggingLib2)) {
InAppPurchaseAutoLogger inAppPurchaseAutoLogger = InAppPurchaseAutoLogger.INSTANCE;
InAppPurchaseAutoLogger.startIapLogging(FacebookSdk.getApplicationContext());
return;
}
}
InAppPurchaseActivityLifecycleTracker.startIapLogging();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseManager.class);
}
}
private final boolean usingBillingLib2Plus() {
List split$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Context applicationContext = FacebookSdk.getApplicationContext();
ApplicationInfo applicationInfo = applicationContext.getPackageManager().getApplicationInfo(applicationContext.getPackageName(), 128);
Intrinsics.checkNotNullExpressionValue(applicationInfo, "context.packageManager.getApplicationInfo(\n context.packageName, PackageManager.GET_META_DATA)");
String string = applicationInfo.metaData.getString(GOOGLE_BILLINGCLIENT_VERSION);
if (string == null) {
return false;
}
split$default = StringsKt__StringsKt.split$default((CharSequence) string, new String[]{Consts.STRING_PERIOD}, false, 3, 2, (Object) null);
return Integer.parseInt((String) split$default.get(0)) >= 2;
} catch (Exception unused) {
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
}

View File

@@ -0,0 +1,156 @@
package com.facebook.appevents.iap;
import androidx.annotation.RestrictTo;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.reflect.Method;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseSkuDetailsWrapper {
private static final String CLASSNAME_SKU_DETAILS_PARAMS = "com.android.billingclient.api.SkuDetailsParams";
private static final String CLASSNAME_SKU_DETAILS_PARAMS_BUILDER = "com.android.billingclient.api.SkuDetailsParams$Builder";
private static final String METHOD_BUILD = "build";
private static final String METHOD_NEW_BUILDER = "newBuilder";
private static final String METHOD_SET_SKU_LIST = "setSkusList";
private static final String METHOD_SET_TYPE = "setType";
private static InAppPurchaseSkuDetailsWrapper instance;
private final Method buildMethod;
private final Class<?> builderClazz;
private final Method newBuilderMethod;
private final Method setSkusListMethod;
private final Method setTypeMethod;
private final Class<?> skuDetailsParamsClazz;
public static final Companion Companion = new Companion(null);
private static final AtomicBoolean initialized = new AtomicBoolean(false);
public static final InAppPurchaseSkuDetailsWrapper getOrCreateInstance() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return null;
}
try {
return Companion.getOrCreateInstance();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
return null;
}
}
public InAppPurchaseSkuDetailsWrapper(Class<?> skuDetailsParamsClazz, Class<?> builderClazz, Method newBuilderMethod, Method setTypeMethod, Method setSkusListMethod, Method buildMethod) {
Intrinsics.checkNotNullParameter(skuDetailsParamsClazz, "skuDetailsParamsClazz");
Intrinsics.checkNotNullParameter(builderClazz, "builderClazz");
Intrinsics.checkNotNullParameter(newBuilderMethod, "newBuilderMethod");
Intrinsics.checkNotNullParameter(setTypeMethod, "setTypeMethod");
Intrinsics.checkNotNullParameter(setSkusListMethod, "setSkusListMethod");
Intrinsics.checkNotNullParameter(buildMethod, "buildMethod");
this.skuDetailsParamsClazz = skuDetailsParamsClazz;
this.builderClazz = builderClazz;
this.newBuilderMethod = newBuilderMethod;
this.setTypeMethod = setTypeMethod;
this.setSkusListMethod = setSkusListMethod;
this.buildMethod = buildMethod;
}
public static final /* synthetic */ AtomicBoolean access$getInitialized$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return null;
}
try {
return initialized;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
return null;
}
}
public static final /* synthetic */ InAppPurchaseSkuDetailsWrapper access$getInstance$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return null;
}
try {
return instance;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
return null;
}
}
public static final /* synthetic */ void access$setInstance$cp(InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return;
}
try {
instance = inAppPurchaseSkuDetailsWrapper;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
}
}
public final Class<?> getSkuDetailsParamsClazz() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.skuDetailsParamsClazz;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final Object getSkuDetailsParams(String str, List<String> list) {
Object invokeMethod;
Object invokeMethod2;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod3 = InAppPurchaseUtils.invokeMethod(this.skuDetailsParamsClazz, this.newBuilderMethod, null, new Object[0]);
if (invokeMethod3 != null && (invokeMethod = InAppPurchaseUtils.invokeMethod(this.builderClazz, this.setTypeMethod, invokeMethod3, str)) != null && (invokeMethod2 = InAppPurchaseUtils.invokeMethod(this.builderClazz, this.setSkusListMethod, invokeMethod, list)) != null) {
return InAppPurchaseUtils.invokeMethod(this.builderClazz, this.buildMethod, invokeMethod2, new Object[0]);
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final InAppPurchaseSkuDetailsWrapper getOrCreateInstance() {
if (InAppPurchaseSkuDetailsWrapper.access$getInitialized$cp().get()) {
return InAppPurchaseSkuDetailsWrapper.access$getInstance$cp();
}
createInstance();
InAppPurchaseSkuDetailsWrapper.access$getInitialized$cp().set(true);
return InAppPurchaseSkuDetailsWrapper.access$getInstance$cp();
}
private final void createInstance() {
Class<?> cls = InAppPurchaseUtils.getClass(InAppPurchaseSkuDetailsWrapper.CLASSNAME_SKU_DETAILS_PARAMS);
Class<?> cls2 = InAppPurchaseUtils.getClass(InAppPurchaseSkuDetailsWrapper.CLASSNAME_SKU_DETAILS_PARAMS_BUILDER);
if (cls == null || cls2 == null) {
return;
}
Method method = InAppPurchaseUtils.getMethod(cls, InAppPurchaseSkuDetailsWrapper.METHOD_NEW_BUILDER, new Class[0]);
Method method2 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseSkuDetailsWrapper.METHOD_SET_TYPE, String.class);
Method method3 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseSkuDetailsWrapper.METHOD_SET_SKU_LIST, List.class);
Method method4 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseSkuDetailsWrapper.METHOD_BUILD, new Class[0]);
if (method == null || method2 == null || method3 == null || method4 == null) {
return;
}
InAppPurchaseSkuDetailsWrapper.access$setInstance$cp(new InAppPurchaseSkuDetailsWrapper(cls, cls2, method, method2, method3, method4));
}
}
}

View File

@@ -0,0 +1,111 @@
package com.facebook.appevents.iap;
import android.content.Context;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class InAppPurchaseUtils {
public static final InAppPurchaseUtils INSTANCE = new InAppPurchaseUtils();
private InAppPurchaseUtils() {
}
public static final Class<?> getClass(String className) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(className, "className");
try {
return Class.forName(className);
} catch (ClassNotFoundException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Method getMethod(Class<?> clazz, String methodName, Class<?>... args) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(methodName, "methodName");
Intrinsics.checkNotNullParameter(args, "args");
try {
return clazz.getMethod(methodName, (Class[]) Arrays.copyOf(args, args.length));
} catch (NoSuchMethodException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Method getDeclaredMethod$facebook_core_release(Class<?> clazz, String methodName, Class<?>... args) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(methodName, "methodName");
Intrinsics.checkNotNullParameter(args, "args");
try {
return clazz.getDeclaredMethod(methodName, (Class[]) Arrays.copyOf(args, args.length));
} catch (NoSuchMethodException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Object invokeMethod(Class<?> clazz, Method method, Object obj, Object... args) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(method, "method");
Intrinsics.checkNotNullParameter(args, "args");
if (obj != null) {
obj = clazz.cast(obj);
}
try {
return method.invoke(obj, Arrays.copyOf(args, args.length));
} catch (IllegalAccessException | InvocationTargetException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Class<?> getClassFromContext$facebook_core_release(Context context, String className) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(className, "className");
try {
return context.getClassLoader().loadClass(className);
} catch (ClassNotFoundException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
}

View File

@@ -0,0 +1,84 @@
package com.facebook.appevents.integrity;
import com.facebook.FacebookSdk;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.HashSet;
import java.util.Set;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class BlocklistEventsManager {
public static final BlocklistEventsManager INSTANCE = new BlocklistEventsManager();
private static Set<String> blocklist = new HashSet();
private static boolean enabled;
private BlocklistEventsManager() {
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(BlocklistEventsManager.class)) {
return;
}
try {
INSTANCE.loadBlocklistEvents();
Set<String> set = blocklist;
if (set != null && !set.isEmpty()) {
enabled = true;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BlocklistEventsManager.class);
}
}
public static final void disable() {
if (CrashShieldHandler.isObjectCrashing(BlocklistEventsManager.class)) {
return;
}
try {
enabled = false;
blocklist = new HashSet();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BlocklistEventsManager.class);
}
}
private final void loadBlocklistEvents() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings == null) {
return;
}
Utility utility = Utility.INSTANCE;
HashSet<String> convertJSONArrayToHashSet = Utility.convertJSONArrayToHashSet(queryAppSettings.getBlocklistEvents());
if (convertJSONArrayToHashSet == null) {
return;
}
blocklist = convertJSONArrayToHashSet;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final boolean isInBlocklist(String eventName) {
if (CrashShieldHandler.isObjectCrashing(BlocklistEventsManager.class)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(eventName, "eventName");
if (enabled) {
return blocklist.contains(eventName);
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BlocklistEventsManager.class);
return false;
}
}
}

View File

@@ -0,0 +1,111 @@
package com.facebook.appevents.integrity;
import com.facebook.FacebookSdk;
import com.facebook.appevents.ml.ModelManager;
import com.facebook.internal.FetchedAppGateKeepersManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.List;
import java.util.Map;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class IntegrityManager {
public static final IntegrityManager INSTANCE = new IntegrityManager();
public static final String INTEGRITY_TYPE_ADDRESS = "address";
public static final String INTEGRITY_TYPE_HEALTH = "health";
public static final String INTEGRITY_TYPE_NONE = "none";
private static final String RESTRICTIVE_ON_DEVICE_PARAMS_KEY = "_onDeviceParams";
private static boolean enabled;
private static boolean isSampleEnabled;
private IntegrityManager() {
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(IntegrityManager.class)) {
return;
}
try {
enabled = true;
FetchedAppGateKeepersManager fetchedAppGateKeepersManager = FetchedAppGateKeepersManager.INSTANCE;
isSampleEnabled = FetchedAppGateKeepersManager.getGateKeeperForKey("FBSDKFeatureIntegritySample", FacebookSdk.getApplicationId(), false);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, IntegrityManager.class);
}
}
public static final void processParameters(Map<String, String> parameters) {
if (CrashShieldHandler.isObjectCrashing(IntegrityManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(parameters, "parameters");
if (!enabled || parameters.isEmpty()) {
return;
}
try {
List<String> list = CollectionsKt___CollectionsKt.toList(parameters.keySet());
JSONObject jSONObject = new JSONObject();
for (String str : list) {
String str2 = parameters.get(str);
if (str2 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
String str3 = str2;
IntegrityManager integrityManager = INSTANCE;
if (!integrityManager.shouldFilter(str) && !integrityManager.shouldFilter(str3)) {
}
parameters.remove(str);
if (!isSampleEnabled) {
str3 = "";
}
jSONObject.put(str, str3);
}
if (jSONObject.length() != 0) {
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "restrictiveParamJson.toString()");
parameters.put(RESTRICTIVE_ON_DEVICE_PARAMS_KEY, jSONObject2);
}
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, IntegrityManager.class);
}
}
private final boolean shouldFilter(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return !Intrinsics.areEqual("none", getIntegrityPredictionResult(str));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final String getIntegrityPredictionResult(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
float[] fArr = new float[30];
for (int i = 0; i < 30; i++) {
fArr[i] = 0.0f;
}
ModelManager modelManager = ModelManager.INSTANCE;
String[] predict = ModelManager.predict(ModelManager.Task.MTML_INTEGRITY_DETECT, new float[][]{fArr}, new String[]{str});
if (predict == null) {
return "none";
}
String str2 = predict[0];
return str2 == null ? "none" : str2;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,383 @@
package com.facebook.appevents.integrity;
import android.os.Bundle;
import androidx.core.app.NotificationCompat;
import com.facebook.FacebookSdk;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class MACARuleMatchingManager {
private static JSONArray MACARules;
private static boolean enabled;
public static final MACARuleMatchingManager INSTANCE = new MACARuleMatchingManager();
private static String[] keys = {NotificationCompat.CATEGORY_EVENT, "_locale", "_appVersion", "_deviceOS", "_platform", "_deviceModel", "_nativeAppID", "_nativeAppShortVersion", "_timezone", "_carrier", "_deviceOSTypeName", "_deviceOSVersion", "_remainingDiskGB"};
private MACARuleMatchingManager() {
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(MACARuleMatchingManager.class)) {
return;
}
try {
INSTANCE.loadMACARules();
if (MACARules != null) {
enabled = true;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MACARuleMatchingManager.class);
}
}
private final void loadMACARules() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings == null) {
return;
}
MACARules = queryAppSettings.getMACARuleMatchingSetting();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final String getKey(JSONObject logic) {
if (CrashShieldHandler.isObjectCrashing(MACARuleMatchingManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(logic, "logic");
Iterator<String> keys2 = logic.keys();
if (keys2.hasNext()) {
return keys2.next();
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MACARuleMatchingManager.class);
return null;
}
}
/* JADX WARN: Removed duplicated region for block: B:107:0x02bd A[Catch: all -> 0x004c, TryCatch #0 {all -> 0x004c, blocks: (B:6:0x000a, B:9:0x001b, B:13:0x003f, B:15:0x0037, B:24:0x0068, B:25:0x0070, B:28:0x007d, B:32:0x0087, B:34:0x008d, B:36:0x0098, B:38:0x00a5, B:39:0x00aa, B:40:0x00ab, B:41:0x00b0, B:42:0x00b1, B:46:0x00bb, B:51:0x00c8, B:57:0x0259, B:60:0x0261, B:61:0x0265, B:63:0x026b, B:65:0x0273, B:67:0x0282, B:74:0x0292, B:75:0x0297, B:77:0x0298, B:78:0x029d, B:80:0x00d2, B:84:0x00dc, B:86:0x00e2, B:88:0x00ed, B:90:0x00fa, B:91:0x00ff, B:92:0x0100, B:93:0x0105, B:94:0x0106, B:100:0x02ab, B:104:0x02b3, B:105:0x02b7, B:107:0x02bd, B:109:0x02c5, B:111:0x02d4, B:117:0x02e3, B:118:0x02e8, B:120:0x02e9, B:121:0x02ee, B:124:0x0110, B:128:0x011a, B:130:0x0120, B:132:0x012b, B:134:0x0138, B:135:0x013d, B:136:0x013e, B:137:0x0143, B:138:0x0144, B:142:0x01f4, B:146:0x014e, B:150:0x01d8, B:154:0x0158, B:158:0x01b2, B:162:0x0162, B:166:0x016c, B:170:0x023a, B:174:0x0176, B:178:0x0180, B:184:0x038f, B:186:0x018a, B:190:0x020a, B:194:0x0194, B:198:0x019e, B:202:0x0226, B:204:0x01a8, B:208:0x01c4, B:212:0x01ce, B:216:0x01ea, B:220:0x0200, B:224:0x021c, B:228:0x0230, B:232:0x024c, B:236:0x029e, B:240:0x02ef, B:244:0x02f9, B:246:0x02ff, B:248:0x030a, B:252:0x0319, B:253:0x031e, B:254:0x031f, B:255:0x0324, B:256:0x0325, B:260:0x032f, B:262:0x0339, B:268:0x037a, B:270:0x0343, B:274:0x034d, B:276:0x035c, B:280:0x0365, B:282:0x036e, B:286:0x0383, B:290:0x0398, B:294:0x03a1, B:296:0x03a7, B:298:0x03b2, B:302:0x03c2, B:303:0x03c7, B:304:0x03c8, B:305:0x03cd, B:307:0x0055), top: B:5:0x000a }] */
/* JADX WARN: Removed duplicated region for block: B:144:0x01fe */
/* JADX WARN: Removed duplicated region for block: B:145:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:152:0x01e8 */
/* JADX WARN: Removed duplicated region for block: B:153:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:160:0x01c2 */
/* JADX WARN: Removed duplicated region for block: B:161:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:172:0x024a */
/* JADX WARN: Removed duplicated region for block: B:173:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:183:0x038e A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:184:0x038f A[Catch: all -> 0x004c, TryCatch #0 {all -> 0x004c, blocks: (B:6:0x000a, B:9:0x001b, B:13:0x003f, B:15:0x0037, B:24:0x0068, B:25:0x0070, B:28:0x007d, B:32:0x0087, B:34:0x008d, B:36:0x0098, B:38:0x00a5, B:39:0x00aa, B:40:0x00ab, B:41:0x00b0, B:42:0x00b1, B:46:0x00bb, B:51:0x00c8, B:57:0x0259, B:60:0x0261, B:61:0x0265, B:63:0x026b, B:65:0x0273, B:67:0x0282, B:74:0x0292, B:75:0x0297, B:77:0x0298, B:78:0x029d, B:80:0x00d2, B:84:0x00dc, B:86:0x00e2, B:88:0x00ed, B:90:0x00fa, B:91:0x00ff, B:92:0x0100, B:93:0x0105, B:94:0x0106, B:100:0x02ab, B:104:0x02b3, B:105:0x02b7, B:107:0x02bd, B:109:0x02c5, B:111:0x02d4, B:117:0x02e3, B:118:0x02e8, B:120:0x02e9, B:121:0x02ee, B:124:0x0110, B:128:0x011a, B:130:0x0120, B:132:0x012b, B:134:0x0138, B:135:0x013d, B:136:0x013e, B:137:0x0143, B:138:0x0144, B:142:0x01f4, B:146:0x014e, B:150:0x01d8, B:154:0x0158, B:158:0x01b2, B:162:0x0162, B:166:0x016c, B:170:0x023a, B:174:0x0176, B:178:0x0180, B:184:0x038f, B:186:0x018a, B:190:0x020a, B:194:0x0194, B:198:0x019e, B:202:0x0226, B:204:0x01a8, B:208:0x01c4, B:212:0x01ce, B:216:0x01ea, B:220:0x0200, B:224:0x021c, B:228:0x0230, B:232:0x024c, B:236:0x029e, B:240:0x02ef, B:244:0x02f9, B:246:0x02ff, B:248:0x030a, B:252:0x0319, B:253:0x031e, B:254:0x031f, B:255:0x0324, B:256:0x0325, B:260:0x032f, B:262:0x0339, B:268:0x037a, B:270:0x0343, B:274:0x034d, B:276:0x035c, B:280:0x0365, B:282:0x036e, B:286:0x0383, B:290:0x0398, B:294:0x03a1, B:296:0x03a7, B:298:0x03b2, B:302:0x03c2, B:303:0x03c7, B:304:0x03c8, B:305:0x03cd, B:307:0x0055), top: B:5:0x000a }] */
/* JADX WARN: Removed duplicated region for block: B:192:0x021a */
/* JADX WARN: Removed duplicated region for block: B:193:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:267:0x0379 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:268:0x037a A[Catch: all -> 0x004c, TryCatch #0 {all -> 0x004c, blocks: (B:6:0x000a, B:9:0x001b, B:13:0x003f, B:15:0x0037, B:24:0x0068, B:25:0x0070, B:28:0x007d, B:32:0x0087, B:34:0x008d, B:36:0x0098, B:38:0x00a5, B:39:0x00aa, B:40:0x00ab, B:41:0x00b0, B:42:0x00b1, B:46:0x00bb, B:51:0x00c8, B:57:0x0259, B:60:0x0261, B:61:0x0265, B:63:0x026b, B:65:0x0273, B:67:0x0282, B:74:0x0292, B:75:0x0297, B:77:0x0298, B:78:0x029d, B:80:0x00d2, B:84:0x00dc, B:86:0x00e2, B:88:0x00ed, B:90:0x00fa, B:91:0x00ff, B:92:0x0100, B:93:0x0105, B:94:0x0106, B:100:0x02ab, B:104:0x02b3, B:105:0x02b7, B:107:0x02bd, B:109:0x02c5, B:111:0x02d4, B:117:0x02e3, B:118:0x02e8, B:120:0x02e9, B:121:0x02ee, B:124:0x0110, B:128:0x011a, B:130:0x0120, B:132:0x012b, B:134:0x0138, B:135:0x013d, B:136:0x013e, B:137:0x0143, B:138:0x0144, B:142:0x01f4, B:146:0x014e, B:150:0x01d8, B:154:0x0158, B:158:0x01b2, B:162:0x0162, B:166:0x016c, B:170:0x023a, B:174:0x0176, B:178:0x0180, B:184:0x038f, B:186:0x018a, B:190:0x020a, B:194:0x0194, B:198:0x019e, B:202:0x0226, B:204:0x01a8, B:208:0x01c4, B:212:0x01ce, B:216:0x01ea, B:220:0x0200, B:224:0x021c, B:228:0x0230, B:232:0x024c, B:236:0x029e, B:240:0x02ef, B:244:0x02f9, B:246:0x02ff, B:248:0x030a, B:252:0x0319, B:253:0x031e, B:254:0x031f, B:255:0x0324, B:256:0x0325, B:260:0x032f, B:262:0x0339, B:268:0x037a, B:270:0x0343, B:274:0x034d, B:276:0x035c, B:280:0x0365, B:282:0x036e, B:286:0x0383, B:290:0x0398, B:294:0x03a1, B:296:0x03a7, B:298:0x03b2, B:302:0x03c2, B:303:0x03c7, B:304:0x03c8, B:305:0x03cd, B:307:0x0055), top: B:5:0x000a }] */
/* JADX WARN: Removed duplicated region for block: B:56:0x0258 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:57:0x0259 A[Catch: all -> 0x004c, TryCatch #0 {all -> 0x004c, blocks: (B:6:0x000a, B:9:0x001b, B:13:0x003f, B:15:0x0037, B:24:0x0068, B:25:0x0070, B:28:0x007d, B:32:0x0087, B:34:0x008d, B:36:0x0098, B:38:0x00a5, B:39:0x00aa, B:40:0x00ab, B:41:0x00b0, B:42:0x00b1, B:46:0x00bb, B:51:0x00c8, B:57:0x0259, B:60:0x0261, B:61:0x0265, B:63:0x026b, B:65:0x0273, B:67:0x0282, B:74:0x0292, B:75:0x0297, B:77:0x0298, B:78:0x029d, B:80:0x00d2, B:84:0x00dc, B:86:0x00e2, B:88:0x00ed, B:90:0x00fa, B:91:0x00ff, B:92:0x0100, B:93:0x0105, B:94:0x0106, B:100:0x02ab, B:104:0x02b3, B:105:0x02b7, B:107:0x02bd, B:109:0x02c5, B:111:0x02d4, B:117:0x02e3, B:118:0x02e8, B:120:0x02e9, B:121:0x02ee, B:124:0x0110, B:128:0x011a, B:130:0x0120, B:132:0x012b, B:134:0x0138, B:135:0x013d, B:136:0x013e, B:137:0x0143, B:138:0x0144, B:142:0x01f4, B:146:0x014e, B:150:0x01d8, B:154:0x0158, B:158:0x01b2, B:162:0x0162, B:166:0x016c, B:170:0x023a, B:174:0x0176, B:178:0x0180, B:184:0x038f, B:186:0x018a, B:190:0x020a, B:194:0x0194, B:198:0x019e, B:202:0x0226, B:204:0x01a8, B:208:0x01c4, B:212:0x01ce, B:216:0x01ea, B:220:0x0200, B:224:0x021c, B:228:0x0230, B:232:0x024c, B:236:0x029e, B:240:0x02ef, B:244:0x02f9, B:246:0x02ff, B:248:0x030a, B:252:0x0319, B:253:0x031e, B:254:0x031f, B:255:0x0324, B:256:0x0325, B:260:0x032f, B:262:0x0339, B:268:0x037a, B:270:0x0343, B:274:0x034d, B:276:0x035c, B:280:0x0365, B:282:0x036e, B:286:0x0383, B:290:0x0398, B:294:0x03a1, B:296:0x03a7, B:298:0x03b2, B:302:0x03c2, B:303:0x03c7, B:304:0x03c8, B:305:0x03cd, B:307:0x0055), top: B:5:0x000a }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final boolean stringComparison(java.lang.String r9, org.json.JSONObject r10, android.os.Bundle r11) {
/*
Method dump skipped, instructions count: 1112
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.integrity.MACARuleMatchingManager.stringComparison(java.lang.String, org.json.JSONObject, android.os.Bundle):boolean");
}
public static final ArrayList<String> getStringArrayList(JSONArray jSONArray) {
if (CrashShieldHandler.isObjectCrashing(MACARuleMatchingManager.class) || jSONArray == null) {
return null;
}
try {
ArrayList<String> arrayList = new ArrayList<>();
int length = jSONArray.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
arrayList.add(jSONArray.get(i).toString());
if (i2 >= length) {
break;
}
i = i2;
}
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MACARuleMatchingManager.class);
return null;
}
}
public static final boolean isMatchCCRule(String str, Bundle bundle) {
int length;
if (!CrashShieldHandler.isObjectCrashing(MACARuleMatchingManager.class) && str != null && bundle != null) {
try {
JSONObject jSONObject = new JSONObject(str);
String key = getKey(jSONObject);
if (key == null) {
return false;
}
Object obj = jSONObject.get(key);
int hashCode = key.hashCode();
if (hashCode != 3555) {
if (hashCode != 96727) {
if (hashCode == 109267 && key.equals("not")) {
return !isMatchCCRule(obj.toString(), bundle);
}
} else if (key.equals("and")) {
JSONArray jSONArray = (JSONArray) obj;
if (jSONArray == null) {
return false;
}
int length2 = jSONArray.length();
if (length2 > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
if (!isMatchCCRule(jSONArray.get(i).toString(), bundle)) {
return false;
}
if (i2 >= length2) {
break;
}
i = i2;
}
}
return true;
}
} else if (key.equals("or")) {
JSONArray jSONArray2 = (JSONArray) obj;
if (jSONArray2 != null && (length = jSONArray2.length()) > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
if (isMatchCCRule(jSONArray2.get(i3).toString(), bundle)) {
return true;
}
if (i4 >= length) {
break;
}
i3 = i4;
}
}
return false;
}
JSONObject jSONObject2 = (JSONObject) obj;
if (jSONObject2 == null) {
return false;
}
return stringComparison(key, jSONObject2, bundle);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MACARuleMatchingManager.class);
}
}
return false;
}
public static final String getMatchPropertyIDs(Bundle bundle) {
String optString;
if (CrashShieldHandler.isObjectCrashing(MACARuleMatchingManager.class)) {
return null;
}
try {
JSONArray jSONArray = MACARules;
if (jSONArray == null) {
return "[]";
}
Integer valueOf = jSONArray == null ? null : Integer.valueOf(jSONArray.length());
if (valueOf != null && valueOf.intValue() == 0) {
return "[]";
}
JSONArray jSONArray2 = MACARules;
if (jSONArray2 == null) {
throw new NullPointerException("null cannot be cast to non-null type org.json.JSONArray");
}
ArrayList arrayList = new ArrayList();
int length = jSONArray2.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
String optString2 = jSONArray2.optString(i);
if (optString2 != null) {
JSONObject jSONObject = new JSONObject(optString2);
long optLong = jSONObject.optLong("id");
if (optLong != 0 && (optString = jSONObject.optString("rule")) != null && isMatchCCRule(optString, bundle)) {
arrayList.add(Long.valueOf(optLong));
}
}
if (i2 >= length) {
break;
}
i = i2;
}
}
String jSONArray3 = new JSONArray((Collection) arrayList).toString();
Intrinsics.checkNotNullExpressionValue(jSONArray3, "JSONArray(res).toString()");
return jSONArray3;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MACARuleMatchingManager.class);
return null;
}
}
public static final void processParameters(Bundle bundle, String event) {
if (CrashShieldHandler.isObjectCrashing(MACARuleMatchingManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(event, "event");
if (!enabled || bundle == null) {
return;
}
try {
generateInfo(bundle, event);
bundle.putString("_audiencePropertyIds", getMatchPropertyIDs(bundle));
bundle.putString("cs_maca", "1");
removeGeneratedInfo(bundle);
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MACARuleMatchingManager.class);
}
}
/* JADX WARN: Removed duplicated region for block: B:15:0x005b */
/* JADX WARN: Removed duplicated region for block: B:18:0x0071 */
/* JADX WARN: Removed duplicated region for block: B:21:0x0086 */
/* JADX WARN: Removed duplicated region for block: B:25:0x0087 */
/* JADX WARN: Removed duplicated region for block: B:26:0x0042 A[Catch: all -> 0x00b3, TryCatch #0 {all -> 0x00b3, blocks: (B:6:0x000d, B:10:0x0032, B:13:0x0049, B:16:0x005c, B:19:0x0072, B:22:0x0088, B:26:0x0042, B:29:0x002b), top: B:5:0x000d }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final void generateInfo(android.os.Bundle r6, java.lang.String r7) {
/*
java.lang.String r0 = "ANDROID"
java.lang.String r1 = "event"
java.lang.Class<com.facebook.appevents.integrity.MACARuleMatchingManager> r2 = com.facebook.appevents.integrity.MACARuleMatchingManager.class
boolean r3 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r2)
if (r3 == 0) goto Ld
return
Ld:
java.lang.String r3 = "params"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r6, r3) // Catch: java.lang.Throwable -> Lb3
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r7, r1) // Catch: java.lang.Throwable -> Lb3
r6.putString(r1, r7) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_locale"
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> Lb3
r1.<init>() // Catch: java.lang.Throwable -> Lb3
com.facebook.internal.Utility r3 = com.facebook.internal.Utility.INSTANCE // Catch: java.lang.Throwable -> Lb3
java.util.Locale r4 = r3.getLocale() // Catch: java.lang.Throwable -> Lb3
java.lang.String r5 = ""
if (r4 != 0) goto L2b
L29:
r4 = r5
goto L32
L2b:
java.lang.String r4 = r4.getLanguage() // Catch: java.lang.Throwable -> Lb3
if (r4 != 0) goto L32
goto L29
L32:
r1.append(r4) // Catch: java.lang.Throwable -> Lb3
r4 = 95
r1.append(r4) // Catch: java.lang.Throwable -> Lb3
java.util.Locale r4 = r3.getLocale() // Catch: java.lang.Throwable -> Lb3
if (r4 != 0) goto L42
L40:
r4 = r5
goto L49
L42:
java.lang.String r4 = r4.getCountry() // Catch: java.lang.Throwable -> Lb3
if (r4 != 0) goto L49
goto L40
L49:
r1.append(r4) // Catch: java.lang.Throwable -> Lb3
java.lang.String r1 = r1.toString() // Catch: java.lang.Throwable -> Lb3
r6.putString(r7, r1) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_appVersion"
java.lang.String r1 = r3.getVersionName() // Catch: java.lang.Throwable -> Lb3
if (r1 != 0) goto L5c
r1 = r5
L5c:
r6.putString(r7, r1) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_deviceOS"
r6.putString(r7, r0) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_platform"
java.lang.String r1 = "mobile"
r6.putString(r7, r1) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_deviceModel"
java.lang.String r1 = android.os.Build.MODEL // Catch: java.lang.Throwable -> Lb3
if (r1 != 0) goto L72
r1 = r5
L72:
r6.putString(r7, r1) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_nativeAppID"
java.lang.String r1 = com.facebook.FacebookSdk.getApplicationId() // Catch: java.lang.Throwable -> Lb3
r6.putString(r7, r1) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_nativeAppShortVersion"
java.lang.String r1 = r3.getVersionName() // Catch: java.lang.Throwable -> Lb3
if (r1 != 0) goto L87
goto L88
L87:
r5 = r1
L88:
r6.putString(r7, r5) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_timezone"
java.lang.String r1 = r3.getDeviceTimeZoneName() // Catch: java.lang.Throwable -> Lb3
r6.putString(r7, r1) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_carrier"
java.lang.String r1 = r3.getCarrierName() // Catch: java.lang.Throwable -> Lb3
r6.putString(r7, r1) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_deviceOSTypeName"
r6.putString(r7, r0) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_deviceOSVersion"
java.lang.String r0 = android.os.Build.VERSION.RELEASE // Catch: java.lang.Throwable -> Lb3
r6.putString(r7, r0) // Catch: java.lang.Throwable -> Lb3
java.lang.String r7 = "_remainingDiskGB"
long r0 = r3.getAvailableExternalStorageGB() // Catch: java.lang.Throwable -> Lb3
r6.putLong(r7, r0) // Catch: java.lang.Throwable -> Lb3
return
Lb3:
r6 = move-exception
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r6, r2)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.integrity.MACARuleMatchingManager.generateInfo(android.os.Bundle, java.lang.String):void");
}
public static final void removeGeneratedInfo(Bundle params) {
if (CrashShieldHandler.isObjectCrashing(MACARuleMatchingManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(params, "params");
String[] strArr = keys;
int length = strArr.length;
int i = 0;
while (i < length) {
String str = strArr[i];
i++;
params.remove(str);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, MACARuleMatchingManager.class);
}
}
}

View File

@@ -0,0 +1,174 @@
package com.facebook.appevents.integrity;
import android.os.Bundle;
import com.applovin.sdk.AppLovinEventParameters;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.internal.Constants;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.ironsource.v8;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.collections.SetsKt__SetsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
/* loaded from: classes2.dex */
public final class ProtectedModeManager {
public static final ProtectedModeManager INSTANCE = new ProtectedModeManager();
private static final String PROTECTED_MODE_IS_APPLIED_KEY = "pm";
private static final String PROTECTED_MODE_IS_APPLIED_VALUE = "1";
private static final Lazy defaultStandardParameterNames$delegate;
private static boolean enabled;
private static HashSet<String> standardParams;
private ProtectedModeManager() {
}
static {
Lazy lazy;
lazy = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: com.facebook.appevents.integrity.ProtectedModeManager$defaultStandardParameterNames$2
@Override // kotlin.jvm.functions.Function0
public final HashSet<String> invoke() {
HashSet<String> hashSetOf;
hashSetOf = SetsKt__SetsKt.hashSetOf("_currency", AppEventsConstants.EVENT_PARAM_VALUE_TO_SUM, "fb_availability", "fb_body_style", "fb_checkin_date", "fb_checkout_date", "fb_city", "fb_condition_of_vehicle", "fb_content_category", "fb_content_ids", "fb_content_name", AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "fb_contents", "fb_country", AppEventsConstants.EVENT_PARAM_CURRENCY, "fb_delivery_category", "fb_departing_arrival_date", "fb_departing_departure_date", "fb_destination_airport", "fb_destination_ids", "fb_dma_code", "fb_drivetrain", "fb_exterior_color", "fb_fuel_type", "fb_hotel_score", "fb_interior_color", "fb_lease_end_date", "fb_lease_start_date", "fb_listing_type", "fb_make", "fb_mileage.unit", "fb_mileage.value", "fb_model", "fb_neighborhood", "fb_num_adults", "fb_num_children", "fb_num_infants", AppEventsConstants.EVENT_PARAM_NUM_ITEMS, AppEventsConstants.EVENT_PARAM_ORDER_ID, "fb_origin_airport", "fb_postal_code", "fb_predicted_ltv", "fb_preferred_baths_range", "fb_preferred_beds_range", "fb_preferred_neighborhoods", "fb_preferred_num_stops", "fb_preferred_price_range", "fb_preferred_star_ratings", "fb_price", "fb_property_type", "fb_region", "fb_returning_arrival_date", "fb_returning_departure_date", AppEventsConstants.EVENT_PARAM_SEARCH_STRING, "fb_state_of_vehicle", "fb_status", "fb_suggested_destinations", "fb_suggested_home_listings", "fb_suggested_hotels", "fb_suggested_jobs", "fb_suggested_local_service_businesses", "fb_suggested_location_based_items", "fb_suggested_vehicles", "fb_transmission", "fb_travel_class", "fb_travel_end", "fb_travel_start", "fb_trim", "fb_user_bucket", "fb_value", "fb_vin", "fb_year", "lead_event_source", "predicted_ltv", "product_catalog_id", "app_user_id", v8.i.W, Constants.EVENT_NAME_EVENT_KEY, Constants.EVENT_NAME_MD5_EVENT_KEY, "_implicitlyLogged", "_inBackground", "_isTimedEvent", Constants.LOG_TIME_APP_EVENT_KEY, "_session_id", "_ui", "_valueToUpdate", com.facebook.appevents.codeless.internal.Constants.IS_CODELESS_EVENT_KEY, "_is_suggested_event", "_fb_pixel_referral_id", "fb_pixel_id", "trace_id", "subscription_id", "event_id", "_restrictedParams", "_onDeviceParams", "purchase_valid_result_type", "core_lib_included", "login_lib_included", "share_lib_included", "place_lib_included", "messenger_lib_included", "applinks_lib_included", "marketing_lib_included", "_codeless_action", "sdk_initialized", "billing_client_lib_included", "billing_service_lib_included", "user_data_keys", "device_push_token", AppEventsConstants.EVENT_PARAM_PACKAGE_FP, AppEventsConstants.EVENT_PARAM_APP_CERT_HASH, "aggregate_id", "anonymous_id", "campaign_ids", "fb_post_attachment", AppLovinEventParameters.IN_APP_PURCHASE_DATA, "ad_type", AppEventsConstants.EVENT_PARAM_CONTENT, AppEventsConstants.EVENT_PARAM_CONTENT_ID, AppEventsConstants.EVENT_PARAM_DESCRIPTION, AppEventsConstants.EVENT_PARAM_LEVEL, AppEventsConstants.EVENT_PARAM_MAX_RATING_VALUE, AppEventsConstants.EVENT_PARAM_PAYMENT_INFO_AVAILABLE, AppEventsConstants.EVENT_PARAM_REGISTRATION_METHOD, AppEventsConstants.EVENT_PARAM_SUCCESS, "pm", "_audiencePropertyIds", "cs_maca");
return hashSetOf;
}
});
defaultStandardParameterNames$delegate = lazy;
}
public final HashSet<String> getDefaultStandardParameterNames() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return (HashSet) defaultStandardParameterNames$delegate.getValue();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(ProtectedModeManager.class)) {
return;
}
try {
enabled = true;
INSTANCE.loadStandardParams();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ProtectedModeManager.class);
}
}
public static final void disable() {
if (CrashShieldHandler.isObjectCrashing(ProtectedModeManager.class)) {
return;
}
try {
enabled = false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ProtectedModeManager.class);
}
}
private final void loadStandardParams() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings == null) {
return;
}
HashSet<String> convertJSONArrayToHashSet = convertJSONArrayToHashSet(queryAppSettings.getProtectedModeStandardParamsSetting());
if (convertJSONArrayToHashSet == null) {
convertJSONArrayToHashSet = getDefaultStandardParameterNames();
}
standardParams = convertJSONArrayToHashSet;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final HashSet<String> convertJSONArrayToHashSet(JSONArray jSONArray) {
if (!CrashShieldHandler.isObjectCrashing(this) && jSONArray != null) {
try {
if (jSONArray.length() != 0) {
HashSet<String> hashSet = new HashSet<>();
int length = jSONArray.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
String string = jSONArray.getString(i);
Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
hashSet.add(string);
if (i2 >= length) {
break;
}
i = i2;
}
}
return hashSet;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
return null;
}
public static final void processParametersForProtectedMode(Bundle bundle) {
if (CrashShieldHandler.isObjectCrashing(ProtectedModeManager.class)) {
return;
}
try {
if (enabled && bundle != null && !bundle.isEmpty() && standardParams != null) {
ArrayList arrayList = new ArrayList();
Set<String> keySet = bundle.keySet();
Intrinsics.checkNotNullExpressionValue(keySet, "parameters.keySet()");
for (String param : keySet) {
HashSet<String> hashSet = standardParams;
Intrinsics.checkNotNull(hashSet);
if (!hashSet.contains(param)) {
Intrinsics.checkNotNullExpressionValue(param, "param");
arrayList.add(param);
}
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
bundle.remove((String) it.next());
}
bundle.putString(PROTECTED_MODE_IS_APPLIED_KEY, "1");
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ProtectedModeManager.class);
}
}
public final boolean protectedModeIsApplied(Bundle parameters) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(parameters, "parameters");
if (parameters.containsKey(PROTECTED_MODE_IS_APPLIED_KEY)) {
return Intrinsics.areEqual(parameters.get(PROTECTED_MODE_IS_APPLIED_KEY), "1");
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
}

View File

@@ -0,0 +1,132 @@
package com.facebook.appevents.integrity;
import com.facebook.FacebookSdk;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class RedactedEventsManager {
private static boolean enabled;
public static final RedactedEventsManager INSTANCE = new RedactedEventsManager();
private static Map<String, HashSet<String>> redactedEvents = new HashMap();
private RedactedEventsManager() {
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(RedactedEventsManager.class)) {
return;
}
try {
INSTANCE.loadRedactedEvents();
if (!redactedEvents.isEmpty()) {
enabled = true;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RedactedEventsManager.class);
}
}
public static final void disable() {
if (CrashShieldHandler.isObjectCrashing(RedactedEventsManager.class)) {
return;
}
try {
enabled = false;
redactedEvents = new HashMap();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RedactedEventsManager.class);
}
}
private final void loadRedactedEvents() {
int length;
HashSet<String> convertJSONArrayToHashSet;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
int i = 0;
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings == null) {
return;
}
try {
redactedEvents = new HashMap();
JSONArray redactedEvents2 = queryAppSettings.getRedactedEvents();
if (redactedEvents2 == null || redactedEvents2.length() == 0 || (length = redactedEvents2.length()) <= 0) {
return;
}
while (true) {
int i2 = i + 1;
JSONObject jSONObject = redactedEvents2.getJSONObject(i);
boolean has = jSONObject.has("key");
boolean has2 = jSONObject.has("value");
if (has && has2) {
String redactedString = jSONObject.getString("key");
JSONArray jSONArray = jSONObject.getJSONArray("value");
if (redactedString != null && (convertJSONArrayToHashSet = Utility.convertJSONArrayToHashSet(jSONArray)) != null) {
Map<String, HashSet<String>> map = redactedEvents;
Intrinsics.checkNotNullExpressionValue(redactedString, "redactedString");
map.put(redactedString, convertJSONArrayToHashSet);
}
}
if (i2 >= length) {
return;
} else {
i = i2;
}
}
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final String processEventsRedaction(String eventName) {
if (CrashShieldHandler.isObjectCrashing(RedactedEventsManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(eventName, "eventName");
if (enabled) {
String redactionString = INSTANCE.getRedactionString(eventName);
if (redactionString != null) {
return redactionString;
}
}
return eventName;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RedactedEventsManager.class);
return null;
}
}
private final String getRedactionString(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
for (String str2 : redactedEvents.keySet()) {
HashSet<String> hashSet = redactedEvents.get(str2);
if (hashSet != null && hashSet.contains(str)) {
return str2;
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,233 @@
package com.facebook.appevents.integrity;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
/* loaded from: classes2.dex */
public final class SensitiveParamsManager {
private static final String DEFAULT_SENSITIVE_PARAMS_KEY = "_MTSDK_Default_";
private static final String SENSITIVE_PARAMS_KEY = "_filteredKey";
private static boolean enabled;
public static final SensitiveParamsManager INSTANCE = new SensitiveParamsManager();
private static HashSet<String> defaultSensitiveParameters = new HashSet<>();
private static Map<String, HashSet<String>> sensitiveParameters = new HashMap();
private SensitiveParamsManager() {
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(SensitiveParamsManager.class)) {
return;
}
try {
INSTANCE.loadSensitiveParameters();
HashSet<String> hashSet = defaultSensitiveParameters;
if (hashSet != null) {
if (hashSet.isEmpty()) {
}
enabled = true;
return;
}
Map<String, HashSet<String>> map = sensitiveParameters;
if (map != null) {
if (map.isEmpty()) {
}
enabled = true;
return;
}
enabled = false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SensitiveParamsManager.class);
}
}
public static final void disable() {
if (CrashShieldHandler.isObjectCrashing(SensitiveParamsManager.class)) {
return;
}
try {
enabled = false;
sensitiveParameters = new HashMap();
defaultSensitiveParameters = new HashSet<>();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SensitiveParamsManager.class);
}
}
/* JADX WARN: Code restructure failed: missing block: B:34:?, code lost:
return;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final void loadSensitiveParameters() {
/*
r9 = this;
java.lang.String r0 = "value"
java.lang.String r1 = "key"
boolean r2 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r9)
if (r2 == 0) goto Lb
return
Lb:
com.facebook.internal.FetchedAppSettingsManager r2 = com.facebook.internal.FetchedAppSettingsManager.INSTANCE // Catch: java.lang.Throwable -> L6b
java.lang.String r2 = com.facebook.FacebookSdk.getApplicationId() // Catch: java.lang.Throwable -> L6b
r3 = 0
com.facebook.internal.FetchedAppSettings r2 = com.facebook.internal.FetchedAppSettingsManager.queryAppSettings(r2, r3) // Catch: java.lang.Throwable -> L6b
if (r2 != 0) goto L19
return
L19:
java.util.HashSet r4 = new java.util.HashSet // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
r4.<init>() // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
com.facebook.appevents.integrity.SensitiveParamsManager.defaultSensitiveParameters = r4 // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
java.util.HashMap r4 = new java.util.HashMap // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
r4.<init>() // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
com.facebook.appevents.integrity.SensitiveParamsManager.sensitiveParameters = r4 // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
org.json.JSONArray r2 = r2.getSensitiveParams() // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
if (r2 == 0) goto L7c
int r4 = r2.length() // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
if (r4 == 0) goto L7c
int r4 = r2.length() // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
if (r4 <= 0) goto L7c
L39:
int r5 = r3 + 1
org.json.JSONObject r3 = r2.getJSONObject(r3) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
boolean r6 = r3.has(r1) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
boolean r7 = r3.has(r0) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
if (r6 == 0) goto L77
if (r7 == 0) goto L77
java.lang.String r6 = r3.getString(r1) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
org.json.JSONArray r3 = r3.getJSONArray(r0) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
if (r6 != 0) goto L56
goto L77
L56:
if (r3 != 0) goto L59
goto L77
L59:
java.util.HashSet r3 = com.facebook.internal.Utility.convertJSONArrayToHashSet(r3) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
if (r3 != 0) goto L60
goto L77
L60:
java.lang.String r7 = "_MTSDK_Default_"
boolean r7 = r6.equals(r7) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
if (r7 == 0) goto L6d
com.facebook.appevents.integrity.SensitiveParamsManager.defaultSensitiveParameters = r3 // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
goto L77
L6b:
r0 = move-exception
goto L7d
L6d:
java.util.Map<java.lang.String, java.util.HashSet<java.lang.String>> r7 = com.facebook.appevents.integrity.SensitiveParamsManager.sensitiveParameters // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
java.lang.String r8 = "sensitiveParamsScope"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r6, r8) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
r7.put(r6, r3) // Catch: java.lang.Throwable -> L6b java.lang.Exception -> L7c
L77:
if (r5 < r4) goto L7a
goto L7c
L7a:
r3 = r5
goto L39
L7c:
return
L7d:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r0, r9)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.integrity.SensitiveParamsManager.loadSensitiveParameters():void");
}
/* JADX WARN: Can't wrap try/catch for region: R(11:9|(9:11|(1:13)|14|15|16|(4:19|(3:21|22|23)(1:25)|24|17)|26|27|(2:29|30)(1:32))|35|(1:37)|14|15|16|(1:17)|26|27|(0)(0)) */
/* JADX WARN: Removed duplicated region for block: B:19:0x004e A[Catch: all -> 0x0023, Exception -> 0x0063, TryCatch #0 {all -> 0x0023, blocks: (B:6:0x0009, B:9:0x0018, B:11:0x001c, B:14:0x002e, B:16:0x0033, B:17:0x0048, B:19:0x004e, B:22:0x005c, B:27:0x0063, B:29:0x0069, B:35:0x0025), top: B:5:0x0009 }] */
/* JADX WARN: Removed duplicated region for block: B:29:0x0069 A[Catch: all -> 0x0023, TRY_LEAVE, TryCatch #0 {all -> 0x0023, blocks: (B:6:0x0009, B:9:0x0018, B:11:0x001c, B:14:0x002e, B:16:0x0033, B:17:0x0048, B:19:0x004e, B:22:0x005c, B:27:0x0063, B:29:0x0069, B:35:0x0025), top: B:5:0x0009 }] */
/* JADX WARN: Removed duplicated region for block: B:32:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final void processFilterSensitiveParams(java.util.Map<java.lang.String, java.lang.String> r5, java.lang.String r6) {
/*
java.lang.Class<com.facebook.appevents.integrity.SensitiveParamsManager> r0 = com.facebook.appevents.integrity.SensitiveParamsManager.class
boolean r1 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r0)
if (r1 == 0) goto L9
return
L9:
java.lang.String r1 = "parameters"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r5, r1) // Catch: java.lang.Throwable -> L23
java.lang.String r1 = "eventName"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r6, r1) // Catch: java.lang.Throwable -> L23
boolean r1 = com.facebook.appevents.integrity.SensitiveParamsManager.enabled // Catch: java.lang.Throwable -> L23
if (r1 != 0) goto L18
return
L18:
java.util.HashSet<java.lang.String> r1 = com.facebook.appevents.integrity.SensitiveParamsManager.defaultSensitiveParameters // Catch: java.lang.Throwable -> L23
if (r1 == 0) goto L25
boolean r1 = r1.isEmpty() // Catch: java.lang.Throwable -> L23
if (r1 == 0) goto L2e
goto L25
L23:
r5 = move-exception
goto L73
L25:
java.util.Map<java.lang.String, java.util.HashSet<java.lang.String>> r1 = com.facebook.appevents.integrity.SensitiveParamsManager.sensitiveParameters // Catch: java.lang.Throwable -> L23
boolean r1 = r1.containsKey(r6) // Catch: java.lang.Throwable -> L23
if (r1 != 0) goto L2e
return
L2e:
org.json.JSONArray r1 = new org.json.JSONArray // Catch: java.lang.Throwable -> L23
r1.<init>() // Catch: java.lang.Throwable -> L23
java.util.Map<java.lang.String, java.util.HashSet<java.lang.String>> r2 = com.facebook.appevents.integrity.SensitiveParamsManager.sensitiveParameters // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
java.lang.Object r6 = r2.get(r6) // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
java.util.HashSet r6 = (java.util.HashSet) r6 // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
java.util.ArrayList r2 = new java.util.ArrayList // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
java.util.Set r3 = r5.keySet() // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
r2.<init>(r3) // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
java.util.Iterator r2 = r2.iterator() // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
L48:
boolean r3 = r2.hasNext() // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
if (r3 == 0) goto L63
java.lang.Object r3 = r2.next() // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
java.lang.String r3 = (java.lang.String) r3 // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
com.facebook.appevents.integrity.SensitiveParamsManager r4 = com.facebook.appevents.integrity.SensitiveParamsManager.INSTANCE // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
boolean r4 = r4.shouldFilterOut(r3, r6) // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
if (r4 == 0) goto L48
r5.remove(r3) // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
r1.put(r3) // Catch: java.lang.Throwable -> L23 java.lang.Exception -> L63
goto L48
L63:
int r6 = r1.length() // Catch: java.lang.Throwable -> L23
if (r6 <= 0) goto L72
java.lang.String r6 = "_filteredKey"
java.lang.String r1 = r1.toString() // Catch: java.lang.Throwable -> L23
r5.put(r6, r1) // Catch: java.lang.Throwable -> L23
L72:
return
L73:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r5, r0)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.integrity.SensitiveParamsManager.processFilterSensitiveParams(java.util.Map, java.lang.String):void");
}
private final boolean shouldFilterOut(String str, HashSet<String> hashSet) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
if (!defaultSensitiveParameters.contains(str)) {
if (hashSet != null && !hashSet.isEmpty()) {
if (!hashSet.contains(str)) {
return false;
}
}
return false;
}
return true;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
}

View File

@@ -0,0 +1,372 @@
package com.facebook.appevents.internal;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.appevents.aam.MetadataIndexer;
import com.facebook.appevents.codeless.CodelessManager;
import com.facebook.appevents.iap.InAppPurchaseManager;
import com.facebook.appevents.suggestedevents.SuggestedEventsManager;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import java.lang.ref.WeakReference;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ActivityLifecycleTracker {
private static final String INCORRECT_IMPL_WARNING = "Unexpected activity pause without a matching activity resume. Logging data may be incorrect. Make sure you call activateApp from your Application's onCreate method";
public static final ActivityLifecycleTracker INSTANCE = new ActivityLifecycleTracker();
private static final long INTERRUPTION_THRESHOLD_MILLISECONDS = 1000;
private static final String TAG;
private static int activityReferences;
private static String appId;
private static WeakReference<Activity> currActivity;
private static long currentActivityAppearTime;
private static volatile ScheduledFuture<?> currentFuture;
private static final Object currentFutureLock;
private static volatile SessionInfo currentSession;
private static final AtomicInteger foregroundActivityCount;
private static final ScheduledExecutorService singleThreadExecutor;
private static final AtomicBoolean tracking;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final boolean isInBackground() {
return activityReferences == 0;
}
private ActivityLifecycleTracker() {
}
static {
String canonicalName = ActivityLifecycleTracker.class.getCanonicalName();
if (canonicalName == null) {
canonicalName = "com.facebook.appevents.internal.ActivityLifecycleTracker";
}
TAG = canonicalName;
singleThreadExecutor = Executors.newSingleThreadScheduledExecutor();
currentFutureLock = new Object();
foregroundActivityCount = new AtomicInteger(0);
tracking = new AtomicBoolean(false);
}
public static final void startTracking(Application application, String str) {
Intrinsics.checkNotNullParameter(application, "application");
if (tracking.compareAndSet(false, true)) {
FeatureManager featureManager = FeatureManager.INSTANCE;
FeatureManager.checkFeature(FeatureManager.Feature.CodelessEvents, new FeatureManager.Callback() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker$$ExternalSyntheticLambda3
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
ActivityLifecycleTracker.m511startTracking$lambda0(z);
}
});
appId = str;
application.registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker$startTracking$2
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
String str2;
Intrinsics.checkNotNullParameter(activity, "activity");
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
str2 = ActivityLifecycleTracker.TAG;
companion.log(loggingBehavior, str2, "onActivityCreated");
AppEventUtility.assertIsMainThread();
ActivityLifecycleTracker.onActivityCreated(activity);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
int i;
String str2;
Intrinsics.checkNotNullParameter(activity, "activity");
i = ActivityLifecycleTracker.activityReferences;
ActivityLifecycleTracker.activityReferences = i + 1;
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
str2 = ActivityLifecycleTracker.TAG;
companion.log(loggingBehavior, str2, "onActivityStarted");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
String str2;
Intrinsics.checkNotNullParameter(activity, "activity");
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
str2 = ActivityLifecycleTracker.TAG;
companion.log(loggingBehavior, str2, "onActivityResumed");
AppEventUtility.assertIsMainThread();
ActivityLifecycleTracker.onActivityResumed(activity);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
String str2;
Intrinsics.checkNotNullParameter(activity, "activity");
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
str2 = ActivityLifecycleTracker.TAG;
companion.log(loggingBehavior, str2, "onActivityPaused");
AppEventUtility.assertIsMainThread();
ActivityLifecycleTracker.INSTANCE.onActivityPaused(activity);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
String str2;
int i;
Intrinsics.checkNotNullParameter(activity, "activity");
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
str2 = ActivityLifecycleTracker.TAG;
companion.log(loggingBehavior, str2, "onActivityStopped");
AppEventsLogger.Companion.onContextStop();
i = ActivityLifecycleTracker.activityReferences;
ActivityLifecycleTracker.activityReferences = i - 1;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
String str2;
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(outState, "outState");
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
str2 = ActivityLifecycleTracker.TAG;
companion.log(loggingBehavior, str2, "onActivitySaveInstanceState");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
String str2;
Intrinsics.checkNotNullParameter(activity, "activity");
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
str2 = ActivityLifecycleTracker.TAG;
companion.log(loggingBehavior, str2, "onActivityDestroyed");
ActivityLifecycleTracker.INSTANCE.onActivityDestroyed(activity);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: startTracking$lambda-0, reason: not valid java name */
public static final void m511startTracking$lambda0(boolean z) {
if (z) {
CodelessManager.enable();
} else {
CodelessManager.disable();
}
}
public static final boolean isTracking() {
return tracking.get();
}
public static final UUID getCurrentSessionGuid() {
SessionInfo sessionInfo;
if (currentSession == null || (sessionInfo = currentSession) == null) {
return null;
}
return sessionInfo.getSessionId();
}
public static final void onActivityCreated(Activity activity) {
singleThreadExecutor.execute(new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker$$ExternalSyntheticLambda4
@Override // java.lang.Runnable
public final void run() {
ActivityLifecycleTracker.m507onActivityCreated$lambda1();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityCreated$lambda-1, reason: not valid java name */
public static final void m507onActivityCreated$lambda1() {
if (currentSession == null) {
currentSession = SessionInfo.Companion.getStoredSessionInfo();
}
}
public static final void onActivityResumed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
currActivity = new WeakReference<>(activity);
foregroundActivityCount.incrementAndGet();
INSTANCE.cancelCurrentTask();
final long currentTimeMillis = System.currentTimeMillis();
currentActivityAppearTime = currentTimeMillis;
final String activityName = Utility.getActivityName(activity);
CodelessManager.onActivityResumed(activity);
MetadataIndexer.onActivityResumed(activity);
SuggestedEventsManager.trackActivity(activity);
InAppPurchaseManager.startTracking();
final Context applicationContext = activity.getApplicationContext();
singleThreadExecutor.execute(new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
ActivityLifecycleTracker.m510onActivityResumed$lambda2(currentTimeMillis, activityName, applicationContext);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityResumed$lambda-2, reason: not valid java name */
public static final void m510onActivityResumed$lambda2(long j, String activityName, Context appContext) {
SessionInfo sessionInfo;
Intrinsics.checkNotNullParameter(activityName, "$activityName");
SessionInfo sessionInfo2 = currentSession;
Long sessionLastEventTime = sessionInfo2 == null ? null : sessionInfo2.getSessionLastEventTime();
if (currentSession == null) {
currentSession = new SessionInfo(Long.valueOf(j), null, null, 4, null);
SessionLogger sessionLogger = SessionLogger.INSTANCE;
String str = appId;
Intrinsics.checkNotNullExpressionValue(appContext, "appContext");
SessionLogger.logActivateApp(activityName, null, str, appContext);
} else if (sessionLastEventTime != null) {
long longValue = j - sessionLastEventTime.longValue();
if (longValue > INSTANCE.getSessionTimeoutInSeconds() * 1000) {
SessionLogger sessionLogger2 = SessionLogger.INSTANCE;
SessionLogger.logDeactivateApp(activityName, currentSession, appId);
String str2 = appId;
Intrinsics.checkNotNullExpressionValue(appContext, "appContext");
SessionLogger.logActivateApp(activityName, null, str2, appContext);
currentSession = new SessionInfo(Long.valueOf(j), null, null, 4, null);
} else if (longValue > 1000 && (sessionInfo = currentSession) != null) {
sessionInfo.incrementInterruptionCount();
}
}
SessionInfo sessionInfo3 = currentSession;
if (sessionInfo3 != null) {
sessionInfo3.setSessionLastEventTime(Long.valueOf(j));
}
SessionInfo sessionInfo4 = currentSession;
if (sessionInfo4 == null) {
return;
}
sessionInfo4.writeSessionToDisk();
}
/* JADX INFO: Access modifiers changed from: private */
public final void onActivityPaused(Activity activity) {
AtomicInteger atomicInteger = foregroundActivityCount;
if (atomicInteger.decrementAndGet() < 0) {
atomicInteger.set(0);
Log.w(TAG, INCORRECT_IMPL_WARNING);
}
cancelCurrentTask();
final long currentTimeMillis = System.currentTimeMillis();
final String activityName = Utility.getActivityName(activity);
CodelessManager.onActivityPaused(activity);
singleThreadExecutor.execute(new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ActivityLifecycleTracker.m508onActivityPaused$lambda6(currentTimeMillis, activityName);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityPaused$lambda-6, reason: not valid java name */
public static final void m508onActivityPaused$lambda6(final long j, final String activityName) {
Intrinsics.checkNotNullParameter(activityName, "$activityName");
if (currentSession == null) {
currentSession = new SessionInfo(Long.valueOf(j), null, null, 4, null);
}
SessionInfo sessionInfo = currentSession;
if (sessionInfo != null) {
sessionInfo.setSessionLastEventTime(Long.valueOf(j));
}
if (foregroundActivityCount.get() <= 0) {
Runnable runnable = new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ActivityLifecycleTracker.m509onActivityPaused$lambda6$lambda4(j, activityName);
}
};
synchronized (currentFutureLock) {
currentFuture = singleThreadExecutor.schedule(runnable, INSTANCE.getSessionTimeoutInSeconds(), TimeUnit.SECONDS);
Unit unit = Unit.INSTANCE;
}
}
long j2 = currentActivityAppearTime;
AutomaticAnalyticsLogger.logActivityTimeSpentEvent(activityName, j2 > 0 ? (j - j2) / 1000 : 0L);
SessionInfo sessionInfo2 = currentSession;
if (sessionInfo2 == null) {
return;
}
sessionInfo2.writeSessionToDisk();
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityPaused$lambda-6$lambda-4, reason: not valid java name */
public static final void m509onActivityPaused$lambda6$lambda4(long j, String activityName) {
Intrinsics.checkNotNullParameter(activityName, "$activityName");
if (currentSession == null) {
currentSession = new SessionInfo(Long.valueOf(j), null, null, 4, null);
}
if (foregroundActivityCount.get() <= 0) {
SessionLogger sessionLogger = SessionLogger.INSTANCE;
SessionLogger.logDeactivateApp(activityName, currentSession, appId);
SessionInfo.Companion.clearSavedSessionFromDisk();
currentSession = null;
}
synchronized (currentFutureLock) {
currentFuture = null;
Unit unit = Unit.INSTANCE;
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void onActivityDestroyed(Activity activity) {
CodelessManager.onActivityDestroyed(activity);
}
private final int getSessionTimeoutInSeconds() {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettings appSettingsWithoutQuery = FetchedAppSettingsManager.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
if (appSettingsWithoutQuery == null) {
return Constants.getDefaultAppEventsSessionTimeoutInSeconds();
}
return appSettingsWithoutQuery.getSessionTimeoutInSeconds();
}
private final void cancelCurrentTask() {
ScheduledFuture<?> scheduledFuture;
synchronized (currentFutureLock) {
try {
if (currentFuture != null && (scheduledFuture = currentFuture) != null) {
scheduledFuture.cancel(false);
}
currentFuture = null;
Unit unit = Unit.INSTANCE;
} catch (Throwable th) {
throw th;
}
}
}
public static final Activity getCurrentActivity() {
WeakReference<Activity> weakReference = currActivity;
if (weakReference == null || weakReference == null) {
return null;
}
return weakReference.get();
}
}

View File

@@ -0,0 +1,161 @@
package com.facebook.appevents.internal;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Looper;
import android.view.View;
import android.view.Window;
import com.facebook.FacebookSdk;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
/* loaded from: classes2.dex */
public final class AppEventUtility {
public static final AppEventUtility INSTANCE = new AppEventUtility();
private static final String PRICE_REGEX = "[-+]*\\d+([.,]\\d+)*([.,]\\d+)?";
public static final void assertIsMainThread() {
}
public static final void assertIsNotMainThread() {
}
private AppEventUtility() {
}
public static final double normalizePrice(String str) {
try {
Matcher matcher = Pattern.compile(PRICE_REGEX, 8).matcher(str);
if (!matcher.find()) {
return 0.0d;
}
return NumberFormat.getNumberInstance(Utility.getCurrentLocale()).parse(matcher.group(0)).doubleValue();
} catch (ParseException unused) {
return 0.0d;
}
}
public static final String bytesToHex(byte[] bytes) {
Intrinsics.checkNotNullParameter(bytes, "bytes");
StringBuffer stringBuffer = new StringBuffer();
int length = bytes.length;
int i = 0;
while (i < length) {
byte b = bytes[i];
i++;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%02x", Arrays.copyOf(new Object[]{Byte.valueOf(b)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
stringBuffer.append(format);
}
String stringBuffer2 = stringBuffer.toString();
Intrinsics.checkNotNullExpressionValue(stringBuffer2, "sb.toString()");
return stringBuffer2;
}
/* JADX WARN: Code restructure failed: missing block: B:16:0x0069, code lost:
if (kotlin.text.StringsKt__StringsJVMKt.startsWith$default(r0, "generic", false, 2, null) == false) goto L18;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final boolean isEmulator() {
/*
java.lang.String r0 = android.os.Build.FINGERPRINT
java.lang.String r1 = "FINGERPRINT"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
java.lang.String r2 = "generic"
r3 = 0
r4 = 2
r5 = 0
boolean r6 = kotlin.text.StringsKt.startsWith$default(r0, r2, r3, r4, r5)
if (r6 != 0) goto L73
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
java.lang.String r1 = "unknown"
boolean r0 = kotlin.text.StringsKt.startsWith$default(r0, r1, r3, r4, r5)
if (r0 != 0) goto L73
java.lang.String r0 = android.os.Build.MODEL
java.lang.String r1 = "MODEL"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
java.lang.String r6 = "google_sdk"
boolean r7 = kotlin.text.StringsKt.contains$default(r0, r6, r3, r4, r5)
if (r7 != 0) goto L73
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
java.lang.String r7 = "Emulator"
boolean r7 = kotlin.text.StringsKt.contains$default(r0, r7, r3, r4, r5)
if (r7 != 0) goto L73
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
java.lang.String r1 = "Android SDK built for x86"
boolean r0 = kotlin.text.StringsKt.contains$default(r0, r1, r3, r4, r5)
if (r0 != 0) goto L73
java.lang.String r0 = android.os.Build.MANUFACTURER
java.lang.String r1 = "MANUFACTURER"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
java.lang.String r1 = "Genymotion"
boolean r0 = kotlin.text.StringsKt.contains$default(r0, r1, r3, r4, r5)
if (r0 != 0) goto L73
java.lang.String r0 = android.os.Build.BRAND
java.lang.String r1 = "BRAND"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
boolean r0 = kotlin.text.StringsKt.startsWith$default(r0, r2, r3, r4, r5)
if (r0 == 0) goto L6b
java.lang.String r0 = android.os.Build.DEVICE
java.lang.String r1 = "DEVICE"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
boolean r0 = kotlin.text.StringsKt.startsWith$default(r0, r2, r3, r4, r5)
if (r0 != 0) goto L73
L6b:
java.lang.String r0 = android.os.Build.PRODUCT
boolean r0 = kotlin.jvm.internal.Intrinsics.areEqual(r6, r0)
if (r0 == 0) goto L74
L73:
r3 = 1
L74:
return r3
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.internal.AppEventUtility.isEmulator():boolean");
}
private static final boolean isMainThread() {
return Intrinsics.areEqual(Looper.myLooper(), Looper.getMainLooper());
}
public static final String getAppVersion() {
Context applicationContext = FacebookSdk.getApplicationContext();
try {
String str = applicationContext.getPackageManager().getPackageInfo(applicationContext.getPackageName(), 0).versionName;
Intrinsics.checkNotNullExpressionValue(str, "{\n val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)\n packageInfo.versionName\n }");
return str;
} catch (PackageManager.NameNotFoundException unused) {
return "";
}
}
public static final View getRootView(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(AppEventUtility.class) || activity == null) {
return null;
}
try {
Window window = activity.getWindow();
if (window == null) {
return null;
}
return window.getDecorView().getRootView();
} catch (Exception unused) {
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppEventUtility.class);
return null;
}
}
}

View File

@@ -0,0 +1,71 @@
package com.facebook.appevents.internal;
import android.content.Context;
import androidx.core.app.NotificationCompat;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.internal.AttributionIdentifiers;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class AppEventsLoggerUtility {
private static final Map<GraphAPIActivityType, String> API_ACTIVITY_TYPE_TO_STRING;
public static final AppEventsLoggerUtility INSTANCE = new AppEventsLoggerUtility();
private AppEventsLoggerUtility() {
}
static {
HashMap hashMapOf;
hashMapOf = MapsKt__MapsKt.hashMapOf(TuplesKt.to(GraphAPIActivityType.MOBILE_INSTALL_EVENT, "MOBILE_APP_INSTALL"), TuplesKt.to(GraphAPIActivityType.CUSTOM_APP_EVENTS, "CUSTOM_APP_EVENTS"));
API_ACTIVITY_TYPE_TO_STRING = hashMapOf;
}
public static final JSONObject getJSONObjectForGraphAPICall(GraphAPIActivityType activityType, AttributionIdentifiers attributionIdentifiers, String str, boolean z, Context context) throws JSONException {
Intrinsics.checkNotNullParameter(activityType, "activityType");
Intrinsics.checkNotNullParameter(context, "context");
JSONObject jSONObject = new JSONObject();
jSONObject.put(NotificationCompat.CATEGORY_EVENT, API_ACTIVITY_TYPE_TO_STRING.get(activityType));
String userID = AppEventsLogger.Companion.getUserID();
if (userID != null) {
jSONObject.put("app_user_id", userID);
}
Utility.setAppEventAttributionParameters(jSONObject, attributionIdentifiers, str, z, context);
try {
Utility.setAppEventExtendedDeviceInfoParameters(jSONObject, context);
} catch (Exception e) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, "AppEvents", "Fetching extended device info parameters failed: '%s'", e.toString());
}
JSONObject dataProcessingOptions = Utility.getDataProcessingOptions();
if (dataProcessingOptions != null) {
Iterator<String> keys = dataProcessingOptions.keys();
while (keys.hasNext()) {
String next = keys.next();
jSONObject.put(next, dataProcessingOptions.get(next));
}
}
jSONObject.put("application_package_name", context.getPackageName());
return jSONObject;
}
public enum GraphAPIActivityType {
MOBILE_INSTALL_EVENT,
CUSTOM_APP_EVENTS;
/* renamed from: values, reason: to resolve conflict with enum method */
public static GraphAPIActivityType[] valuesCustom() {
GraphAPIActivityType[] valuesCustom = values();
return (GraphAPIActivityType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
}

View File

@@ -0,0 +1,166 @@
package com.facebook.appevents.internal;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.appevents.iap.InAppPurchaseEventManager;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.internal.FetchedAppGateKeepersManager;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.firemonkeys.cloudcellapi.Consts;
import com.unity3d.ads.core.domain.HandleInvocationsFromAdViewer;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.math.BigDecimal;
import java.util.Currency;
import java.util.HashMap;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class AutomaticAnalyticsLogger {
private static final String APP_EVENTS_IF_AUTO_LOG_SUBS = "app_events_if_auto_log_subs";
public static final AutomaticAnalyticsLogger INSTANCE = new AutomaticAnalyticsLogger();
private static final String TAG = AutomaticAnalyticsLogger.class.getCanonicalName();
private static final InternalAppEventsLogger internalAppEventsLogger = new InternalAppEventsLogger(FacebookSdk.getApplicationContext());
private AutomaticAnalyticsLogger() {
}
public static final void logActivateAppEvent() {
Context applicationContext = FacebookSdk.getApplicationContext();
String applicationId = FacebookSdk.getApplicationId();
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
if (applicationContext instanceof Application) {
AppEventsLogger.Companion.activateApp((Application) applicationContext, applicationId);
} else {
Log.w(TAG, "Automatic logging of basic events will not happen, because FacebookSdk.getApplicationContext() returns object that is not instance of android.app.Application. Make sure you call FacebookSdk.sdkInitialize() from Application class and pass application context.");
}
}
}
public static final void logActivityTimeSpentEvent(String str, long j) {
Context applicationContext = FacebookSdk.getApplicationContext();
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings == null || !queryAppSettings.getAutomaticLoggingEnabled() || j <= 0) {
return;
}
InternalAppEventsLogger internalAppEventsLogger2 = new InternalAppEventsLogger(applicationContext);
Bundle bundle = new Bundle(1);
bundle.putCharSequence(Constants.AA_TIME_SPENT_SCREEN_PARAMETER_NAME, str);
internalAppEventsLogger2.logEvent(Constants.AA_TIME_SPENT_EVENT_NAME, j, bundle);
}
public static final void logPurchase(String purchase, String skuDetails, boolean z) {
PurchaseLoggingParameters purchaseLoggingParameters;
Intrinsics.checkNotNullParameter(purchase, "purchase");
Intrinsics.checkNotNullParameter(skuDetails, "skuDetails");
if (isImplicitPurchaseLoggingEnabled() && (purchaseLoggingParameters = INSTANCE.getPurchaseLoggingParameters(purchase, skuDetails)) != null) {
if (z) {
FetchedAppGateKeepersManager fetchedAppGateKeepersManager = FetchedAppGateKeepersManager.INSTANCE;
if (FetchedAppGateKeepersManager.getGateKeeperForKey(APP_EVENTS_IF_AUTO_LOG_SUBS, FacebookSdk.getApplicationId(), false)) {
internalAppEventsLogger.logEventImplicitly(InAppPurchaseEventManager.INSTANCE.hasFreeTrialPeirod(skuDetails) ? AppEventsConstants.EVENT_NAME_START_TRIAL : AppEventsConstants.EVENT_NAME_SUBSCRIBE, purchaseLoggingParameters.getPurchaseAmount(), purchaseLoggingParameters.getCurrency(), purchaseLoggingParameters.getParam());
return;
}
}
internalAppEventsLogger.logPurchaseImplicitly(purchaseLoggingParameters.getPurchaseAmount(), purchaseLoggingParameters.getCurrency(), purchaseLoggingParameters.getParam());
}
}
public static final boolean isImplicitPurchaseLoggingEnabled() {
FetchedAppSettings appSettingsWithoutQuery = FetchedAppSettingsManager.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
return appSettingsWithoutQuery != null && FacebookSdk.getAutoLogAppEventsEnabled() && appSettingsWithoutQuery.getIAPAutomaticLoggingEnabled();
}
private final PurchaseLoggingParameters getPurchaseLoggingParameters(String str, String str2) {
return getPurchaseLoggingParameters(str, str2, new HashMap());
}
private final PurchaseLoggingParameters getPurchaseLoggingParameters(String str, String str2, Map<String, String> map) {
try {
JSONObject jSONObject = new JSONObject(str);
JSONObject jSONObject2 = new JSONObject(str2);
Bundle bundle = new Bundle(1);
bundle.putCharSequence(Constants.IAP_PRODUCT_ID, jSONObject.getString(InAppPurchaseMetaData.KEY_PRODUCT_ID));
bundle.putCharSequence(Constants.IAP_PURCHASE_TIME, jSONObject.getString("purchaseTime"));
bundle.putCharSequence(Constants.IAP_PURCHASE_TOKEN, jSONObject.getString(SDKConstants.PARAM_PURCHASE_TOKEN));
bundle.putCharSequence(Constants.IAP_PACKAGE_NAME, jSONObject.optString(HandleInvocationsFromAdViewer.KEY_PACKAGE_NAME));
bundle.putCharSequence(Constants.IAP_PRODUCT_TITLE, jSONObject2.optString("title"));
bundle.putCharSequence(Constants.IAP_PRODUCT_DESCRIPTION, jSONObject2.optString("description"));
String optString = jSONObject2.optString("type");
bundle.putCharSequence(Constants.IAP_PRODUCT_TYPE, optString);
if (Intrinsics.areEqual(optString, Consts.ITEM_TYPE_SUBSCRIPTION)) {
bundle.putCharSequence(Constants.IAP_SUBSCRIPTION_AUTORENEWING, Boolean.toString(jSONObject.optBoolean("autoRenewing", false)));
bundle.putCharSequence(Constants.IAP_SUBSCRIPTION_PERIOD, jSONObject2.optString("subscriptionPeriod"));
bundle.putCharSequence(Constants.IAP_FREE_TRIAL_PERIOD, jSONObject2.optString("freeTrialPeriod"));
String introductoryPriceCycles = jSONObject2.optString("introductoryPriceCycles");
Intrinsics.checkNotNullExpressionValue(introductoryPriceCycles, "introductoryPriceCycles");
if (introductoryPriceCycles.length() != 0) {
bundle.putCharSequence(Constants.IAP_INTRO_PRICE_AMOUNT_MICROS, jSONObject2.optString("introductoryPriceAmountMicros"));
bundle.putCharSequence(Constants.IAP_INTRO_PRICE_CYCLES, introductoryPriceCycles);
}
}
for (Map.Entry<String, String> entry : map.entrySet()) {
bundle.putCharSequence(entry.getKey(), entry.getValue());
}
BigDecimal bigDecimal = new BigDecimal(jSONObject2.getLong("price_amount_micros") / 1000000.0d);
Currency currency = Currency.getInstance(jSONObject2.getString("price_currency_code"));
Intrinsics.checkNotNullExpressionValue(currency, "getInstance(skuDetailsJSON.getString(\"price_currency_code\"))");
return new PurchaseLoggingParameters(bigDecimal, currency, bundle);
} catch (JSONException e) {
Log.e(TAG, "Error parsing in-app subscription data.", e);
return null;
}
}
public static final class PurchaseLoggingParameters {
private Currency currency;
private Bundle param;
private BigDecimal purchaseAmount;
public final Currency getCurrency() {
return this.currency;
}
public final Bundle getParam() {
return this.param;
}
public final BigDecimal getPurchaseAmount() {
return this.purchaseAmount;
}
public final void setCurrency(Currency currency) {
Intrinsics.checkNotNullParameter(currency, "<set-?>");
this.currency = currency;
}
public final void setParam(Bundle bundle) {
Intrinsics.checkNotNullParameter(bundle, "<set-?>");
this.param = bundle;
}
public final void setPurchaseAmount(BigDecimal bigDecimal) {
Intrinsics.checkNotNullParameter(bigDecimal, "<set-?>");
this.purchaseAmount = bigDecimal;
}
public PurchaseLoggingParameters(BigDecimal purchaseAmount, Currency currency, Bundle param) {
Intrinsics.checkNotNullParameter(purchaseAmount, "purchaseAmount");
Intrinsics.checkNotNullParameter(currency, "currency");
Intrinsics.checkNotNullParameter(param, "param");
this.purchaseAmount = purchaseAmount;
this.currency = currency;
this.param = param;
}
}
}

View File

@@ -0,0 +1,42 @@
package com.facebook.appevents.internal;
/* loaded from: classes2.dex */
public final class Constants {
public static final String AA_TIME_SPENT_EVENT_NAME = "fb_aa_time_spent_on_view";
public static final String AA_TIME_SPENT_SCREEN_PARAMETER_NAME = "fb_aa_time_spent_view_name";
public static final String EVENT_NAME_EVENT_KEY = "_eventName";
public static final String EVENT_NAME_MD5_EVENT_KEY = "_eventName_md5";
public static final String EVENT_PARAM_PRODUCT_AVAILABILITY = "fb_product_availability";
public static final String EVENT_PARAM_PRODUCT_BRAND = "fb_product_brand";
public static final String EVENT_PARAM_PRODUCT_CONDITION = "fb_product_condition";
public static final String EVENT_PARAM_PRODUCT_DESCRIPTION = "fb_product_description";
public static final String EVENT_PARAM_PRODUCT_GTIN = "fb_product_gtin";
public static final String EVENT_PARAM_PRODUCT_IMAGE_LINK = "fb_product_image_link";
public static final String EVENT_PARAM_PRODUCT_ITEM_ID = "fb_product_item_id";
public static final String EVENT_PARAM_PRODUCT_LINK = "fb_product_link";
public static final String EVENT_PARAM_PRODUCT_MPN = "fb_product_mpn";
public static final String EVENT_PARAM_PRODUCT_PRICE_AMOUNT = "fb_product_price_amount";
public static final String EVENT_PARAM_PRODUCT_PRICE_CURRENCY = "fb_product_price_currency";
public static final String EVENT_PARAM_PRODUCT_TITLE = "fb_product_title";
public static final String IAP_FREE_TRIAL_PERIOD = "fb_free_trial_period";
public static final String IAP_INTRO_PRICE_AMOUNT_MICROS = "fb_intro_price_amount_micros";
public static final String IAP_INTRO_PRICE_CYCLES = "fb_intro_price_cycles";
public static final String IAP_PACKAGE_NAME = "fb_iap_package_name";
public static final String IAP_PRODUCT_DESCRIPTION = "fb_iap_product_description";
public static final String IAP_PRODUCT_ID = "fb_iap_product_id";
public static final String IAP_PRODUCT_TITLE = "fb_iap_product_title";
public static final String IAP_PRODUCT_TYPE = "fb_iap_product_type";
public static final String IAP_PURCHASE_TIME = "fb_iap_purchase_time";
public static final String IAP_PURCHASE_TOKEN = "fb_iap_purchase_token";
public static final String IAP_SUBSCRIPTION_AUTORENEWING = "fb_iap_subs_auto_renewing";
public static final String IAP_SUBSCRIPTION_PERIOD = "fb_iap_subs_period";
public static final Constants INSTANCE = new Constants();
public static final String LOG_TIME_APP_EVENT_KEY = "_logTime";
public static final int getDefaultAppEventsSessionTimeoutInSeconds() {
return 60;
}
private Constants() {
}
}

View File

@@ -0,0 +1,157 @@
package com.facebook.appevents.internal;
import android.os.AsyncTask;
import androidx.annotation.VisibleForTesting;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.net.URL;
import java.net.URLConnection;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class FileDownloadTask extends AsyncTask<String, Void, Boolean> {
private final File destFile;
private final Callback onSuccess;
private final String uriStr;
public interface Callback {
void onComplete(File file);
}
@Override // android.os.AsyncTask
public /* bridge */ /* synthetic */ Boolean doInBackground(String[] strArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return doInBackground2(strArr);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
return null;
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
return null;
}
}
@Override // android.os.AsyncTask
public /* bridge */ /* synthetic */ void onPostExecute(Boolean bool) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
onPostExecute(bool.booleanValue());
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
}
}
public FileDownloadTask(String uriStr, File destFile, Callback onSuccess) {
Intrinsics.checkNotNullParameter(uriStr, "uriStr");
Intrinsics.checkNotNullParameter(destFile, "destFile");
Intrinsics.checkNotNullParameter(onSuccess, "onSuccess");
this.uriStr = uriStr;
this.destFile = destFile;
this.onSuccess = onSuccess;
}
@VisibleForTesting(otherwise = 4)
/* renamed from: doInBackground, reason: avoid collision after fix types in other method */
public Boolean doInBackground2(String... args) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(args, "args");
try {
URL url = new URL(this.uriStr);
int contentLength = ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection())).getContentLength();
DataInputStream dataInputStream = new DataInputStream(FirebasePerfUrlConnection.openStream(url));
byte[] bArr = new byte[contentLength];
dataInputStream.readFully(bArr);
dataInputStream.close();
DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(this.destFile));
dataOutputStream.write(bArr);
dataOutputStream.flush();
dataOutputStream.close();
return Boolean.TRUE;
} catch (Exception unused) {
return Boolean.FALSE;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
return null;
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
return null;
}
}
public void onPostExecute(boolean z) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (!CrashShieldHandler.isObjectCrashing(this) && z) {
try {
this.onSuccess.onComplete(this.destFile);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
}
}
}

View File

@@ -0,0 +1,142 @@
package com.facebook.appevents.internal;
import android.content.Context;
import android.content.pm.PackageManager;
import android.util.Base64;
import com.unity3d.ads.core.data.datasource.AndroidStaticDeviceInfoDataSource;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.cert.CertificateFactory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.io.CloseableKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
/* loaded from: classes2.dex */
public final class HashUtils {
private static final int BUFFER_SIZE = 1024;
private static final String MD5 = "MD5";
public static final HashUtils INSTANCE = new HashUtils();
private static final String TAG = HashUtils.class.getSimpleName();
private static final String[] TRUSTED_CERTS = {"MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK", "MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs="};
private HashUtils() {
}
public static final String computeChecksum(String str) throws Exception {
return INSTANCE.computeFileMd5(new File(str));
}
private final String computeFileMd5(File file) throws Exception {
int read;
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file), 1024);
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] bArr = new byte[1024];
do {
read = bufferedInputStream.read(bArr);
if (read > 0) {
messageDigest.update(bArr, 0, read);
}
} while (read != -1);
String bigInteger = new BigInteger(1, messageDigest.digest()).toString(16);
Intrinsics.checkNotNullExpressionValue(bigInteger, "BigInteger(1, md.digest()).toString(16)");
CloseableKt.closeFinally(bufferedInputStream, null);
return bigInteger;
} finally {
}
}
/* JADX WARN: Multi-variable type inference failed */
public static final String computeChecksumWithPackageManager(Context context, Long l) {
Intrinsics.checkNotNullParameter(context, "context");
CertificateFactory certificateFactory = CertificateFactory.getInstance(AndroidStaticDeviceInfoDataSource.CERTIFICATE_TYPE_X509);
String[] strArr = TRUSTED_CERTS;
ArrayList arrayList = new ArrayList(strArr.length);
for (String str : strArr) {
arrayList.add(certificateFactory.generateCertificate(new ByteArrayInputStream(Base64.decode(str, 0))));
}
List mutableList = CollectionsKt___CollectionsKt.toMutableList((Collection) arrayList);
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
final ReentrantLock reentrantLock = new ReentrantLock();
final Condition newCondition = reentrantLock.newCondition();
reentrantLock.lock();
try {
Field field = Class.forName("android.content.pm.Checksum").getField("TYPE_WHOLE_MD5");
Intrinsics.checkNotNullExpressionValue(field, "checksumClass.getField(\"TYPE_WHOLE_MD5\")");
final Object obj = field.get(null);
Class<?> cls = Class.forName("android.content.pm.PackageManager$OnChecksumsReadyListener");
Object newProxyInstance = Proxy.newProxyInstance(HashUtils.class.getClassLoader(), new Class[]{cls}, new InvocationHandler() { // from class: com.facebook.appevents.internal.HashUtils$computeChecksumWithPackageManager$listener$1
/* JADX WARN: Type inference failed for: r8v10, types: [T, java.lang.String] */
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object obj2, Method method, Object[] objects) {
String unused;
Intrinsics.checkNotNullParameter(method, "method");
Intrinsics.checkNotNullParameter(objects, "objects");
try {
if (Intrinsics.areEqual(method.getName(), "onChecksumsReady") && objects.length == 1) {
Object obj3 = objects[0];
if (obj3 instanceof List) {
for (Object obj4 : (List) obj3) {
if (obj4 != null) {
Method method2 = obj4.getClass().getMethod("getSplitName", new Class[0]);
Intrinsics.checkNotNullExpressionValue(method2, "c.javaClass.getMethod(\"getSplitName\")");
Method method3 = obj4.getClass().getMethod("getType", new Class[0]);
Intrinsics.checkNotNullExpressionValue(method3, "c.javaClass.getMethod(\"getType\")");
if (method2.invoke(obj4, new Object[0]) == null && Intrinsics.areEqual(method3.invoke(obj4, new Object[0]), obj)) {
Method method4 = obj4.getClass().getMethod("getValue", new Class[0]);
Intrinsics.checkNotNullExpressionValue(method4, "c.javaClass.getMethod(\"getValue\")");
Object invoke = method4.invoke(obj4, new Object[0]);
if (invoke == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.ByteArray");
}
objectRef.element = new BigInteger(1, (byte[]) invoke).toString(16);
reentrantLock.lock();
try {
newCondition.signalAll();
return null;
} finally {
reentrantLock.unlock();
}
}
}
}
}
}
} catch (Throwable unused2) {
unused = HashUtils.TAG;
}
return null;
}
});
Intrinsics.checkNotNullExpressionValue(newProxyInstance, "var resultChecksum: String? = null\n val lock = ReentrantLock()\n val checksumReady = lock.newCondition()\n lock.lock()\n\n try {\n val checksumClass = Class.forName(\"android.content.pm.Checksum\")\n val typeWholeMd5Field: Field = checksumClass.getField(\"TYPE_WHOLE_MD5\")\n val TYPE_WHOLE_MD5 = typeWholeMd5Field.get(null)\n val checksumReadyListenerClass =\n Class.forName(\"android.content.pm.PackageManager\\$OnChecksumsReadyListener\")\n val listener: Any =\n Proxy.newProxyInstance(\n HashUtils::class.java.classLoader,\n arrayOf(checksumReadyListenerClass),\n object : InvocationHandler {\n override operator fun invoke(o: Any?, method: Method, objects: Array<Any>): Any? {\n try {\n if (method.name == \"onChecksumsReady\" &&\n objects.size == 1 &&\n objects[0] is List<*>) {\n val list = objects[0] as List<*>\n for (c in list) {\n if (c != null) {\n val getSplitNameMethod: Method = c.javaClass.getMethod(\"getSplitName\")\n val getTypeMethod: Method = c.javaClass.getMethod(\"getType\")\n if (getSplitNameMethod.invoke(c) == null &&\n getTypeMethod.invoke(c) == TYPE_WHOLE_MD5) {\n val getValueMethod: Method = c.javaClass.getMethod(\"getValue\")\n val checksumValue = getValueMethod.invoke(c) as ByteArray\n resultChecksum = BigInteger(1, checksumValue).toString(16)\n lock.lock()\n try {\n checksumReady.signalAll()\n } finally {\n lock.unlock()\n }\n return null\n }\n }\n }\n }\n } catch (t: Throwable) {\n Log.d(TAG, \"Can't fetch checksum.\", t)\n }\n return null\n }\n })");
Method method = PackageManager.class.getMethod("requestChecksums", String.class, Boolean.TYPE, Integer.TYPE, List.class, cls);
Intrinsics.checkNotNullExpressionValue(method, "PackageManager::class\n .java\n .getMethod(\n \"requestChecksums\",\n String::class.java,\n Boolean::class.javaPrimitiveType,\n Int::class.javaPrimitiveType,\n MutableList::class.java,\n checksumReadyListenerClass)");
method.invoke(context.getPackageManager(), context.getPackageName(), Boolean.FALSE, obj, CollectionsKt___CollectionsKt.toMutableList((Collection) mutableList), newProxyInstance);
if (l == null) {
newCondition.await();
} else {
newCondition.awaitNanos(l.longValue());
}
String str2 = (String) objectRef.element;
reentrantLock.unlock();
return str2;
} catch (Throwable unused) {
reentrantLock.unlock();
return null;
}
}
}

View File

@@ -0,0 +1,175 @@
package com.facebook.appevents.internal;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.facebook.FacebookSdk;
import java.util.UUID;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class SessionInfo {
public static final Companion Companion = new Companion(null);
private static final String INTERRUPTION_COUNT_KEY = "com.facebook.appevents.SessionInfo.interruptionCount";
private static final String LAST_SESSION_INFO_END_KEY = "com.facebook.appevents.SessionInfo.sessionEndTime";
private static final String LAST_SESSION_INFO_START_KEY = "com.facebook.appevents.SessionInfo.sessionStartTime";
private static final String SESSION_ID_KEY = "com.facebook.appevents.SessionInfo.sessionId";
private Long diskRestoreTime;
private int interruptionCount;
private UUID sessionId;
private Long sessionLastEventTime;
private final Long sessionStartTime;
private SourceApplicationInfo sourceApplicationInfo;
public SessionInfo(Long l, Long l2) {
this(l, l2, null, 4, null);
}
public static final void clearSavedSessionFromDisk() {
Companion.clearSavedSessionFromDisk();
}
public static final SessionInfo getStoredSessionInfo() {
return Companion.getStoredSessionInfo();
}
public final int getInterruptionCount() {
return this.interruptionCount;
}
public final UUID getSessionId() {
return this.sessionId;
}
public final Long getSessionLastEventTime() {
return this.sessionLastEventTime;
}
public final Long getSessionStartTime() {
return this.sessionStartTime;
}
public final SourceApplicationInfo getSourceApplicationInfo() {
return this.sourceApplicationInfo;
}
public final void incrementInterruptionCount() {
this.interruptionCount++;
}
public final void setDiskRestoreTime(Long l) {
this.diskRestoreTime = l;
}
public final void setSessionId(UUID uuid) {
Intrinsics.checkNotNullParameter(uuid, "<set-?>");
this.sessionId = uuid;
}
public final void setSessionLastEventTime(Long l) {
this.sessionLastEventTime = l;
}
public final void setSourceApplicationInfo(SourceApplicationInfo sourceApplicationInfo) {
this.sourceApplicationInfo = sourceApplicationInfo;
}
public SessionInfo(Long l, Long l2, UUID sessionId) {
Intrinsics.checkNotNullParameter(sessionId, "sessionId");
this.sessionStartTime = l;
this.sessionLastEventTime = l2;
this.sessionId = sessionId;
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public /* synthetic */ SessionInfo(java.lang.Long r1, java.lang.Long r2, java.util.UUID r3, int r4, kotlin.jvm.internal.DefaultConstructorMarker r5) {
/*
r0 = this;
r4 = r4 & 4
if (r4 == 0) goto Ld
java.util.UUID r3 = java.util.UUID.randomUUID()
java.lang.String r4 = "randomUUID()"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r4)
Ld:
r0.<init>(r1, r2, r3)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.internal.SessionInfo.<init>(java.lang.Long, java.lang.Long, java.util.UUID, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
}
public final Long getDiskRestoreTime() {
Long l = this.diskRestoreTime;
if (l == null) {
return 0L;
}
return l;
}
public final long getSessionLength() {
Long l;
if (this.sessionStartTime == null || (l = this.sessionLastEventTime) == null) {
return 0L;
}
if (l != null) {
return l.longValue() - this.sessionStartTime.longValue();
}
throw new IllegalStateException("Required value was null.".toString());
}
public final void writeSessionToDisk() {
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext()).edit();
Long l = this.sessionStartTime;
edit.putLong(LAST_SESSION_INFO_START_KEY, l == null ? 0L : l.longValue());
Long l2 = this.sessionLastEventTime;
edit.putLong(LAST_SESSION_INFO_END_KEY, l2 != null ? l2.longValue() : 0L);
edit.putInt(INTERRUPTION_COUNT_KEY, this.interruptionCount);
edit.putString(SESSION_ID_KEY, this.sessionId.toString());
edit.apply();
SourceApplicationInfo sourceApplicationInfo = this.sourceApplicationInfo;
if (sourceApplicationInfo == null || sourceApplicationInfo == null) {
return;
}
sourceApplicationInfo.writeSourceApplicationInfoToDisk();
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final SessionInfo getStoredSessionInfo() {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext());
long j = defaultSharedPreferences.getLong(SessionInfo.LAST_SESSION_INFO_START_KEY, 0L);
long j2 = defaultSharedPreferences.getLong(SessionInfo.LAST_SESSION_INFO_END_KEY, 0L);
String string = defaultSharedPreferences.getString(SessionInfo.SESSION_ID_KEY, null);
if (j == 0 || j2 == 0 || string == null) {
return null;
}
SessionInfo sessionInfo = new SessionInfo(Long.valueOf(j), Long.valueOf(j2), null, 4, null);
sessionInfo.interruptionCount = defaultSharedPreferences.getInt(SessionInfo.INTERRUPTION_COUNT_KEY, 0);
sessionInfo.setSourceApplicationInfo(SourceApplicationInfo.Companion.getStoredSourceApplicatioInfo());
sessionInfo.setDiskRestoreTime(Long.valueOf(System.currentTimeMillis()));
UUID fromString = UUID.fromString(string);
Intrinsics.checkNotNullExpressionValue(fromString, "fromString(sessionIDStr)");
sessionInfo.setSessionId(fromString);
return sessionInfo;
}
public final void clearSavedSessionFromDisk() {
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext()).edit();
edit.remove(SessionInfo.LAST_SESSION_INFO_START_KEY);
edit.remove(SessionInfo.LAST_SESSION_INFO_END_KEY);
edit.remove(SessionInfo.INTERRUPTION_COUNT_KEY);
edit.remove(SessionInfo.SESSION_ID_KEY);
edit.apply();
SourceApplicationInfo.Companion.clearSavedSourceApplicationInfoFromDisk();
}
}
}

View File

@@ -0,0 +1,173 @@
package com.facebook.appevents.internal;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.work.PeriodicWorkRequest;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.internal.Logger;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.facebook.internal.security.CertificateUtil;
import com.vungle.ads.internal.signals.SignalManager;
import java.util.Arrays;
import java.util.Locale;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
/* loaded from: classes2.dex */
public final class SessionLogger {
private static final String PACKAGE_CHECKSUM = "PCKGCHKSUM";
public static final SessionLogger INSTANCE = new SessionLogger();
private static final String TAG = SessionLogger.class.getCanonicalName();
private static final long[] INACTIVE_SECONDS_QUANTA = {PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS, PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS, 1800000, 3600000, 21600000, 43200000, SignalManager.TWENTY_FOUR_HOURS_MILLIS, 172800000, 259200000, 604800000, 1209600000, 1814400000, 2419200000L, 5184000000L, 7776000000L, 10368000000L, 12960000000L, 15552000000L, 31536000000L};
private SessionLogger() {
}
public static final void logActivateApp(String activityName, SourceApplicationInfo sourceApplicationInfo, String str, Context context) {
String sourceApplicationInfo2;
if (CrashShieldHandler.isObjectCrashing(SessionLogger.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activityName, "activityName");
Intrinsics.checkNotNullParameter(context, "context");
String str2 = "Unclassified";
if (sourceApplicationInfo != null && (sourceApplicationInfo2 = sourceApplicationInfo.toString()) != null) {
str2 = sourceApplicationInfo2;
}
Bundle bundle = new Bundle();
bundle.putString(AppEventsConstants.EVENT_PARAM_SOURCE_APPLICATION, str2);
bundle.putString(AppEventsConstants.EVENT_PARAM_PACKAGE_FP, INSTANCE.computePackageChecksum(context));
bundle.putString(AppEventsConstants.EVENT_PARAM_APP_CERT_HASH, CertificateUtil.getCertificateHash(context));
InternalAppEventsLogger.Companion companion = InternalAppEventsLogger.Companion;
InternalAppEventsLogger createInstance = companion.createInstance(activityName, str, null);
createInstance.logEvent(AppEventsConstants.EVENT_NAME_ACTIVATED_APP, bundle);
if (companion.getFlushBehavior() != AppEventsLogger.FlushBehavior.EXPLICIT_ONLY) {
createInstance.flush();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SessionLogger.class);
}
}
public static final void logDeactivateApp(String activityName, SessionInfo sessionInfo, String str) {
long longValue;
String sourceApplicationInfo;
if (CrashShieldHandler.isObjectCrashing(SessionLogger.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activityName, "activityName");
if (sessionInfo == null) {
return;
}
Long diskRestoreTime = sessionInfo.getDiskRestoreTime();
long j = 0;
if (diskRestoreTime == null) {
Long sessionLastEventTime = sessionInfo.getSessionLastEventTime();
longValue = 0 - (sessionLastEventTime == null ? 0L : sessionLastEventTime.longValue());
} else {
longValue = diskRestoreTime.longValue();
}
if (longValue < 0) {
INSTANCE.logClockSkewEvent();
longValue = 0;
}
long sessionLength = sessionInfo.getSessionLength();
if (sessionLength < 0) {
INSTANCE.logClockSkewEvent();
sessionLength = 0;
}
Bundle bundle = new Bundle();
bundle.putInt(AppEventsConstants.EVENT_NAME_SESSION_INTERRUPTIONS, sessionInfo.getInterruptionCount());
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.ROOT, "session_quanta_%d", Arrays.copyOf(new Object[]{Integer.valueOf(getQuantaIndex(longValue))}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
bundle.putString(AppEventsConstants.EVENT_NAME_TIME_BETWEEN_SESSIONS, format);
SourceApplicationInfo sourceApplicationInfo2 = sessionInfo.getSourceApplicationInfo();
String str2 = "Unclassified";
if (sourceApplicationInfo2 != null && (sourceApplicationInfo = sourceApplicationInfo2.toString()) != null) {
str2 = sourceApplicationInfo;
}
bundle.putString(AppEventsConstants.EVENT_PARAM_SOURCE_APPLICATION, str2);
Long sessionLastEventTime2 = sessionInfo.getSessionLastEventTime();
if (sessionLastEventTime2 != null) {
j = sessionLastEventTime2.longValue();
}
bundle.putLong(Constants.LOG_TIME_APP_EVENT_KEY, j / 1000);
InternalAppEventsLogger.Companion.createInstance(activityName, str, null).logEvent(AppEventsConstants.EVENT_NAME_DEACTIVATED_APP, sessionLength / 1000, bundle);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SessionLogger.class);
}
}
private final void logClockSkewEvent() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
String str = TAG;
Intrinsics.checkNotNull(str);
companion.log(loggingBehavior, str, "Clock skew detected");
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final int getQuantaIndex(long j) {
if (CrashShieldHandler.isObjectCrashing(SessionLogger.class)) {
return 0;
}
int i = 0;
while (true) {
try {
long[] jArr = INACTIVE_SECONDS_QUANTA;
if (i >= jArr.length || jArr[i] >= j) {
break;
}
i++;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SessionLogger.class);
return 0;
}
}
return i;
}
private final String computePackageChecksum(Context context) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
PackageManager packageManager = context.getPackageManager();
String stringPlus = Intrinsics.stringPlus("PCKGCHKSUM;", packageManager.getPackageInfo(context.getPackageName(), 0).versionName);
SharedPreferences sharedPreferences = context.getSharedPreferences(FacebookSdk.APP_EVENT_PREFERENCES, 0);
String string = sharedPreferences.getString(stringPlus, null);
if (string != null && string.length() == 32) {
return string;
}
String computeChecksumWithPackageManager = HashUtils.computeChecksumWithPackageManager(context, null);
if (computeChecksumWithPackageManager == null) {
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), 0);
Intrinsics.checkNotNullExpressionValue(applicationInfo, "pm.getApplicationInfo(context.packageName, 0)");
computeChecksumWithPackageManager = HashUtils.computeChecksum(applicationInfo.sourceDir);
}
sharedPreferences.edit().putString(stringPlus, computeChecksumWithPackageManager).apply();
return computeChecksumWithPackageManager;
} catch (Exception unused) {
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,126 @@
package com.facebook.appevents.internal;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import com.facebook.FacebookSdk;
import com.facebook.bolts.AppLinks;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class SourceApplicationInfo {
private static final String CALL_APPLICATION_PACKAGE_KEY = "com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage";
public static final Companion Companion = new Companion(null);
private static final String OPENED_BY_APP_LINK_KEY = "com.facebook.appevents.SourceApplicationInfo.openedByApplink";
private static final String SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT = "_fbSourceApplicationHasBeenSet";
private final String callingApplicationPackage;
private final boolean isOpenedByAppLink;
public /* synthetic */ SourceApplicationInfo(String str, boolean z, DefaultConstructorMarker defaultConstructorMarker) {
this(str, z);
}
public static final void clearSavedSourceApplicationInfoFromDisk() {
Companion.clearSavedSourceApplicationInfoFromDisk();
}
public static final SourceApplicationInfo getStoredSourceApplicatioInfo() {
return Companion.getStoredSourceApplicatioInfo();
}
public final String getCallingApplicationPackage() {
return this.callingApplicationPackage;
}
public final boolean isOpenedByAppLink() {
return this.isOpenedByAppLink;
}
private SourceApplicationInfo(String str, boolean z) {
this.callingApplicationPackage = str;
this.isOpenedByAppLink = z;
}
public String toString() {
String str = this.isOpenedByAppLink ? "Applink" : "Unclassified";
if (this.callingApplicationPackage == null) {
return str;
}
return str + '(' + ((Object) this.callingApplicationPackage) + ')';
}
public final void writeSourceApplicationInfoToDisk() {
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext()).edit();
edit.putString(CALL_APPLICATION_PACKAGE_KEY, this.callingApplicationPackage);
edit.putBoolean(OPENED_BY_APP_LINK_KEY, this.isOpenedByAppLink);
edit.apply();
}
public static final class Factory {
public static final Factory INSTANCE = new Factory();
private Factory() {
}
public static final SourceApplicationInfo create(Activity activity) {
String str;
Intrinsics.checkNotNullParameter(activity, "activity");
ComponentName callingActivity = activity.getCallingActivity();
DefaultConstructorMarker defaultConstructorMarker = null;
if (callingActivity != null) {
str = callingActivity.getPackageName();
if (Intrinsics.areEqual(str, activity.getPackageName())) {
return null;
}
} else {
str = "";
}
Intent intent = activity.getIntent();
boolean z = false;
if (intent != null && !intent.getBooleanExtra(SourceApplicationInfo.SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, false)) {
intent.putExtra(SourceApplicationInfo.SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, true);
Bundle appLinkData = AppLinks.getAppLinkData(intent);
if (appLinkData != null) {
Bundle bundle = appLinkData.getBundle("referer_app_link");
if (bundle != null) {
str = bundle.getString("package");
}
z = true;
}
}
if (intent != null) {
intent.putExtra(SourceApplicationInfo.SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, true);
}
return new SourceApplicationInfo(str, z, defaultConstructorMarker);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final SourceApplicationInfo getStoredSourceApplicatioInfo() {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext());
DefaultConstructorMarker defaultConstructorMarker = null;
if (defaultSharedPreferences.contains(SourceApplicationInfo.CALL_APPLICATION_PACKAGE_KEY)) {
return new SourceApplicationInfo(defaultSharedPreferences.getString(SourceApplicationInfo.CALL_APPLICATION_PACKAGE_KEY, null), defaultSharedPreferences.getBoolean(SourceApplicationInfo.OPENED_BY_APP_LINK_KEY, false), defaultConstructorMarker);
}
return null;
}
public final void clearSavedSourceApplicationInfoFromDisk() {
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.getApplicationContext()).edit();
edit.remove(SourceApplicationInfo.CALL_APPLICATION_PACKAGE_KEY);
edit.remove(SourceApplicationInfo.OPENED_BY_APP_LINK_KEY);
edit.apply();
}
}
}

View File

@@ -0,0 +1,68 @@
package com.facebook.appevents.internal;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ViewHierarchyConstants {
public static final int ADAPTER_VIEW_ITEM_BITMASK = 9;
public static final String ADD_PAYMENT_INFO = "ADD_PAYMENT_INFO";
public static final String ADD_TO_CART = "ADD_TO_CART";
public static final String ADD_TO_WISHLIST = "ADD_TO_WISHLIST";
public static final int BUTTON_BITMASK = 2;
public static final String BUTTON_ID = "BUTTON_ID";
public static final String BUTTON_TEXT = "BUTTON_TEXT";
public static final int CHECKBOX_BITMASK = 15;
public static final String CHILDREN_VIEW_KEY = "childviews";
public static final String CLASS_NAME_KEY = "classname";
public static final String CLASS_TYPE_BITMASK_KEY = "classtypebitmask";
public static final int CLICKABLE_VIEW_BITMASK = 5;
public static final String COMPLETE_REGISTRATION = "COMPLETE_REGISTRATION";
public static final String DESC_KEY = "description";
public static final String DIMENSION_HEIGHT_KEY = "height";
public static final String DIMENSION_KEY = "dimension";
public static final String DIMENSION_LEFT_KEY = "left";
public static final String DIMENSION_SCROLL_X_KEY = "scrollx";
public static final String DIMENSION_SCROLL_Y_KEY = "scrolly";
public static final String DIMENSION_TOP_KEY = "top";
public static final String DIMENSION_VISIBILITY_KEY = "visibility";
public static final String DIMENSION_WIDTH_KEY = "width";
public static final String ENGLISH = "ENGLISH";
public static final String GERMAN = "GERMAN";
public static final String HINT_KEY = "hint";
public static final String ICON_BITMAP = "icon_image";
public static final String ID_KEY = "id";
public static final int IMAGEVIEW_BITMASK = 1;
public static final String INITIATE_CHECKOUT = "INITIATE_CHECKOUT";
public static final int INPUT_BITMASK = 11;
public static final String INPUT_TYPE_KEY = "inputtype";
public static final ViewHierarchyConstants INSTANCE = new ViewHierarchyConstants();
public static final String IS_INTERACTED_KEY = "is_interacted";
public static final String IS_USER_INPUT_KEY = "is_user_input";
public static final String JAPANESE = "JAPANESE";
public static final int LABEL_BITMASK = 10;
public static final String LEAD = "LEAD";
public static final String PAGE_TITLE = "PAGE_TITLE";
public static final int PICKER_BITMASK = 12;
public static final String PURCHASE = "PURCHASE";
public static final int RADIO_GROUP_BITMASK = 14;
public static final int RATINGBAR_BITMASK = 16;
public static final int REACT_NATIVE_BUTTON_BITMASK = 6;
public static final String RESOLVED_DOCUMENT_LINK = "RESOLVED_DOCUMENT_LINK";
public static final String SCREEN_NAME_KEY = "screenname";
public static final String SEARCH = "SEARCH";
public static final String SPANISH = "SPANISH";
public static final int SWITCH_BITMASK = 13;
public static final String TAG_KEY = "tag";
public static final int TEXTVIEW_BITMASK = 0;
public static final String TEXT_IS_BOLD = "is_bold";
public static final String TEXT_IS_ITALIC = "is_italic";
public static final String TEXT_KEY = "text";
public static final String TEXT_SIZE = "font_size";
public static final String TEXT_STYLE = "text_style";
public static final String VIEW_CONTENT = "VIEW_CONTENT";
public static final String VIEW_KEY = "view";
private ViewHierarchyConstants() {
}
}

View File

@@ -0,0 +1,73 @@
package com.facebook.appevents.ml;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class MTensor {
public static final Companion Companion = new Companion(null);
private int capacity;
private float[] data;
private int[] shape;
public final float[] getData() {
return this.data;
}
public MTensor(int[] shape) {
Intrinsics.checkNotNullParameter(shape, "shape");
this.shape = shape;
int capacity = Companion.getCapacity(shape);
this.capacity = capacity;
this.data = new float[capacity];
}
public final int getShapeSize() {
return this.shape.length;
}
public final int getShape(int i) {
return this.shape[i];
}
public final void reshape(int[] shape) {
Intrinsics.checkNotNullParameter(shape, "shape");
this.shape = shape;
int capacity = Companion.getCapacity(shape);
float[] fArr = new float[capacity];
System.arraycopy(this.data, 0, fArr, 0, Math.min(this.capacity, capacity));
this.data = fArr;
this.capacity = capacity;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
/* JADX INFO: Access modifiers changed from: private */
public final int getCapacity(int[] iArr) {
int lastIndex;
if (iArr.length == 0) {
throw new UnsupportedOperationException("Empty array can't be reduced.");
}
int i = iArr[0];
lastIndex = ArraysKt___ArraysKt.getLastIndex(iArr);
int i2 = 1;
if (1 <= lastIndex) {
while (true) {
i *= iArr[i2];
if (i2 == lastIndex) {
break;
}
i2++;
}
}
return i;
}
}
}

View File

@@ -0,0 +1,213 @@
package com.facebook.appevents.ml;
import androidx.annotation.RestrictTo;
import com.facebook.appevents.ml.ModelManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.collections.SetsKt__SetsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class Model {
public static final Companion Companion = new Companion(null);
private static final int SEQ_LEN = 128;
private static final Map<String, String> mapping;
private final MTensor convs0Bias;
private final MTensor convs0Weight;
private final MTensor convs1Bias;
private final MTensor convs1Weight;
private final MTensor convs2Bias;
private final MTensor convs2Weight;
private final MTensor embedding;
private final MTensor fc1Bias;
private final MTensor fc1Weight;
private final MTensor fc2Bias;
private final MTensor fc2Weight;
private final Map<String, MTensor> finalWeights;
public /* synthetic */ Model(Map map, DefaultConstructorMarker defaultConstructorMarker) {
this(map);
}
private Model(Map<String, MTensor> map) {
Set<String> of;
MTensor mTensor = map.get("embed.weight");
if (mTensor == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.embedding = mTensor;
Operator operator = Operator.INSTANCE;
MTensor mTensor2 = map.get("convs.0.weight");
if (mTensor2 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.convs0Weight = Operator.transpose3D(mTensor2);
MTensor mTensor3 = map.get("convs.1.weight");
if (mTensor3 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.convs1Weight = Operator.transpose3D(mTensor3);
MTensor mTensor4 = map.get("convs.2.weight");
if (mTensor4 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.convs2Weight = Operator.transpose3D(mTensor4);
MTensor mTensor5 = map.get("convs.0.bias");
if (mTensor5 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.convs0Bias = mTensor5;
MTensor mTensor6 = map.get("convs.1.bias");
if (mTensor6 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.convs1Bias = mTensor6;
MTensor mTensor7 = map.get("convs.2.bias");
if (mTensor7 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.convs2Bias = mTensor7;
MTensor mTensor8 = map.get("fc1.weight");
if (mTensor8 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.fc1Weight = Operator.transpose2D(mTensor8);
MTensor mTensor9 = map.get("fc2.weight");
if (mTensor9 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.fc2Weight = Operator.transpose2D(mTensor9);
MTensor mTensor10 = map.get("fc1.bias");
if (mTensor10 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.fc1Bias = mTensor10;
MTensor mTensor11 = map.get("fc2.bias");
if (mTensor11 == null) {
throw new IllegalStateException("Required value was null.".toString());
}
this.fc2Bias = mTensor11;
this.finalWeights = new HashMap();
of = SetsKt__SetsKt.setOf((Object[]) new String[]{ModelManager.Task.MTML_INTEGRITY_DETECT.toKey(), ModelManager.Task.MTML_APP_EVENT_PREDICTION.toKey()});
for (String str : of) {
String stringPlus = Intrinsics.stringPlus(str, ".weight");
String stringPlus2 = Intrinsics.stringPlus(str, ".bias");
MTensor mTensor12 = map.get(stringPlus);
MTensor mTensor13 = map.get(stringPlus2);
if (mTensor12 != null) {
this.finalWeights.put(stringPlus, Operator.transpose2D(mTensor12));
}
if (mTensor13 != null) {
this.finalWeights.put(stringPlus2, mTensor13);
}
}
}
public static final /* synthetic */ Map access$getMapping$cp() {
if (CrashShieldHandler.isObjectCrashing(Model.class)) {
return null;
}
try {
return mapping;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Model.class);
return null;
}
}
public final MTensor predictOnMTML(MTensor dense, String[] texts, String task) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(dense, "dense");
Intrinsics.checkNotNullParameter(texts, "texts");
Intrinsics.checkNotNullParameter(task, "task");
Operator operator = Operator.INSTANCE;
MTensor conv1D = Operator.conv1D(Operator.embedding(texts, 128, this.embedding), this.convs0Weight);
Operator.addmv(conv1D, this.convs0Bias);
Operator.relu(conv1D);
MTensor conv1D2 = Operator.conv1D(conv1D, this.convs1Weight);
Operator.addmv(conv1D2, this.convs1Bias);
Operator.relu(conv1D2);
MTensor maxPool1D = Operator.maxPool1D(conv1D2, 2);
MTensor conv1D3 = Operator.conv1D(maxPool1D, this.convs2Weight);
Operator.addmv(conv1D3, this.convs2Bias);
Operator.relu(conv1D3);
MTensor maxPool1D2 = Operator.maxPool1D(conv1D, conv1D.getShape(1));
MTensor maxPool1D3 = Operator.maxPool1D(maxPool1D, maxPool1D.getShape(1));
MTensor maxPool1D4 = Operator.maxPool1D(conv1D3, conv1D3.getShape(1));
Operator.flatten(maxPool1D2, 1);
Operator.flatten(maxPool1D3, 1);
Operator.flatten(maxPool1D4, 1);
MTensor dense2 = Operator.dense(Operator.concatenate(new MTensor[]{maxPool1D2, maxPool1D3, maxPool1D4, dense}), this.fc1Weight, this.fc1Bias);
Operator.relu(dense2);
MTensor dense3 = Operator.dense(dense2, this.fc2Weight, this.fc2Bias);
Operator.relu(dense3);
MTensor mTensor = this.finalWeights.get(Intrinsics.stringPlus(task, ".weight"));
MTensor mTensor2 = this.finalWeights.get(Intrinsics.stringPlus(task, ".bias"));
if (mTensor != null && mTensor2 != null) {
MTensor dense4 = Operator.dense(dense3, mTensor, mTensor2);
Operator.softmax(dense4);
return dense4;
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Model build(File file) {
Intrinsics.checkNotNullParameter(file, "file");
Map<String, MTensor> parse = parse(file);
DefaultConstructorMarker defaultConstructorMarker = null;
if (parse == null) {
return null;
}
try {
return new Model(parse, defaultConstructorMarker);
} catch (Exception unused) {
return null;
}
}
private final Map<String, MTensor> parse(File file) {
Map<String, MTensor> parseModelWeights = Utils.parseModelWeights(file);
if (parseModelWeights == null) {
return null;
}
HashMap hashMap = new HashMap();
Map access$getMapping$cp = Model.access$getMapping$cp();
for (Map.Entry<String, MTensor> entry : parseModelWeights.entrySet()) {
String key = entry.getKey();
if (access$getMapping$cp.containsKey(entry.getKey()) && (key = (String) access$getMapping$cp.get(entry.getKey())) == null) {
return null;
}
hashMap.put(key, entry.getValue());
}
return hashMap;
}
}
static {
HashMap hashMapOf;
hashMapOf = MapsKt__MapsKt.hashMapOf(TuplesKt.to("embedding.weight", "embed.weight"), TuplesKt.to("dense1.weight", "fc1.weight"), TuplesKt.to("dense2.weight", "fc2.weight"), TuplesKt.to("dense3.weight", "fc3.weight"), TuplesKt.to("dense1.bias", "fc1.bias"), TuplesKt.to("dense2.bias", "fc2.bias"), TuplesKt.to("dense3.bias", "fc3.bias"));
mapping = hashMapOf;
}
}

View File

@@ -0,0 +1,784 @@
package com.facebook.appevents.ml;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.RestrictTo;
import com.facebook.GraphRequest;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.integrity.IntegrityManager;
import com.facebook.appevents.internal.FileDownloadTask;
import com.facebook.appevents.ml.ModelManager;
import com.facebook.appevents.suggestedevents.SuggestedEventsManager;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import kotlin.NoWhenBranchMatchedException;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt__IterablesKt;
import kotlin.collections.IntIterator;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.IntRange;
import kotlin.ranges.RangesKt___RangesKt;
import kotlin.text.StringsKt__StringsJVMKt;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes2.dex */
public final class ModelManager {
private static final String ASSET_URI_KEY = "asset_uri";
private static final String CACHE_KEY_MODELS = "models";
private static final String CACHE_KEY_REQUEST_TIMESTAMP = "model_request_timestamp";
private static final String MODEL_ASSERT_STORE = "com.facebook.internal.MODEL_STORE";
public static final int MODEL_REQUEST_INTERVAL_MILLISECONDS = 259200000;
private static final List<String> MTML_INTEGRITY_DETECT_PREDICTION;
private static final List<String> MTML_SUGGESTED_EVENTS_PREDICTION;
private static final String MTML_USE_CASE = "MTML";
private static final String RULES_URI_KEY = "rules_uri";
private static final String THRESHOLD_KEY = "thresholds";
private static final String USE_CASE_KEY = "use_case";
private static final String VERSION_ID_KEY = "version_id";
public static final ModelManager INSTANCE = new ModelManager();
private static final Map<String, TaskHandler> taskHandlers = new ConcurrentHashMap();
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Task.valuesCustom().length];
iArr[Task.MTML_APP_EVENT_PREDICTION.ordinal()] = 1;
iArr[Task.MTML_INTEGRITY_DETECT.ordinal()] = 2;
$EnumSwitchMapping$0 = iArr;
}
}
private ModelManager() {
}
public static final /* synthetic */ float[] access$parseJsonArray(ModelManager modelManager, JSONArray jSONArray) {
if (CrashShieldHandler.isObjectCrashing(ModelManager.class)) {
return null;
}
try {
return modelManager.parseJsonArray(jSONArray);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ModelManager.class);
return null;
}
}
public enum Task {
MTML_INTEGRITY_DETECT,
MTML_APP_EVENT_PREDICTION;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Task.valuesCustom().length];
iArr[Task.MTML_INTEGRITY_DETECT.ordinal()] = 1;
iArr[Task.MTML_APP_EVENT_PREDICTION.ordinal()] = 2;
$EnumSwitchMapping$0 = iArr;
}
}
public final String toKey() {
int i = WhenMappings.$EnumSwitchMapping$0[ordinal()];
if (i == 1) {
return "integrity_detect";
}
if (i == 2) {
return "app_event_pred";
}
throw new NoWhenBranchMatchedException();
}
public final String toUseCase() {
int i = WhenMappings.$EnumSwitchMapping$0[ordinal()];
if (i == 1) {
return "MTML_INTEGRITY_DETECT";
}
if (i == 2) {
return "MTML_APP_EVENT_PRED";
}
throw new NoWhenBranchMatchedException();
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static Task[] valuesCustom() {
Task[] valuesCustom = values();
return (Task[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
static {
List<String> listOf;
List<String> listOf2;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{"other", AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION, AppEventsConstants.EVENT_NAME_ADDED_TO_CART, AppEventsConstants.EVENT_NAME_PURCHASED, AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT});
MTML_SUGGESTED_EVENTS_PREDICTION = listOf;
listOf2 = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{"none", IntegrityManager.INTEGRITY_TYPE_ADDRESS, IntegrityManager.INTEGRITY_TYPE_HEALTH});
MTML_INTEGRITY_DETECT_PREDICTION = listOf2;
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(ModelManager.class)) {
return;
}
try {
Utility utility = Utility.INSTANCE;
Utility.runOnNonUiThread(new Runnable() { // from class: com.facebook.appevents.ml.ModelManager$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ModelManager.m513enable$lambda0();
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ModelManager.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:23:0x0059 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:24:0x005a A[Catch: all -> 0x002c, Exception -> 0x007d, TryCatch #2 {Exception -> 0x007d, all -> 0x002c, blocks: (B:6:0x000d, B:8:0x001f, B:11:0x0026, B:12:0x0033, B:14:0x0043, B:16:0x0049, B:18:0x0071, B:21:0x0051, B:24:0x005a, B:25:0x002e), top: B:5:0x000d }] */
/* renamed from: enable$lambda-0, reason: not valid java name */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final void m513enable$lambda0() {
/*
java.lang.String r0 = "model_request_timestamp"
java.lang.String r1 = "models"
java.lang.Class<com.facebook.appevents.ml.ModelManager> r2 = com.facebook.appevents.ml.ModelManager.class
boolean r3 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r2)
if (r3 == 0) goto Ld
return
Ld:
android.content.Context r3 = com.facebook.FacebookSdk.getApplicationContext() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
java.lang.String r4 = "com.facebook.internal.MODEL_STORE"
r5 = 0
android.content.SharedPreferences r3 = r3.getSharedPreferences(r4, r5) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
r4 = 0
java.lang.String r4 = r3.getString(r1, r4) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
if (r4 == 0) goto L2e
int r5 = r4.length() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
if (r5 != 0) goto L26
goto L2e
L26:
org.json.JSONObject r5 = new org.json.JSONObject // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
r5.<init>(r4) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
goto L33
L2c:
r0 = move-exception
goto L7a
L2e:
org.json.JSONObject r5 = new org.json.JSONObject // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
r5.<init>() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
L33:
r6 = 0
long r6 = r3.getLong(r0, r6) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
com.facebook.internal.FeatureManager r4 = com.facebook.internal.FeatureManager.INSTANCE // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
com.facebook.internal.FeatureManager$Feature r4 = com.facebook.internal.FeatureManager.Feature.ModelRequest // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
boolean r4 = com.facebook.internal.FeatureManager.isEnabled(r4) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
if (r4 == 0) goto L51
int r4 = r5.length() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
if (r4 == 0) goto L51
com.facebook.appevents.ml.ModelManager r4 = com.facebook.appevents.ml.ModelManager.INSTANCE // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
boolean r4 = r4.isValidTimestamp(r6) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
if (r4 != 0) goto L71
L51:
com.facebook.appevents.ml.ModelManager r4 = com.facebook.appevents.ml.ModelManager.INSTANCE // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
org.json.JSONObject r5 = r4.fetchModels() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
if (r5 != 0) goto L5a
return
L5a:
android.content.SharedPreferences$Editor r3 = r3.edit() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
java.lang.String r4 = r5.toString() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
android.content.SharedPreferences$Editor r1 = r3.putString(r1, r4) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
long r3 = java.lang.System.currentTimeMillis() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
android.content.SharedPreferences$Editor r0 = r1.putLong(r0, r3) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
r0.apply() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
L71:
com.facebook.appevents.ml.ModelManager r0 = com.facebook.appevents.ml.ModelManager.INSTANCE // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
r0.addModels(r5) // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
r0.enableMTML() // Catch: java.lang.Throwable -> L2c java.lang.Exception -> L7d
goto L7d
L7a:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r0, r2)
L7d:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.ml.ModelManager.m513enable$lambda0():void");
}
private final boolean isValidTimestamp(long j) {
if (CrashShieldHandler.isObjectCrashing(this) || j == 0) {
return false;
}
try {
return System.currentTimeMillis() - j < 259200000;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final void addModels(JSONObject jSONObject) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
try {
TaskHandler build = TaskHandler.Companion.build(jSONObject.getJSONObject(keys.next()));
if (build != null) {
taskHandlers.put(build.getUseCase(), build);
}
} catch (JSONException unused) {
return;
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final JSONObject parseRawJsonObject(JSONObject jSONObject) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
JSONObject jSONObject2 = new JSONObject();
try {
JSONArray jSONArray = jSONObject.getJSONArray("data");
int length = jSONArray.length();
if (length <= 0) {
return jSONObject2;
}
int i = 0;
while (true) {
int i2 = i + 1;
JSONObject jSONObject3 = jSONArray.getJSONObject(i);
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put(VERSION_ID_KEY, jSONObject3.getString(VERSION_ID_KEY));
jSONObject4.put(USE_CASE_KEY, jSONObject3.getString(USE_CASE_KEY));
jSONObject4.put(THRESHOLD_KEY, jSONObject3.getJSONArray(THRESHOLD_KEY));
jSONObject4.put(ASSET_URI_KEY, jSONObject3.getString(ASSET_URI_KEY));
if (jSONObject3.has(RULES_URI_KEY)) {
jSONObject4.put(RULES_URI_KEY, jSONObject3.getString(RULES_URI_KEY));
}
jSONObject2.put(jSONObject3.getString(USE_CASE_KEY), jSONObject4);
if (i2 >= length) {
return jSONObject2;
}
i = i2;
}
} catch (JSONException unused) {
return new JSONObject();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final JSONObject fetchModels() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
String[] strArr = {USE_CASE_KEY, VERSION_ID_KEY, ASSET_URI_KEY, RULES_URI_KEY, THRESHOLD_KEY};
Bundle bundle = new Bundle();
bundle.putString(GraphRequest.FIELDS_PARAM, TextUtils.join(",", strArr));
GraphRequest newGraphPathRequest = GraphRequest.Companion.newGraphPathRequest(null, "app/model_asset", null);
newGraphPathRequest.setParameters(bundle);
JSONObject jSONObject = newGraphPathRequest.executeAndWait().getJSONObject();
if (jSONObject == null) {
return null;
}
return parseRawJsonObject(jSONObject);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final void enableMTML() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
ArrayList arrayList = new ArrayList();
String str = null;
int i = 0;
for (Map.Entry<String, TaskHandler> entry : taskHandlers.entrySet()) {
String key = entry.getKey();
TaskHandler value = entry.getValue();
if (Intrinsics.areEqual(key, Task.MTML_APP_EVENT_PREDICTION.toUseCase())) {
String assetUri = value.getAssetUri();
int max = Math.max(i, value.getVersionId());
FeatureManager featureManager = FeatureManager.INSTANCE;
if (FeatureManager.isEnabled(FeatureManager.Feature.SuggestedEvents) && isLocaleEnglish()) {
arrayList.add(value.setOnPostExecute(new Runnable() { // from class: com.facebook.appevents.ml.ModelManager$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ModelManager.m514enableMTML$lambda1();
}
}));
}
str = assetUri;
i = max;
}
if (Intrinsics.areEqual(key, Task.MTML_INTEGRITY_DETECT.toUseCase())) {
str = value.getAssetUri();
i = Math.max(i, value.getVersionId());
FeatureManager featureManager2 = FeatureManager.INSTANCE;
if (FeatureManager.isEnabled(FeatureManager.Feature.IntelligentIntegrity)) {
arrayList.add(value.setOnPostExecute(new Runnable() { // from class: com.facebook.appevents.ml.ModelManager$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
ModelManager.m515enableMTML$lambda2();
}
}));
}
}
}
if (str == null || i <= 0 || arrayList.isEmpty()) {
return;
}
TaskHandler.Companion.execute(new TaskHandler(MTML_USE_CASE, str, null, i, null), arrayList);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: enableMTML$lambda-1, reason: not valid java name */
public static final void m514enableMTML$lambda1() {
if (CrashShieldHandler.isObjectCrashing(ModelManager.class)) {
return;
}
try {
SuggestedEventsManager.enable();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ModelManager.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: enableMTML$lambda-2, reason: not valid java name */
public static final void m515enableMTML$lambda2() {
if (CrashShieldHandler.isObjectCrashing(ModelManager.class)) {
return;
}
try {
IntegrityManager.enable();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ModelManager.class);
}
}
private final boolean isLocaleEnglish() {
boolean contains$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Locale resourceLocale = Utility.getResourceLocale();
if (resourceLocale != null) {
String language = resourceLocale.getLanguage();
Intrinsics.checkNotNullExpressionValue(language, "locale.language");
contains$default = StringsKt__StringsKt.contains$default(language, "en", false, 2, null);
if (!contains$default) {
return false;
}
}
return true;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final float[] parseJsonArray(JSONArray jSONArray) {
if (CrashShieldHandler.isObjectCrashing(this) || jSONArray == null) {
return null;
}
try {
float[] fArr = new float[jSONArray.length()];
int length = jSONArray.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
try {
String string = jSONArray.getString(i);
Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
fArr[i] = Float.parseFloat(string);
} catch (JSONException unused) {
}
if (i2 >= length) {
break;
}
i = i2;
}
}
return fArr;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final File getRuleFile(Task task) {
if (CrashShieldHandler.isObjectCrashing(ModelManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(task, "task");
TaskHandler taskHandler = taskHandlers.get(task.toUseCase());
if (taskHandler == null) {
return null;
}
return taskHandler.getRuleFile();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ModelManager.class);
return null;
}
}
public static final String[] predict(Task task, float[][] denses, String[] texts) {
if (CrashShieldHandler.isObjectCrashing(ModelManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(task, "task");
Intrinsics.checkNotNullParameter(denses, "denses");
Intrinsics.checkNotNullParameter(texts, "texts");
TaskHandler taskHandler = taskHandlers.get(task.toUseCase());
Model model = taskHandler == null ? null : taskHandler.getModel();
if (model == null) {
return null;
}
float[] thresholds = taskHandler.getThresholds();
int length = texts.length;
int length2 = denses[0].length;
MTensor mTensor = new MTensor(new int[]{length, length2});
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
System.arraycopy(denses[i], 0, mTensor.getData(), i * length2, length2);
if (i2 >= length) {
break;
}
i = i2;
}
}
MTensor predictOnMTML = model.predictOnMTML(mTensor, texts, task.toKey());
if (predictOnMTML != null && thresholds != null && predictOnMTML.getData().length != 0 && thresholds.length != 0) {
int i3 = WhenMappings.$EnumSwitchMapping$0[task.ordinal()];
if (i3 == 1) {
return INSTANCE.processSuggestedEventResult(predictOnMTML, thresholds);
}
if (i3 == 2) {
return INSTANCE.processIntegrityDetectionResult(predictOnMTML, thresholds);
}
throw new NoWhenBranchMatchedException();
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ModelManager.class);
return null;
}
}
private final String[] processSuggestedEventResult(MTensor mTensor, float[] fArr) {
IntRange until;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
int shape = mTensor.getShape(0);
int shape2 = mTensor.getShape(1);
float[] data = mTensor.getData();
if (shape2 != fArr.length) {
return null;
}
until = RangesKt___RangesKt.until(0, shape);
ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(until, 10));
Iterator it = until.iterator();
while (it.hasNext()) {
int nextInt = ((IntIterator) it).nextInt();
String str = "other";
int length = fArr.length;
int i = 0;
int i2 = 0;
while (i < length) {
int i3 = i2 + 1;
if (data[(nextInt * shape2) + i2] >= fArr[i]) {
str = MTML_SUGGESTED_EVENTS_PREDICTION.get(i2);
}
i++;
i2 = i3;
}
arrayList.add(str);
}
Object[] array = arrayList.toArray(new String[0]);
if (array != null) {
return (String[]) array;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final String[] processIntegrityDetectionResult(MTensor mTensor, float[] fArr) {
IntRange until;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
int shape = mTensor.getShape(0);
int shape2 = mTensor.getShape(1);
float[] data = mTensor.getData();
if (shape2 != fArr.length) {
return null;
}
until = RangesKt___RangesKt.until(0, shape);
ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(until, 10));
Iterator it = until.iterator();
while (it.hasNext()) {
int nextInt = ((IntIterator) it).nextInt();
String str = "none";
int length = fArr.length;
int i = 0;
int i2 = 0;
while (i < length) {
int i3 = i2 + 1;
if (data[(nextInt * shape2) + i2] >= fArr[i]) {
str = MTML_INTEGRITY_DETECT_PREDICTION.get(i2);
}
i++;
i2 = i3;
}
arrayList.add(str);
}
Object[] array = arrayList.toArray(new String[0]);
if (array != null) {
return (String[]) array;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final class TaskHandler {
public static final Companion Companion = new Companion(null);
private String assetUri;
private Model model;
private Runnable onPostExecute;
private File ruleFile;
private String ruleUri;
private float[] thresholds;
private String useCase;
private int versionId;
public final String getAssetUri() {
return this.assetUri;
}
public final Model getModel() {
return this.model;
}
public final File getRuleFile() {
return this.ruleFile;
}
public final String getRuleUri() {
return this.ruleUri;
}
public final float[] getThresholds() {
return this.thresholds;
}
public final String getUseCase() {
return this.useCase;
}
public final int getVersionId() {
return this.versionId;
}
public final void setAssetUri(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.assetUri = str;
}
public final void setModel(Model model) {
this.model = model;
}
public final TaskHandler setOnPostExecute(Runnable runnable) {
this.onPostExecute = runnable;
return this;
}
public final void setRuleFile(File file) {
this.ruleFile = file;
}
public final void setRuleUri(String str) {
this.ruleUri = str;
}
public final void setThresholds(float[] fArr) {
this.thresholds = fArr;
}
public final void setUseCase(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.useCase = str;
}
public final void setVersionId(int i) {
this.versionId = i;
}
public TaskHandler(String useCase, String assetUri, String str, int i, float[] fArr) {
Intrinsics.checkNotNullParameter(useCase, "useCase");
Intrinsics.checkNotNullParameter(assetUri, "assetUri");
this.useCase = useCase;
this.assetUri = assetUri;
this.ruleUri = str;
this.versionId = i;
this.thresholds = fArr;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final TaskHandler build(JSONObject jSONObject) {
if (jSONObject == null) {
return null;
}
try {
String useCase = jSONObject.getString(ModelManager.USE_CASE_KEY);
String assetUri = jSONObject.getString(ModelManager.ASSET_URI_KEY);
String optString = jSONObject.optString(ModelManager.RULES_URI_KEY, null);
int i = jSONObject.getInt(ModelManager.VERSION_ID_KEY);
float[] access$parseJsonArray = ModelManager.access$parseJsonArray(ModelManager.INSTANCE, jSONObject.getJSONArray(ModelManager.THRESHOLD_KEY));
Intrinsics.checkNotNullExpressionValue(useCase, "useCase");
Intrinsics.checkNotNullExpressionValue(assetUri, "assetUri");
return new TaskHandler(useCase, assetUri, optString, i, access$parseJsonArray);
} catch (Exception unused) {
return null;
}
}
public final void execute(TaskHandler handler) {
Intrinsics.checkNotNullParameter(handler, "handler");
execute(handler, CollectionsKt__CollectionsJVMKt.listOf(handler));
}
public final void execute(TaskHandler master, final List<TaskHandler> slaves) {
Intrinsics.checkNotNullParameter(master, "master");
Intrinsics.checkNotNullParameter(slaves, "slaves");
deleteOldFiles(master.getUseCase(), master.getVersionId());
download(master.getAssetUri(), master.getUseCase() + '_' + master.getVersionId(), new FileDownloadTask.Callback() { // from class: com.facebook.appevents.ml.ModelManager$TaskHandler$Companion$$ExternalSyntheticLambda0
@Override // com.facebook.appevents.internal.FileDownloadTask.Callback
public final void onComplete(File file) {
ModelManager.TaskHandler.Companion.m517execute$lambda1(slaves, file);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: execute$lambda-1, reason: not valid java name */
public static final void m517execute$lambda1(List slaves, File file) {
Intrinsics.checkNotNullParameter(slaves, "$slaves");
Intrinsics.checkNotNullParameter(file, "file");
final Model build = Model.Companion.build(file);
if (build != null) {
Iterator it = slaves.iterator();
while (it.hasNext()) {
final TaskHandler taskHandler = (TaskHandler) it.next();
TaskHandler.Companion.download(taskHandler.getRuleUri(), taskHandler.getUseCase() + '_' + taskHandler.getVersionId() + "_rule", new FileDownloadTask.Callback() { // from class: com.facebook.appevents.ml.ModelManager$TaskHandler$Companion$$ExternalSyntheticLambda1
@Override // com.facebook.appevents.internal.FileDownloadTask.Callback
public final void onComplete(File file2) {
ModelManager.TaskHandler.Companion.m518execute$lambda1$lambda0(ModelManager.TaskHandler.this, build, file2);
}
});
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: execute$lambda-1$lambda-0, reason: not valid java name */
public static final void m518execute$lambda1$lambda0(TaskHandler slave, Model model, File file) {
Intrinsics.checkNotNullParameter(slave, "$slave");
Intrinsics.checkNotNullParameter(file, "file");
slave.setModel(model);
slave.setRuleFile(file);
Runnable runnable = slave.onPostExecute;
if (runnable == null) {
return;
}
runnable.run();
}
private final void deleteOldFiles(String str, int i) {
File[] listFiles;
File mlDir = Utils.getMlDir();
if (mlDir == null || (listFiles = mlDir.listFiles()) == null || listFiles.length == 0) {
return;
}
String str2 = str + '_' + i;
int length = listFiles.length;
int i2 = 0;
while (i2 < length) {
File file = listFiles[i2];
i2++;
String name = file.getName();
Intrinsics.checkNotNullExpressionValue(name, "name");
if (StringsKt__StringsJVMKt.startsWith$default(name, str, false, 2, null) && !StringsKt__StringsJVMKt.startsWith$default(name, str2, false, 2, null)) {
file.delete();
}
}
}
private final void download(String str, String str2, FileDownloadTask.Callback callback) {
File file = new File(Utils.getMlDir(), str2);
if (str == null || file.exists()) {
callback.onComplete(file);
} else {
new FileDownloadTask(str, file, callback).execute(new String[0]);
}
}
}
}
}

View File

@@ -0,0 +1,685 @@
package com.facebook.appevents.ml;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class Operator {
public static final Operator INSTANCE = new Operator();
private Operator() {
}
public static final void addmv(MTensor x, MTensor b) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
Intrinsics.checkNotNullParameter(b, "b");
int shape = x.getShape(0);
int shape2 = x.getShape(1);
int shape3 = x.getShape(2);
float[] data = x.getData();
float[] data2 = b.getData();
if (shape <= 0) {
return;
}
int i = 0;
while (true) {
int i2 = i + 1;
if (shape2 > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
if (shape3 > 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
int i7 = (i * shape2 * shape3) + (i3 * shape3) + i5;
data[i7] = data[i7] + data2[i5];
if (i6 >= shape3) {
break;
} else {
i5 = i6;
}
}
}
if (i4 >= shape2) {
break;
} else {
i3 = i4;
}
}
}
if (i2 >= shape) {
return;
} else {
i = i2;
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
}
}
public static final MTensor mul(MTensor x, MTensor w) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
Intrinsics.checkNotNullParameter(w, "w");
int i = 0;
int shape = x.getShape(0);
int shape2 = w.getShape(0);
int shape3 = w.getShape(1);
MTensor mTensor = new MTensor(new int[]{shape, shape3});
float[] data = x.getData();
float[] data2 = w.getData();
float[] data3 = mTensor.getData();
if (shape > 0) {
int i2 = 0;
while (true) {
int i3 = i2 + 1;
if (shape3 > 0) {
int i4 = i;
while (true) {
int i5 = i4 + 1;
int i6 = (i2 * shape3) + i4;
data3[i6] = 0.0f;
if (shape2 > 0) {
int i7 = i;
while (true) {
int i8 = i7 + 1;
data3[i6] = data3[i6] + (data[(i2 * shape2) + i7] * data2[(i7 * shape3) + i4]);
if (i8 >= shape2) {
break;
}
i7 = i8;
}
}
if (i5 >= shape3) {
break;
}
i4 = i5;
i = 0;
}
}
if (i3 >= shape) {
break;
}
i2 = i3;
i = 0;
}
}
return mTensor;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
return null;
}
}
public static final void relu(MTensor x) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
float[] data = x.getData();
int length = data.length - 1;
if (length < 0) {
return;
}
int i = 0;
while (true) {
int i2 = i + 1;
if (data[i] < 0.0f) {
data[i] = 0.0f;
}
if (i2 > length) {
return;
} else {
i = i2;
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
}
}
public static final void flatten(MTensor x, int i) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
if (i >= x.getShapeSize()) {
return;
}
int shapeSize = x.getShapeSize();
int i2 = 1;
if (i < shapeSize) {
int i3 = i;
while (true) {
int i4 = i3 + 1;
i2 *= x.getShape(i3);
if (i4 >= shapeSize) {
break;
} else {
i3 = i4;
}
}
}
int[] iArr = new int[i + 1];
if (i > 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
iArr[i5] = x.getShape(i5);
if (i6 >= i) {
break;
} else {
i5 = i6;
}
}
}
iArr[i] = i2;
x.reshape(iArr);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
}
}
public static final MTensor concatenate(MTensor[] tensors) {
int i;
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(tensors, "tensors");
int i2 = 0;
int shape = tensors[0].getShape(0);
int length = tensors.length - 1;
if (length >= 0) {
int i3 = 0;
i = 0;
while (true) {
int i4 = i3 + 1;
i += tensors[i3].getShape(1);
if (i4 > length) {
break;
}
i3 = i4;
}
} else {
i = 0;
}
MTensor mTensor = new MTensor(new int[]{shape, i});
float[] data = mTensor.getData();
if (shape > 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
int i7 = i5 * i;
int length2 = tensors.length - 1;
if (length2 >= 0) {
int i8 = i2;
while (true) {
int i9 = i8 + 1;
float[] data2 = tensors[i8].getData();
int shape2 = tensors[i8].getShape(1);
System.arraycopy(data2, i5 * shape2, data, i7, shape2);
i7 += shape2;
if (i9 > length2) {
break;
}
i8 = i9;
}
}
if (i6 >= shape) {
break;
}
i5 = i6;
i2 = 0;
}
}
return mTensor;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
return null;
}
}
public static final void softmax(MTensor x) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
int i = 0;
int shape = x.getShape(0);
int shape2 = x.getShape(1);
float[] data = x.getData();
if (shape <= 0) {
return;
}
while (true) {
int i2 = i + 1;
int i3 = i * shape2;
int i4 = i3 + shape2;
float f = Float.MIN_VALUE;
if (i3 < i4) {
int i5 = i3;
while (true) {
int i6 = i5 + 1;
float f2 = data[i5];
if (f2 > f) {
f = f2;
}
if (i6 >= i4) {
break;
} else {
i5 = i6;
}
}
}
float f3 = 0.0f;
if (i3 < i4) {
int i7 = i3;
while (true) {
int i8 = i7 + 1;
float exp = (float) Math.exp(data[i7] - f);
data[i7] = exp;
f3 += exp;
if (i8 >= i4) {
break;
} else {
i7 = i8;
}
}
}
if (i3 < i4) {
while (true) {
int i9 = i3 + 1;
data[i3] = data[i3] / f3;
if (i9 >= i4) {
break;
} else {
i3 = i9;
}
}
}
if (i2 >= shape) {
return;
} else {
i = i2;
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
}
}
public static final MTensor dense(MTensor x, MTensor w, MTensor b) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
Intrinsics.checkNotNullParameter(w, "w");
Intrinsics.checkNotNullParameter(b, "b");
int shape = x.getShape(0);
int shape2 = b.getShape(0);
MTensor mul = mul(x, w);
float[] data = b.getData();
float[] data2 = mul.getData();
if (shape > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
if (shape2 > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
int i5 = (i * shape2) + i3;
data2[i5] = data2[i5] + data[i3];
if (i4 >= shape2) {
break;
}
i3 = i4;
}
}
if (i2 >= shape) {
break;
}
i = i2;
}
}
return mul;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
return null;
}
}
public static final MTensor embedding(String[] texts, int i, MTensor w) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(texts, "texts");
Intrinsics.checkNotNullParameter(w, "w");
int length = texts.length;
int shape = w.getShape(1);
MTensor mTensor = new MTensor(new int[]{length, i, shape});
float[] data = mTensor.getData();
float[] data2 = w.getData();
if (length > 0) {
int i2 = 0;
while (true) {
int i3 = i2 + 1;
int[] vectorize = Utils.INSTANCE.vectorize(texts[i2], i);
if (i > 0) {
int i4 = 0;
while (true) {
int i5 = i4 + 1;
System.arraycopy(data2, vectorize[i4] * shape, data, (shape * i * i2) + (i4 * shape), shape);
if (i5 >= i) {
break;
}
i4 = i5;
}
}
if (i3 >= length) {
break;
}
i2 = i3;
}
}
return mTensor;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
return null;
}
}
public static final MTensor transpose2D(MTensor x) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
int shape = x.getShape(0);
int shape2 = x.getShape(1);
MTensor mTensor = new MTensor(new int[]{shape2, shape});
float[] data = x.getData();
float[] data2 = mTensor.getData();
if (shape > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
if (shape2 > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
data2[(i3 * shape) + i] = data[(i * shape2) + i3];
if (i4 >= shape2) {
break;
}
i3 = i4;
}
}
if (i2 >= shape) {
break;
}
i = i2;
}
}
return mTensor;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
return null;
}
}
public static final MTensor transpose3D(MTensor x) {
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
int shape = x.getShape(0);
int shape2 = x.getShape(1);
int shape3 = x.getShape(2);
MTensor mTensor = new MTensor(new int[]{shape3, shape2, shape});
float[] data = x.getData();
float[] data2 = mTensor.getData();
if (shape > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
if (shape2 > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
if (shape3 > 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
data2[(i5 * shape * shape2) + (i3 * shape) + i] = data[(i * shape2 * shape3) + (i3 * shape3) + i5];
if (i6 >= shape3) {
break;
}
i5 = i6;
}
}
if (i4 >= shape2) {
break;
}
i3 = i4;
}
}
if (i2 >= shape) {
break;
}
i = i2;
}
}
return mTensor;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
return null;
}
}
public static final MTensor conv1D(MTensor x, MTensor w) {
Class<Operator> cls;
MTensor mTensor;
Class<Operator> cls2 = Operator.class;
if (CrashShieldHandler.isObjectCrashing(cls2)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
Intrinsics.checkNotNullParameter(w, "w");
int i = 0;
int shape = x.getShape(0);
int shape2 = x.getShape(1);
int shape3 = x.getShape(2);
int shape4 = w.getShape(0);
int i2 = (shape2 - shape4) + 1;
int shape5 = w.getShape(2);
MTensor mTensor2 = new MTensor(new int[]{shape, i2, shape5});
float[] data = x.getData();
float[] data2 = mTensor2.getData();
float[] data3 = w.getData();
if (shape <= 0) {
return mTensor2;
}
int i3 = 0;
while (true) {
int i4 = i3 + 1;
if (shape5 > 0) {
int i5 = i;
while (true) {
int i6 = i5 + 1;
if (i2 > 0) {
int i7 = 0;
while (true) {
int i8 = i7 + 1;
float f = 0.0f;
if (shape4 > 0) {
int i9 = 0;
while (true) {
cls = cls2;
int i10 = i9 + 1;
if (shape3 > 0) {
int i11 = 0;
while (true) {
mTensor = mTensor2;
int i12 = i11 + 1;
try {
f += data[(shape2 * shape3 * i3) + ((i9 + i7) * shape3) + i11] * data3[(((i9 * shape3) + i11) * shape5) + i5];
if (i12 >= shape3) {
break;
}
i11 = i12;
mTensor2 = mTensor;
} catch (Throwable th) {
th = th;
CrashShieldHandler.handleThrowable(th, cls);
return null;
}
}
} else {
mTensor = mTensor2;
}
if (i10 >= shape4) {
break;
}
i9 = i10;
cls2 = cls;
mTensor2 = mTensor;
}
} else {
cls = cls2;
mTensor = mTensor2;
}
data2[(i2 * shape5 * i3) + (i7 * shape5) + i5] = f;
if (i8 >= i2) {
break;
}
i7 = i8;
cls2 = cls;
mTensor2 = mTensor;
}
} else {
cls = cls2;
mTensor = mTensor2;
}
if (i6 >= shape5) {
break;
}
i5 = i6;
cls2 = cls;
mTensor2 = mTensor;
}
} else {
cls = cls2;
mTensor = mTensor2;
}
if (i4 >= shape) {
return mTensor;
}
i3 = i4;
cls2 = cls;
mTensor2 = mTensor;
i = 0;
}
} catch (Throwable th2) {
th = th2;
cls = cls2;
}
}
public static final MTensor maxPool1D(MTensor x, int i) {
int i2;
if (CrashShieldHandler.isObjectCrashing(Operator.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(x, "x");
int i3 = 0;
int shape = x.getShape(0);
int shape2 = x.getShape(1);
int shape3 = x.getShape(2);
int i4 = (shape2 - i) + 1;
MTensor mTensor = new MTensor(new int[]{shape, i4, shape3});
float[] data = x.getData();
float[] data2 = mTensor.getData();
if (shape > 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
if (shape3 > 0) {
int i7 = i3;
while (true) {
int i8 = i7 + 1;
if (i4 > 0) {
int i9 = i3;
while (true) {
int i10 = i9 + 1;
int i11 = i9 * shape3;
int i12 = (i5 * i4 * shape3) + i11 + i7;
int i13 = (i5 * shape2 * shape3) + i11 + i7;
data2[i12] = Float.MIN_VALUE;
if (i > 0) {
int i14 = 0;
while (true) {
int i15 = i14 + 1;
i2 = shape2;
data2[i12] = Math.max(data2[i12], data[i13 + (i14 * shape3)]);
if (i15 >= i) {
break;
}
i14 = i15;
shape2 = i2;
}
} else {
i2 = shape2;
}
if (i10 >= i4) {
break;
}
i9 = i10;
shape2 = i2;
}
} else {
i2 = shape2;
}
if (i8 >= shape3) {
break;
}
i7 = i8;
shape2 = i2;
i3 = 0;
}
} else {
i2 = shape2;
}
if (i6 >= shape) {
break;
}
i5 = i6;
shape2 = i2;
i3 = 0;
}
}
return mTensor;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Operator.class);
return null;
}
}
}

View File

@@ -0,0 +1,222 @@
package com.facebook.appevents.ml;
import android.text.TextUtils;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.Regex;
import org.json.JSONArray;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class Utils {
private static final String DIR_NAME = "facebook_ml/";
public static final Utils INSTANCE = new Utils();
private Utils() {
}
public final int[] vectorize(String texts, int i) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(texts, "texts");
int[] iArr = new int[i];
String normalizeString = normalizeString(texts);
Charset forName = Charset.forName("UTF-8");
Intrinsics.checkNotNullExpressionValue(forName, "forName(\"UTF-8\")");
if (normalizeString == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
byte[] bytes = normalizeString.getBytes(forName);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
if (i > 0) {
int i2 = 0;
while (true) {
int i3 = i2 + 1;
if (i2 < bytes.length) {
iArr[i2] = bytes[i2] & 255;
} else {
iArr[i2] = 0;
}
if (i3 >= i) {
break;
}
i2 = i3;
}
}
return iArr;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final File getMlDir() {
if (CrashShieldHandler.isObjectCrashing(Utils.class)) {
return null;
}
try {
File file = new File(FacebookSdk.getApplicationContext().getFilesDir(), DIR_NAME);
if (!file.exists()) {
if (!file.mkdirs()) {
return null;
}
}
return file;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, Utils.class);
return null;
}
}
public static final Map<String, MTensor> parseModelWeights(File file) {
Map<String, MTensor> map;
Map<String, MTensor> map2 = null;
if (CrashShieldHandler.isObjectCrashing(Utils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(file, "file");
} catch (Throwable th) {
th = th;
map = null;
}
try {
try {
FileInputStream fileInputStream = new FileInputStream(file);
int available = fileInputStream.available();
DataInputStream dataInputStream = new DataInputStream(fileInputStream);
byte[] bArr = new byte[available];
dataInputStream.readFully(bArr);
dataInputStream.close();
if (available < 4) {
return null;
}
int i = 0;
ByteBuffer wrap = ByteBuffer.wrap(bArr, 0, 4);
wrap.order(ByteOrder.LITTLE_ENDIAN);
int i2 = wrap.getInt();
int i3 = i2 + 4;
if (available < i3) {
return null;
}
JSONObject jSONObject = new JSONObject(new String(bArr, 4, i2, Charsets.UTF_8));
JSONArray names = jSONObject.names();
int length = names.length();
String[] strArr = new String[length];
int i4 = length - 1;
if (i4 >= 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
strArr[i5] = names.getString(i5);
if (i6 > i4) {
break;
}
i5 = i6;
}
}
ArraysKt___ArraysJvmKt.sort(strArr);
HashMap hashMap = new HashMap();
int i7 = 0;
while (i7 < length) {
String str = strArr[i7];
i7++;
if (str != null) {
JSONArray jSONArray = jSONObject.getJSONArray(str);
int length2 = jSONArray.length();
int[] iArr = new int[length2];
int i8 = length2 - 1;
int i9 = 1;
if (i8 >= 0) {
while (true) {
int i10 = i + 1;
try {
int i11 = jSONArray.getInt(i);
iArr[i] = i11;
i9 *= i11;
if (i10 > i8) {
break;
}
i = i10;
} catch (Exception unused) {
return null;
}
}
}
int i12 = i9 * 4;
int i13 = i3 + i12;
if (i13 > available) {
return null;
}
ByteBuffer wrap2 = ByteBuffer.wrap(bArr, i3, i12);
wrap2.order(ByteOrder.LITTLE_ENDIAN);
MTensor mTensor = new MTensor(iArr);
wrap2.asFloatBuffer().get(mTensor.getData(), 0, i9);
hashMap.put(str, mTensor);
i3 = i13;
i = 0;
map2 = null;
}
}
return hashMap;
} catch (Exception unused2) {
return map2;
}
} catch (Throwable th2) {
th = th2;
map = null;
CrashShieldHandler.handleThrowable(th, Utils.class);
return map;
}
}
public final String normalizeString(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(str, "str");
int length = str.length() - 1;
int i = 0;
boolean z = false;
while (i <= length) {
boolean z2 = Intrinsics.compare((int) str.charAt(!z ? i : length), 32) <= 0;
if (z) {
if (!z2) {
break;
}
length--;
} else if (z2) {
i++;
} else {
z = true;
}
}
Object[] array = new Regex("\\s+").split(str.subSequence(i, length + 1).toString(), 0).toArray(new String[0]);
if (array == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
}
String join = TextUtils.join(" ", (String[]) array);
Intrinsics.checkNotNullExpressionValue(join, "join(\" \", strArray)");
return join;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,134 @@
package com.facebook.appevents.ondeviceprocessing;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEvent;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.Set;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.collections.SetsKt__SetsKt;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class OnDeviceProcessingManager {
private static final Set<String> ALLOWED_IMPLICIT_EVENTS;
public static final OnDeviceProcessingManager INSTANCE = new OnDeviceProcessingManager();
private OnDeviceProcessingManager() {
}
static {
Set<String> of;
of = SetsKt__SetsKt.setOf((Object[]) new String[]{AppEventsConstants.EVENT_NAME_PURCHASED, AppEventsConstants.EVENT_NAME_START_TRIAL, AppEventsConstants.EVENT_NAME_SUBSCRIBE});
ALLOWED_IMPLICIT_EVENTS = of;
}
public static final boolean isOnDeviceProcessingEnabled() {
if (CrashShieldHandler.isObjectCrashing(OnDeviceProcessingManager.class)) {
return false;
}
try {
if (FacebookSdk.getLimitEventAndDataUsage(FacebookSdk.getApplicationContext()) || Utility.isDataProcessingRestricted()) {
return false;
}
return RemoteServiceWrapper.isServiceAvailable();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, OnDeviceProcessingManager.class);
return false;
}
}
public static final void sendInstallEventAsync(final String str, final String str2) {
if (CrashShieldHandler.isObjectCrashing(OnDeviceProcessingManager.class)) {
return;
}
try {
final Context applicationContext = FacebookSdk.getApplicationContext();
if (applicationContext == null || str == null || str2 == null) {
return;
}
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.ondeviceprocessing.OnDeviceProcessingManager$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
OnDeviceProcessingManager.m520sendInstallEventAsync$lambda0(applicationContext, str2, str);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, OnDeviceProcessingManager.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendInstallEventAsync$lambda-0, reason: not valid java name */
public static final void m520sendInstallEventAsync$lambda0(Context context, String str, String str2) {
if (CrashShieldHandler.isObjectCrashing(OnDeviceProcessingManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(context, "$context");
SharedPreferences sharedPreferences = context.getSharedPreferences(str, 0);
String stringPlus = Intrinsics.stringPlus(str2, "pingForOnDevice");
if (sharedPreferences.getLong(stringPlus, 0L) == 0) {
RemoteServiceWrapper.sendInstallEvent(str2);
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putLong(stringPlus, System.currentTimeMillis());
edit.apply();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, OnDeviceProcessingManager.class);
}
}
public static final void sendCustomEventAsync(final String applicationId, final AppEvent event) {
if (CrashShieldHandler.isObjectCrashing(OnDeviceProcessingManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
Intrinsics.checkNotNullParameter(event, "event");
if (INSTANCE.isEventEligibleForOnDeviceProcessing(event)) {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.ondeviceprocessing.OnDeviceProcessingManager$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
OnDeviceProcessingManager.m519sendCustomEventAsync$lambda1(applicationId, event);
}
});
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, OnDeviceProcessingManager.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendCustomEventAsync$lambda-1, reason: not valid java name */
public static final void m519sendCustomEventAsync$lambda1(String applicationId, AppEvent event) {
if (CrashShieldHandler.isObjectCrashing(OnDeviceProcessingManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(applicationId, "$applicationId");
Intrinsics.checkNotNullParameter(event, "$event");
RemoteServiceWrapper remoteServiceWrapper = RemoteServiceWrapper.INSTANCE;
RemoteServiceWrapper.sendCustomEvents(applicationId, CollectionsKt__CollectionsJVMKt.listOf(event));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, OnDeviceProcessingManager.class);
}
}
private final boolean isEventEligibleForOnDeviceProcessing(AppEvent appEvent) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return (appEvent.isImplicit() ^ true) || (appEvent.isImplicit() && ALLOWED_IMPLICIT_EVENTS.contains(appEvent.getName()));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
}

View File

@@ -0,0 +1,94 @@
package com.facebook.appevents.ondeviceprocessing;
import android.os.Bundle;
import androidx.core.app.NotificationCompat;
import com.facebook.appevents.AppEvent;
import com.facebook.appevents.eventdeactivation.EventDeactivationManager;
import com.facebook.appevents.ondeviceprocessing.RemoteServiceWrapper;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.Collection;
import java.util.List;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
/* loaded from: classes2.dex */
public final class RemoteServiceParametersHelper {
public static final RemoteServiceParametersHelper INSTANCE = new RemoteServiceParametersHelper();
private static final String TAG = RemoteServiceWrapper.class.getSimpleName();
private RemoteServiceParametersHelper() {
}
public static final Bundle buildEventsBundle(RemoteServiceWrapper.EventType eventType, String applicationId, List<AppEvent> appEvents) {
if (CrashShieldHandler.isObjectCrashing(RemoteServiceParametersHelper.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(eventType, "eventType");
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
Bundle bundle = new Bundle();
bundle.putString(NotificationCompat.CATEGORY_EVENT, eventType.toString());
bundle.putString("app_id", applicationId);
if (RemoteServiceWrapper.EventType.CUSTOM_APP_EVENTS == eventType) {
JSONArray buildEventsJson = INSTANCE.buildEventsJson(appEvents, applicationId);
if (buildEventsJson.length() == 0) {
return null;
}
bundle.putString("custom_events", buildEventsJson.toString());
}
return bundle;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RemoteServiceParametersHelper.class);
return null;
}
}
private final JSONArray buildEventsJson(List<AppEvent> list, String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
JSONArray jSONArray = new JSONArray();
List<AppEvent> mutableList = CollectionsKt___CollectionsKt.toMutableList((Collection) list);
EventDeactivationManager.processEvents(mutableList);
boolean includeImplicitEvents = includeImplicitEvents(str);
for (AppEvent appEvent : mutableList) {
if (appEvent.isChecksumValid()) {
if (!(!appEvent.isImplicit())) {
if (appEvent.isImplicit() && includeImplicitEvents) {
}
}
jSONArray.put(appEvent.getJsonObject());
} else {
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, Intrinsics.stringPlus("Event with invalid checksum: ", appEvent));
}
}
return jSONArray;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final boolean includeImplicitEvents(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(str, false);
if (queryAppSettings != null) {
return queryAppSettings.supportsImplicitLogging();
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
}

View File

@@ -0,0 +1,240 @@
package com.facebook.appevents.ondeviceprocessing;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEvent;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.internal.FacebookSignatureValidator;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.facebook.ppml.receiver.IReceiverService;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class RemoteServiceWrapper {
public static final String RECEIVER_SERVICE_ACTION = "ReceiverService";
public static final String RECEIVER_SERVICE_PACKAGE = "com.facebook.katana";
public static final String RECEIVER_SERVICE_PACKAGE_WAKIZASHI = "com.facebook.wakizashi";
private static Boolean isServiceAvailable;
public static final RemoteServiceWrapper INSTANCE = new RemoteServiceWrapper();
private static final String TAG = RemoteServiceWrapper.class.getSimpleName();
private RemoteServiceWrapper() {
}
public static final boolean isServiceAvailable() {
if (CrashShieldHandler.isObjectCrashing(RemoteServiceWrapper.class)) {
return false;
}
try {
if (isServiceAvailable == null) {
isServiceAvailable = Boolean.valueOf(INSTANCE.getVerifiedServiceIntent(FacebookSdk.getApplicationContext()) != null);
}
Boolean bool = isServiceAvailable;
if (bool == null) {
return false;
}
return bool.booleanValue();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RemoteServiceWrapper.class);
return false;
}
}
public static final ServiceResult sendInstallEvent(String applicationId) {
if (CrashShieldHandler.isObjectCrashing(RemoteServiceWrapper.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
return INSTANCE.sendEvents(EventType.MOBILE_APP_INSTALL, applicationId, CollectionsKt__CollectionsKt.emptyList());
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RemoteServiceWrapper.class);
return null;
}
}
public static final ServiceResult sendCustomEvents(String applicationId, List<AppEvent> appEvents) {
if (CrashShieldHandler.isObjectCrashing(RemoteServiceWrapper.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
return INSTANCE.sendEvents(EventType.CUSTOM_APP_EVENTS, applicationId, appEvents);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RemoteServiceWrapper.class);
return null;
}
}
private final ServiceResult sendEvents(EventType eventType, String str, List<AppEvent> list) {
ServiceResult serviceResult;
String str2;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ServiceResult serviceResult2 = ServiceResult.SERVICE_NOT_AVAILABLE;
AppEventUtility.assertIsNotMainThread();
Context applicationContext = FacebookSdk.getApplicationContext();
Intent verifiedServiceIntent = getVerifiedServiceIntent(applicationContext);
if (verifiedServiceIntent == null) {
return serviceResult2;
}
RemoteServiceConnection remoteServiceConnection = new RemoteServiceConnection();
try {
if (applicationContext.bindService(verifiedServiceIntent, remoteServiceConnection, 1)) {
try {
try {
IBinder binder = remoteServiceConnection.getBinder();
if (binder != null) {
IReceiverService asInterface = IReceiverService.Stub.asInterface(binder);
Bundle buildEventsBundle = RemoteServiceParametersHelper.buildEventsBundle(eventType, str, list);
if (buildEventsBundle != null) {
asInterface.sendEvents(buildEventsBundle);
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, Intrinsics.stringPlus("Successfully sent events to the remote service: ", buildEventsBundle));
}
serviceResult2 = ServiceResult.OPERATION_SUCCESS;
}
applicationContext.unbindService(remoteServiceConnection);
Utility utility2 = Utility.INSTANCE;
Utility.logd(TAG, "Unbound from the remote service");
return serviceResult2;
} catch (RemoteException e) {
serviceResult = ServiceResult.SERVICE_ERROR;
Utility utility3 = Utility.INSTANCE;
str2 = TAG;
Utility.logd(str2, e);
applicationContext.unbindService(remoteServiceConnection);
Utility.logd(str2, "Unbound from the remote service");
return serviceResult;
}
} catch (InterruptedException e2) {
serviceResult = ServiceResult.SERVICE_ERROR;
Utility utility4 = Utility.INSTANCE;
str2 = TAG;
Utility.logd(str2, e2);
applicationContext.unbindService(remoteServiceConnection);
Utility.logd(str2, "Unbound from the remote service");
return serviceResult;
}
}
return ServiceResult.SERVICE_ERROR;
} catch (Throwable th) {
applicationContext.unbindService(remoteServiceConnection);
Utility utility5 = Utility.INSTANCE;
Utility.logd(TAG, "Unbound from the remote service");
throw th;
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
return null;
}
}
private final Intent getVerifiedServiceIntent(Context context) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
Intent intent = new Intent(RECEIVER_SERVICE_ACTION);
intent.setPackage("com.facebook.katana");
if (packageManager.resolveService(intent, 0) != null && FacebookSignatureValidator.validateSignature(context, "com.facebook.katana")) {
return intent;
}
Intent intent2 = new Intent(RECEIVER_SERVICE_ACTION);
intent2.setPackage("com.facebook.wakizashi");
if (packageManager.resolveService(intent2, 0) != null) {
if (FacebookSignatureValidator.validateSignature(context, "com.facebook.wakizashi")) {
return intent2;
}
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public enum ServiceResult {
OPERATION_SUCCESS,
SERVICE_NOT_AVAILABLE,
SERVICE_ERROR;
/* renamed from: values, reason: to resolve conflict with enum method */
public static ServiceResult[] valuesCustom() {
ServiceResult[] valuesCustom = values();
return (ServiceResult[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public enum EventType {
MOBILE_APP_INSTALL("MOBILE_APP_INSTALL"),
CUSTOM_APP_EVENTS("CUSTOM_APP_EVENTS");
private final String eventType;
@Override // java.lang.Enum
public String toString() {
return this.eventType;
}
EventType(String str) {
this.eventType = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static EventType[] valuesCustom() {
EventType[] valuesCustom = values();
return (EventType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public static final class RemoteServiceConnection implements ServiceConnection {
private IBinder binder;
private final CountDownLatch latch = new CountDownLatch(1);
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName name) {
Intrinsics.checkNotNullParameter(name, "name");
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName name, IBinder serviceBinder) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(serviceBinder, "serviceBinder");
this.binder = serviceBinder;
this.latch.countDown();
}
@Override // android.content.ServiceConnection
public void onNullBinding(ComponentName name) {
Intrinsics.checkNotNullParameter(name, "name");
this.latch.countDown();
}
public final IBinder getBinder() throws InterruptedException {
this.latch.await(5L, TimeUnit.SECONDS);
return this.binder;
}
}
}

View File

@@ -0,0 +1,196 @@
package com.facebook.appevents.restrictivedatafilter;
import android.util.Log;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class RestrictiveDataManager {
private static final String PROCESS_EVENT_NAME = "process_event_name";
private static final String REPLACEMENT_STRING = "_removed_";
private static final String RESTRICTIVE_PARAM = "restrictive_param";
private static final String RESTRICTIVE_PARAM_KEY = "_restrictedParams";
private static boolean enabled;
public static final RestrictiveDataManager INSTANCE = new RestrictiveDataManager();
private static final String TAG = RestrictiveDataManager.class.getCanonicalName();
private static final List<RestrictiveParamFilter> restrictiveParamFilters = new ArrayList();
private static final Set<String> restrictedEvents = new CopyOnWriteArraySet();
private RestrictiveDataManager() {
}
public static final void enable() {
if (CrashShieldHandler.isObjectCrashing(RestrictiveDataManager.class)) {
return;
}
try {
enabled = true;
INSTANCE.initialize();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RestrictiveDataManager.class);
}
}
private final void initialize() {
String restrictiveDataSetting;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings != null && (restrictiveDataSetting = queryAppSettings.getRestrictiveDataSetting()) != null && restrictiveDataSetting.length() != 0) {
JSONObject jSONObject = new JSONObject(restrictiveDataSetting);
restrictiveParamFilters.clear();
restrictedEvents.clear();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String key = keys.next();
JSONObject jSONObject2 = jSONObject.getJSONObject(key);
if (jSONObject2 != null) {
JSONObject optJSONObject = jSONObject2.optJSONObject(RESTRICTIVE_PARAM);
Intrinsics.checkNotNullExpressionValue(key, "key");
RestrictiveParamFilter restrictiveParamFilter = new RestrictiveParamFilter(key, new HashMap());
if (optJSONObject != null) {
restrictiveParamFilter.setRestrictiveParams(Utility.convertJSONObjectToStringMap(optJSONObject));
restrictiveParamFilters.add(restrictiveParamFilter);
}
if (jSONObject2.has(PROCESS_EVENT_NAME)) {
restrictedEvents.add(restrictiveParamFilter.getEventName());
}
}
}
}
} catch (Exception unused) {
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final String processEvent(String eventName) {
if (CrashShieldHandler.isObjectCrashing(RestrictiveDataManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(eventName, "eventName");
return enabled ? INSTANCE.isRestrictedEvent(eventName) ? REPLACEMENT_STRING : eventName : eventName;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RestrictiveDataManager.class);
return null;
}
}
public static final void processParameters(Map<String, String> parameters, String eventName) {
if (CrashShieldHandler.isObjectCrashing(RestrictiveDataManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(parameters, "parameters");
Intrinsics.checkNotNullParameter(eventName, "eventName");
if (enabled) {
HashMap hashMap = new HashMap();
for (String str : new ArrayList(parameters.keySet())) {
String matchedRuleType = INSTANCE.getMatchedRuleType(eventName, str);
if (matchedRuleType != null) {
hashMap.put(str, matchedRuleType);
parameters.remove(str);
}
}
if (!hashMap.isEmpty()) {
try {
JSONObject jSONObject = new JSONObject();
for (Map.Entry entry : hashMap.entrySet()) {
jSONObject.put((String) entry.getKey(), (String) entry.getValue());
}
parameters.put(RESTRICTIVE_PARAM_KEY, jSONObject.toString());
} catch (JSONException unused) {
}
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, RestrictiveDataManager.class);
}
}
private final String getMatchedRuleType(String str, String str2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
try {
for (RestrictiveParamFilter restrictiveParamFilter : new ArrayList(restrictiveParamFilters)) {
if (restrictiveParamFilter != null && Intrinsics.areEqual(str, restrictiveParamFilter.getEventName())) {
for (String str3 : restrictiveParamFilter.getRestrictiveParams().keySet()) {
if (Intrinsics.areEqual(str2, str3)) {
return restrictiveParamFilter.getRestrictiveParams().get(str3);
}
}
}
}
} catch (Exception e) {
Log.w(TAG, "getMatchedRuleType failed", e);
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final boolean isRestrictedEvent(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return restrictedEvents.contains(str);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final class RestrictiveParamFilter {
private String eventName;
private Map<String, String> restrictiveParams;
public final String getEventName() {
return this.eventName;
}
public final Map<String, String> getRestrictiveParams() {
return this.restrictiveParams;
}
public final void setEventName(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.eventName = str;
}
public final void setRestrictiveParams(Map<String, String> map) {
Intrinsics.checkNotNullParameter(map, "<set-?>");
this.restrictiveParams = map;
}
public RestrictiveParamFilter(String eventName, Map<String, String> restrictiveParams) {
Intrinsics.checkNotNullParameter(eventName, "eventName");
Intrinsics.checkNotNullParameter(restrictiveParams, "restrictiveParams");
this.eventName = eventName;
this.restrictiveParams = restrictiveParams;
}
}
}

View File

@@ -0,0 +1,616 @@
package com.facebook.appevents.suggestedevents;
import android.util.Patterns;
import com.applovin.sdk.AppLovinEventTypes;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.ironsource.v8;
import com.ironsource.zm;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.io.File;
import java.io.FileInputStream;
import java.util.Map;
import java.util.regex.Pattern;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class FeatureExtractor {
public static final FeatureExtractor INSTANCE = new FeatureExtractor();
private static final int NUM_OF_FEATURES = 30;
private static final String REGEX_ADD_TO_CART_BUTTON_TEXT = "(?i)add to(\\s|\\Z)|update(\\s|\\Z)|cart";
private static final String REGEX_ADD_TO_CART_PAGE_TITLE = "(?i)add to(\\s|\\Z)|update(\\s|\\Z)|cart|shop|buy";
private static final String REGEX_CR_HAS_CONFIRM_PASSWORD_FIELD = "(?i)(confirm.*password)|(password.*(confirmation|confirm)|confirmation)";
private static final String REGEX_CR_HAS_LOG_IN_KEYWORDS = "(?i)(sign in)|login|signIn";
private static final String REGEX_CR_HAS_SIGN_ON_KEYWORDS = "(?i)(sign.*(up|now)|registration|register|(create|apply).*(profile|account)|open.*account|account.*(open|creation|application)|enroll|join.*now)";
private static final String REGEX_CR_PASSWORD_FIELD = "password";
private static Map<String, String> eventInfo;
private static boolean initialized;
private static Map<String, String> languageInfo;
private static JSONObject rules;
private static Map<String, String> textTypeInfo;
private FeatureExtractor() {
}
public static final boolean isInitialized() {
if (CrashShieldHandler.isObjectCrashing(FeatureExtractor.class)) {
return false;
}
try {
return initialized;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, FeatureExtractor.class);
return false;
}
}
public static final void initialize(File file) {
Map<String, String> mapOf;
Map<String, String> mapOf2;
Map<String, String> mapOf3;
if (CrashShieldHandler.isObjectCrashing(FeatureExtractor.class)) {
return;
}
try {
try {
rules = new JSONObject();
FileInputStream fileInputStream = new FileInputStream(file);
byte[] bArr = new byte[fileInputStream.available()];
fileInputStream.read(bArr);
fileInputStream.close();
rules = new JSONObject(new String(bArr, Charsets.UTF_8));
mapOf = MapsKt__MapsKt.mapOf(TuplesKt.to(ViewHierarchyConstants.ENGLISH, "1"), TuplesKt.to(ViewHierarchyConstants.GERMAN, "2"), TuplesKt.to(ViewHierarchyConstants.SPANISH, "3"), TuplesKt.to(ViewHierarchyConstants.JAPANESE, "4"));
languageInfo = mapOf;
mapOf2 = MapsKt__MapsKt.mapOf(TuplesKt.to(ViewHierarchyConstants.VIEW_CONTENT, "0"), TuplesKt.to(ViewHierarchyConstants.SEARCH, "1"), TuplesKt.to(ViewHierarchyConstants.ADD_TO_CART, "2"), TuplesKt.to(ViewHierarchyConstants.ADD_TO_WISHLIST, "3"), TuplesKt.to(ViewHierarchyConstants.INITIATE_CHECKOUT, "4"), TuplesKt.to(ViewHierarchyConstants.ADD_PAYMENT_INFO, CampaignEx.CLICKMODE_ON), TuplesKt.to(ViewHierarchyConstants.PURCHASE, "6"), TuplesKt.to(ViewHierarchyConstants.LEAD, zm.e), TuplesKt.to(ViewHierarchyConstants.COMPLETE_REGISTRATION, "8"));
eventInfo = mapOf2;
mapOf3 = MapsKt__MapsKt.mapOf(TuplesKt.to(ViewHierarchyConstants.BUTTON_TEXT, "1"), TuplesKt.to(ViewHierarchyConstants.PAGE_TITLE, "2"), TuplesKt.to(ViewHierarchyConstants.RESOLVED_DOCUMENT_LINK, "3"), TuplesKt.to(ViewHierarchyConstants.BUTTON_ID, "4"));
textTypeInfo = mapOf3;
initialized = true;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, FeatureExtractor.class);
}
} catch (Exception unused) {
}
}
public static final String getTextFeature(String buttonText, String activityName, String appName) {
if (CrashShieldHandler.isObjectCrashing(FeatureExtractor.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(buttonText, "buttonText");
Intrinsics.checkNotNullParameter(activityName, "activityName");
Intrinsics.checkNotNullParameter(appName, "appName");
String str = appName + " | " + activityName + ", " + buttonText;
if (str == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String lowerCase = str.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
return lowerCase;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, FeatureExtractor.class);
return null;
}
}
public static final float[] getDenseFeatures(JSONObject viewHierarchy, String appName) {
String lowerCase;
JSONObject jSONObject;
String screenName;
JSONArray jSONArray;
FeatureExtractor featureExtractor;
JSONObject interactedNode;
if (CrashShieldHandler.isObjectCrashing(FeatureExtractor.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(viewHierarchy, "viewHierarchy");
Intrinsics.checkNotNullParameter(appName, "appName");
if (!initialized) {
return null;
}
float[] fArr = new float[30];
for (int i = 0; i < 30; i++) {
fArr[i] = 0.0f;
}
try {
lowerCase = appName.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
jSONObject = new JSONObject(viewHierarchy.optJSONObject("view").toString());
screenName = viewHierarchy.optString(ViewHierarchyConstants.SCREEN_NAME_KEY);
jSONArray = new JSONArray();
featureExtractor = INSTANCE;
featureExtractor.pruneTree(jSONObject, jSONArray);
featureExtractor.sum(fArr, featureExtractor.parseFeatures(jSONObject));
interactedNode = featureExtractor.getInteractedNode(jSONObject);
} catch (JSONException unused) {
}
if (interactedNode == null) {
return null;
}
Intrinsics.checkNotNullExpressionValue(screenName, "screenName");
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "viewTree.toString()");
featureExtractor.sum(fArr, featureExtractor.nonparseFeatures(interactedNode, jSONArray, screenName, jSONObject2, lowerCase));
return fArr;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, FeatureExtractor.class);
return null;
}
}
private final float[] parseFeatures(JSONObject jSONObject) {
boolean contains$default;
boolean contains$default2;
boolean contains$default3;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
float[] fArr = new float[30];
int i = 0;
for (int i2 = 0; i2 < 30; i2++) {
fArr[i2] = 0.0f;
}
String optString = jSONObject.optString("text");
Intrinsics.checkNotNullExpressionValue(optString, "node.optString(TEXT_KEY)");
String lowerCase = optString.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
String optString2 = jSONObject.optString(ViewHierarchyConstants.HINT_KEY);
Intrinsics.checkNotNullExpressionValue(optString2, "node.optString(HINT_KEY)");
String lowerCase2 = optString2.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase2, "(this as java.lang.String).toLowerCase()");
String optString3 = jSONObject.optString(ViewHierarchyConstants.CLASS_NAME_KEY);
Intrinsics.checkNotNullExpressionValue(optString3, "node.optString(CLASS_NAME_KEY)");
String lowerCase3 = optString3.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase3, "(this as java.lang.String).toLowerCase()");
int optInt = jSONObject.optInt(ViewHierarchyConstants.INPUT_TYPE_KEY, -1);
String[] strArr = {lowerCase, lowerCase2};
if (matchIndicators(new String[]{"$", "amount", "price", v8.h.l}, strArr)) {
fArr[0] = fArr[0] + 1.0f;
}
if (matchIndicators(new String[]{REGEX_CR_PASSWORD_FIELD, "pwd"}, strArr)) {
fArr[1] = fArr[1] + 1.0f;
}
if (matchIndicators(new String[]{"tel", "phone"}, strArr)) {
fArr[2] = fArr[2] + 1.0f;
}
if (matchIndicators(new String[]{AppLovinEventTypes.USER_EXECUTED_SEARCH}, strArr)) {
fArr[4] = fArr[4] + 1.0f;
}
if (optInt >= 0) {
fArr[5] = fArr[5] + 1.0f;
}
if (optInt == 3 || optInt == 2) {
fArr[6] = fArr[6] + 1.0f;
}
if (optInt == 32 || Patterns.EMAIL_ADDRESS.matcher(lowerCase).matches()) {
fArr[7] = fArr[7] + 1.0f;
}
contains$default = StringsKt__StringsKt.contains$default(lowerCase3, "checkbox", false, 2, null);
if (contains$default) {
fArr[8] = fArr[8] + 1.0f;
}
if (matchIndicators(new String[]{CampaignEx.JSON_NATIVE_VIDEO_COMPLETE, "confirm", "done", "submit"}, new String[]{lowerCase})) {
fArr[10] = fArr[10] + 1.0f;
}
contains$default2 = StringsKt__StringsKt.contains$default(lowerCase3, "radio", false, 2, null);
if (contains$default2) {
contains$default3 = StringsKt__StringsKt.contains$default(lowerCase3, "button", false, 2, null);
if (contains$default3) {
fArr[12] = fArr[12] + 1.0f;
}
}
try {
JSONArray optJSONArray = jSONObject.optJSONArray(ViewHierarchyConstants.CHILDREN_VIEW_KEY);
int length = optJSONArray.length();
if (length > 0) {
while (true) {
int i3 = i + 1;
JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
Intrinsics.checkNotNullExpressionValue(jSONObject2, "childViews.getJSONObject(i)");
sum(fArr, parseFeatures(jSONObject2));
if (i3 >= length) {
break;
}
i = i3;
}
}
} catch (JSONException unused) {
}
return fArr;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final float[] nonparseFeatures(JSONObject jSONObject, JSONArray jSONArray, String str, String str2, String str3) {
boolean contains$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
float[] fArr = new float[30];
for (int i = 0; i < 30; i++) {
fArr[i] = 0.0f;
}
int length = jSONArray.length();
fArr[3] = length > 1 ? length - 1.0f : 0.0f;
try {
int length2 = jSONArray.length();
if (length2 > 0) {
int i2 = 0;
while (true) {
int i3 = i2 + 1;
JSONObject jSONObject2 = jSONArray.getJSONObject(i2);
Intrinsics.checkNotNullExpressionValue(jSONObject2, "siblings.getJSONObject(i)");
if (isButton(jSONObject2)) {
fArr[9] = fArr[9] + 1.0f;
}
if (i3 >= length2) {
break;
}
i2 = i3;
}
}
} catch (JSONException unused) {
}
fArr[13] = -1.0f;
fArr[14] = -1.0f;
String str4 = str + '|' + str3;
StringBuilder sb = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
updateHintAndTextRecursively(jSONObject, sb2, sb);
String sb3 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb3, "hintSB.toString()");
String sb4 = sb2.toString();
Intrinsics.checkNotNullExpressionValue(sb4, "textSB.toString()");
fArr[15] = regexMatched(ViewHierarchyConstants.ENGLISH, ViewHierarchyConstants.COMPLETE_REGISTRATION, ViewHierarchyConstants.BUTTON_TEXT, sb4) ? 1.0f : 0.0f;
fArr[16] = regexMatched(ViewHierarchyConstants.ENGLISH, ViewHierarchyConstants.COMPLETE_REGISTRATION, ViewHierarchyConstants.PAGE_TITLE, str4) ? 1.0f : 0.0f;
fArr[17] = regexMatched(ViewHierarchyConstants.ENGLISH, ViewHierarchyConstants.COMPLETE_REGISTRATION, ViewHierarchyConstants.BUTTON_ID, sb3) ? 1.0f : 0.0f;
contains$default = StringsKt__StringsKt.contains$default(str2, REGEX_CR_PASSWORD_FIELD, false, 2, null);
fArr[18] = contains$default ? 1.0f : 0.0f;
fArr[19] = regexMatched(REGEX_CR_HAS_CONFIRM_PASSWORD_FIELD, str2) ? 1.0f : 0.0f;
fArr[20] = regexMatched(REGEX_CR_HAS_LOG_IN_KEYWORDS, str2) ? 1.0f : 0.0f;
fArr[21] = regexMatched(REGEX_CR_HAS_SIGN_ON_KEYWORDS, str2) ? 1.0f : 0.0f;
fArr[22] = regexMatched(ViewHierarchyConstants.ENGLISH, ViewHierarchyConstants.PURCHASE, ViewHierarchyConstants.BUTTON_TEXT, sb4) ? 1.0f : 0.0f;
fArr[24] = regexMatched(ViewHierarchyConstants.ENGLISH, ViewHierarchyConstants.PURCHASE, ViewHierarchyConstants.PAGE_TITLE, str4) ? 1.0f : 0.0f;
fArr[25] = regexMatched(REGEX_ADD_TO_CART_BUTTON_TEXT, sb4) ? 1.0f : 0.0f;
fArr[27] = regexMatched(REGEX_ADD_TO_CART_PAGE_TITLE, str4) ? 1.0f : 0.0f;
fArr[28] = regexMatched(ViewHierarchyConstants.ENGLISH, ViewHierarchyConstants.LEAD, ViewHierarchyConstants.BUTTON_TEXT, sb4) ? 1.0f : 0.0f;
fArr[29] = regexMatched(ViewHierarchyConstants.ENGLISH, ViewHierarchyConstants.LEAD, ViewHierarchyConstants.PAGE_TITLE, str4) ? 1.0f : 0.0f;
return fArr;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
/* JADX WARN: Removed duplicated region for block: B:16:0x005c */
/* JADX WARN: Removed duplicated region for block: B:18:0x005d A[Catch: all -> 0x0062, TryCatch #0 {all -> 0x0062, blocks: (B:6:0x0008, B:8:0x000d, B:18:0x005d, B:20:0x0043, B:23:0x004c, B:25:0x0050, B:26:0x0064, B:27:0x0069, B:28:0x0029, B:31:0x0032, B:33:0x0036, B:34:0x006a, B:35:0x006f, B:36:0x0017, B:38:0x001b, B:39:0x0070, B:40:0x0075, B:41:0x0076, B:42:0x007b), top: B:5:0x0008 }] */
/* JADX WARN: Removed duplicated region for block: B:25:0x0050 A[Catch: all -> 0x0062, TryCatch #0 {all -> 0x0062, blocks: (B:6:0x0008, B:8:0x000d, B:18:0x005d, B:20:0x0043, B:23:0x004c, B:25:0x0050, B:26:0x0064, B:27:0x0069, B:28:0x0029, B:31:0x0032, B:33:0x0036, B:34:0x006a, B:35:0x006f, B:36:0x0017, B:38:0x001b, B:39:0x0070, B:40:0x0075, B:41:0x0076, B:42:0x007b), top: B:5:0x0008 }] */
/* JADX WARN: Removed duplicated region for block: B:26:0x0064 A[Catch: all -> 0x0062, TryCatch #0 {all -> 0x0062, blocks: (B:6:0x0008, B:8:0x000d, B:18:0x005d, B:20:0x0043, B:23:0x004c, B:25:0x0050, B:26:0x0064, B:27:0x0069, B:28:0x0029, B:31:0x0032, B:33:0x0036, B:34:0x006a, B:35:0x006f, B:36:0x0017, B:38:0x001b, B:39:0x0070, B:40:0x0075, B:41:0x0076, B:42:0x007b), top: B:5:0x0008 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final boolean regexMatched(java.lang.String r5, java.lang.String r6, java.lang.String r7, java.lang.String r8) {
/*
r4 = this;
boolean r0 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r4)
r1 = 0
if (r0 == 0) goto L8
return r1
L8:
org.json.JSONObject r0 = com.facebook.appevents.suggestedevents.FeatureExtractor.rules // Catch: java.lang.Throwable -> L62
r2 = 0
if (r0 == 0) goto L76
java.lang.String r3 = "rulesForLanguage"
org.json.JSONObject r0 = r0.optJSONObject(r3) // Catch: java.lang.Throwable -> L62
if (r0 != 0) goto L17
r5 = r2
goto L25
L17:
java.util.Map<java.lang.String, java.lang.String> r3 = com.facebook.appevents.suggestedevents.FeatureExtractor.languageInfo // Catch: java.lang.Throwable -> L62
if (r3 == 0) goto L70
java.lang.Object r5 = r3.get(r5) // Catch: java.lang.Throwable -> L62
java.lang.String r5 = (java.lang.String) r5 // Catch: java.lang.Throwable -> L62
org.json.JSONObject r5 = r0.optJSONObject(r5) // Catch: java.lang.Throwable -> L62
L25:
if (r5 != 0) goto L29
L27:
r5 = r2
goto L40
L29:
java.lang.String r0 = "rulesForEvent"
org.json.JSONObject r5 = r5.optJSONObject(r0) // Catch: java.lang.Throwable -> L62
if (r5 != 0) goto L32
goto L27
L32:
java.util.Map<java.lang.String, java.lang.String> r0 = com.facebook.appevents.suggestedevents.FeatureExtractor.eventInfo // Catch: java.lang.Throwable -> L62
if (r0 == 0) goto L6a
java.lang.Object r6 = r0.get(r6) // Catch: java.lang.Throwable -> L62
java.lang.String r6 = (java.lang.String) r6 // Catch: java.lang.Throwable -> L62
org.json.JSONObject r5 = r5.optJSONObject(r6) // Catch: java.lang.Throwable -> L62
L40:
if (r5 != 0) goto L43
goto L5a
L43:
java.lang.String r6 = "positiveRules"
org.json.JSONObject r5 = r5.optJSONObject(r6) // Catch: java.lang.Throwable -> L62
if (r5 != 0) goto L4c
goto L5a
L4c:
java.util.Map<java.lang.String, java.lang.String> r6 = com.facebook.appevents.suggestedevents.FeatureExtractor.textTypeInfo // Catch: java.lang.Throwable -> L62
if (r6 == 0) goto L64
java.lang.Object r6 = r6.get(r7) // Catch: java.lang.Throwable -> L62
java.lang.String r6 = (java.lang.String) r6 // Catch: java.lang.Throwable -> L62
java.lang.String r2 = r5.optString(r6) // Catch: java.lang.Throwable -> L62
L5a:
if (r2 != 0) goto L5d
goto L61
L5d:
boolean r1 = r4.regexMatched(r2, r8) // Catch: java.lang.Throwable -> L62
L61:
return r1
L62:
r5 = move-exception
goto L7c
L64:
java.lang.String r5 = "textTypeInfo"
kotlin.jvm.internal.Intrinsics.throwUninitializedPropertyAccessException(r5) // Catch: java.lang.Throwable -> L62
throw r2 // Catch: java.lang.Throwable -> L62
L6a:
java.lang.String r5 = "eventInfo"
kotlin.jvm.internal.Intrinsics.throwUninitializedPropertyAccessException(r5) // Catch: java.lang.Throwable -> L62
throw r2 // Catch: java.lang.Throwable -> L62
L70:
java.lang.String r5 = "languageInfo"
kotlin.jvm.internal.Intrinsics.throwUninitializedPropertyAccessException(r5) // Catch: java.lang.Throwable -> L62
throw r2 // Catch: java.lang.Throwable -> L62
L76:
java.lang.String r5 = "rules"
kotlin.jvm.internal.Intrinsics.throwUninitializedPropertyAccessException(r5) // Catch: java.lang.Throwable -> L62
throw r2 // Catch: java.lang.Throwable -> L62
L7c:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r5, r4)
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.suggestedevents.FeatureExtractor.regexMatched(java.lang.String, java.lang.String, java.lang.String, java.lang.String):boolean");
}
private final boolean regexMatched(String str, String str2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return Pattern.compile(str).matcher(str2).find();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean matchIndicators(String[] strArr, String[] strArr2) {
boolean contains$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
int length = strArr.length;
int i = 0;
while (i < length) {
String str = strArr[i];
i++;
int length2 = strArr2.length;
int i2 = 0;
while (i2 < length2) {
String str2 = strArr2[i2];
i2++;
contains$default = StringsKt__StringsKt.contains$default(str2, str, false, 2, null);
if (contains$default) {
return true;
}
}
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final boolean pruneTree(JSONObject jSONObject, JSONArray jSONArray) {
boolean z;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
if (jSONObject.optBoolean(ViewHierarchyConstants.IS_INTERACTED_KEY)) {
return true;
}
JSONArray optJSONArray = jSONObject.optJSONArray(ViewHierarchyConstants.CHILDREN_VIEW_KEY);
int length = optJSONArray.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
if (optJSONArray.getJSONObject(i).optBoolean(ViewHierarchyConstants.IS_INTERACTED_KEY)) {
z = true;
break;
}
if (i2 >= length) {
break;
}
i = i2;
}
}
z = false;
boolean z2 = z;
JSONArray jSONArray2 = new JSONArray();
if (z) {
int length2 = optJSONArray.length();
if (length2 > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
jSONArray.put(optJSONArray.getJSONObject(i3));
if (i4 >= length2) {
break;
}
i3 = i4;
}
}
} else {
int length3 = optJSONArray.length();
if (length3 > 0) {
int i5 = 0;
while (true) {
int i6 = i5 + 1;
JSONObject child = optJSONArray.getJSONObject(i5);
Intrinsics.checkNotNullExpressionValue(child, "child");
if (pruneTree(child, jSONArray)) {
jSONArray2.put(child);
z2 = true;
}
if (i6 >= length3) {
break;
}
i5 = i6;
}
}
jSONObject.put(ViewHierarchyConstants.CHILDREN_VIEW_KEY, jSONArray2);
}
return z2;
} catch (JSONException unused) {
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final void sum(float[] fArr, float[] fArr2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
int length = fArr.length - 1;
if (length < 0) {
return;
}
int i = 0;
while (true) {
int i2 = i + 1;
fArr[i] = fArr[i] + fArr2[i];
if (i2 > length) {
return;
} else {
i = i2;
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final boolean isButton(JSONObject jSONObject) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return ((jSONObject.optInt(ViewHierarchyConstants.CLASS_TYPE_BITMASK_KEY) & 1) << 5) > 0;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
private final void updateHintAndTextRecursively(JSONObject jSONObject, StringBuilder sb, StringBuilder sb2) {
int length;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
String optString = jSONObject.optString("text", "");
Intrinsics.checkNotNullExpressionValue(optString, "view.optString(TEXT_KEY, \"\")");
String lowerCase = optString.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
String optString2 = jSONObject.optString(ViewHierarchyConstants.HINT_KEY, "");
Intrinsics.checkNotNullExpressionValue(optString2, "view.optString(HINT_KEY, \"\")");
String lowerCase2 = optString2.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase2, "(this as java.lang.String).toLowerCase()");
if (lowerCase.length() > 0) {
sb.append(lowerCase);
sb.append(" ");
}
if (lowerCase2.length() > 0) {
sb2.append(lowerCase2);
sb2.append(" ");
}
JSONArray optJSONArray = jSONObject.optJSONArray(ViewHierarchyConstants.CHILDREN_VIEW_KEY);
if (optJSONArray == null || (length = optJSONArray.length()) <= 0) {
return;
}
int i = 0;
while (true) {
int i2 = i + 1;
try {
JSONObject currentChildView = optJSONArray.getJSONObject(i);
Intrinsics.checkNotNullExpressionValue(currentChildView, "currentChildView");
updateHintAndTextRecursively(currentChildView, sb, sb2);
} catch (JSONException unused) {
}
if (i2 >= length) {
return;
} else {
i = i2;
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final JSONObject getInteractedNode(JSONObject jSONObject) {
int length;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
} catch (JSONException unused) {
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
if (jSONObject.optBoolean(ViewHierarchyConstants.IS_INTERACTED_KEY)) {
return jSONObject;
}
JSONArray optJSONArray = jSONObject.optJSONArray(ViewHierarchyConstants.CHILDREN_VIEW_KEY);
if (optJSONArray != null && (length = optJSONArray.length()) > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
Intrinsics.checkNotNullExpressionValue(jSONObject2, "children.getJSONObject(i)");
JSONObject interactedNode = getInteractedNode(jSONObject2);
if (interactedNode != null) {
return interactedNode;
}
if (i2 >= length) {
break;
}
i = i2;
}
}
return null;
}
}

View File

@@ -0,0 +1,132 @@
package com.facebook.appevents.suggestedevents;
import android.content.SharedPreferences;
import android.view.View;
import com.facebook.FacebookSdk;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class PredictionHistoryManager {
private static final String CLICKED_PATH_STORE = "com.facebook.internal.SUGGESTED_EVENTS_HISTORY";
private static final String SUGGESTED_EVENTS_HISTORY = "SUGGESTED_EVENTS_HISTORY";
private static SharedPreferences shardPreferences;
public static final PredictionHistoryManager INSTANCE = new PredictionHistoryManager();
private static final Map<String, String> clickedViewPaths = new LinkedHashMap();
private static final AtomicBoolean initialized = new AtomicBoolean(false);
private PredictionHistoryManager() {
}
private final void initAndWait() {
String str = "";
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
AtomicBoolean atomicBoolean = initialized;
if (atomicBoolean.get()) {
return;
}
SharedPreferences sharedPreferences = FacebookSdk.getApplicationContext().getSharedPreferences(CLICKED_PATH_STORE, 0);
Intrinsics.checkNotNullExpressionValue(sharedPreferences, "FacebookSdk.getApplicationContext()\n .getSharedPreferences(CLICKED_PATH_STORE, Context.MODE_PRIVATE)");
shardPreferences = sharedPreferences;
Map<String, String> map = clickedViewPaths;
Utility utility = Utility.INSTANCE;
SharedPreferences sharedPreferences2 = shardPreferences;
if (sharedPreferences2 != null) {
String string = sharedPreferences2.getString(SUGGESTED_EVENTS_HISTORY, "");
if (string != null) {
str = string;
}
map.putAll(Utility.jsonStrToMap(str));
atomicBoolean.set(true);
return;
}
Intrinsics.throwUninitializedPropertyAccessException("shardPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final void addPrediction(String pathID, String predictedEvent) {
Map map;
if (CrashShieldHandler.isObjectCrashing(PredictionHistoryManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(pathID, "pathID");
Intrinsics.checkNotNullParameter(predictedEvent, "predictedEvent");
if (!initialized.get()) {
INSTANCE.initAndWait();
}
Map<String, String> map2 = clickedViewPaths;
map2.put(pathID, predictedEvent);
SharedPreferences sharedPreferences = shardPreferences;
if (sharedPreferences == null) {
Intrinsics.throwUninitializedPropertyAccessException("shardPreferences");
throw null;
}
SharedPreferences.Editor edit = sharedPreferences.edit();
Utility utility = Utility.INSTANCE;
map = MapsKt__MapsKt.toMap(map2);
edit.putString(SUGGESTED_EVENTS_HISTORY, Utility.mapToJsonStr(map)).apply();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, PredictionHistoryManager.class);
}
}
public static final String getPathID(View view, String text) {
if (CrashShieldHandler.isObjectCrashing(PredictionHistoryManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(text, "text");
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("text", text);
JSONArray jSONArray = new JSONArray();
while (view != null) {
jSONArray.put(view.getClass().getSimpleName());
view = ViewHierarchy.getParentOfView(view);
}
jSONObject.put(ViewHierarchyConstants.CLASS_NAME_KEY, jSONArray);
} catch (JSONException unused) {
}
Utility utility = Utility.INSTANCE;
return Utility.sha256hash(jSONObject.toString());
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, PredictionHistoryManager.class);
return null;
}
}
public static final String queryEvent(String pathID) {
if (CrashShieldHandler.isObjectCrashing(PredictionHistoryManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(pathID, "pathID");
Map<String, String> map = clickedViewPaths;
if (map.containsKey(pathID)) {
return map.get(pathID);
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, PredictionHistoryManager.class);
return null;
}
}
}

View File

@@ -0,0 +1,160 @@
package com.facebook.appevents.suggestedevents;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.RatingBar;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.TimePicker;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class SuggestedEventViewHierarchy {
public static final SuggestedEventViewHierarchy INSTANCE = new SuggestedEventViewHierarchy();
private static final List<Class<? extends View>> blacklistedViews;
private SuggestedEventViewHierarchy() {
}
static {
List<Class<? extends View>> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new Class[]{Switch.class, Spinner.class, DatePicker.class, TimePicker.class, RadioGroup.class, RatingBar.class, EditText.class, AdapterView.class});
blacklistedViews = listOf;
}
public static final JSONObject getDictionaryOfView(View view, View clickedView) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventViewHierarchy.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(clickedView, "clickedView");
JSONObject jSONObject = new JSONObject();
if (view == clickedView) {
try {
jSONObject.put(ViewHierarchyConstants.IS_INTERACTED_KEY, true);
} catch (JSONException unused) {
}
}
updateBasicInfo(view, jSONObject);
JSONArray jSONArray = new JSONArray();
Iterator<View> it = ViewHierarchy.getChildrenOfView(view).iterator();
while (it.hasNext()) {
jSONArray.put(getDictionaryOfView(it.next(), clickedView));
}
jSONObject.put(ViewHierarchyConstants.CHILDREN_VIEW_KEY, jSONArray);
return jSONObject;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventViewHierarchy.class);
return null;
}
}
public static final void updateBasicInfo(View view, JSONObject json) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventViewHierarchy.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(json, "json");
try {
String textOfView = ViewHierarchy.getTextOfView(view);
String hintOfView = ViewHierarchy.getHintOfView(view);
json.put(ViewHierarchyConstants.CLASS_NAME_KEY, view.getClass().getSimpleName());
json.put(ViewHierarchyConstants.CLASS_TYPE_BITMASK_KEY, ViewHierarchy.getClassTypeBitmask(view));
if (textOfView.length() > 0) {
json.put("text", textOfView);
}
if (hintOfView.length() > 0) {
json.put(ViewHierarchyConstants.HINT_KEY, hintOfView);
}
if (view instanceof EditText) {
json.put(ViewHierarchyConstants.INPUT_TYPE_KEY, ((EditText) view).getInputType());
}
} catch (JSONException unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventViewHierarchy.class);
}
}
public static final List<View> getAllClickableViews(View view) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventViewHierarchy.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
ArrayList arrayList = new ArrayList();
Iterator<Class<? extends View>> it = blacklistedViews.iterator();
while (it.hasNext()) {
if (it.next().isInstance(view)) {
return arrayList;
}
}
if (view.isClickable()) {
arrayList.add(view);
}
Iterator<View> it2 = ViewHierarchy.getChildrenOfView(view).iterator();
while (it2.hasNext()) {
arrayList.addAll(getAllClickableViews(it2.next()));
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventViewHierarchy.class);
return null;
}
}
public static final String getTextOfViewRecursively(View hostView) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventViewHierarchy.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(hostView, "hostView");
String textOfView = ViewHierarchy.getTextOfView(hostView);
if (textOfView.length() > 0) {
return textOfView;
}
String join = TextUtils.join(" ", INSTANCE.getTextOfChildren(hostView));
Intrinsics.checkNotNullExpressionValue(join, "join(\" \", childrenText)");
return join;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventViewHierarchy.class);
return null;
}
}
private final List<String> getTextOfChildren(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ArrayList arrayList = new ArrayList();
for (View view2 : ViewHierarchy.getChildrenOfView(view)) {
String textOfView = ViewHierarchy.getTextOfView(view2);
if (textOfView.length() > 0) {
arrayList.add(textOfView);
}
arrayList.addAll(getTextOfChildren(view2));
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,204 @@
package com.facebook.appevents.suggestedevents;
import android.app.Activity;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.appevents.internal.ActivityLifecycleTracker;
import com.facebook.appevents.ml.ModelManager;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.File;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class SuggestedEventsManager {
private static final String ELIGIBLE_EVENTS_KEY = "eligible_for_prediction_events";
private static final String PRODUCTION_EVENTS_KEY = "production_events";
public static final SuggestedEventsManager INSTANCE = new SuggestedEventsManager();
private static final AtomicBoolean enabled = new AtomicBoolean(false);
private static final Set<String> productionEvents = new LinkedHashSet();
private static final Set<String> eligibleEvents = new LinkedHashSet();
private SuggestedEventsManager() {
}
public static final synchronized void enable() {
synchronized (SuggestedEventsManager.class) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventsManager.class)) {
return;
}
try {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.suggestedevents.SuggestedEventsManager$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
SuggestedEventsManager.m521enable$lambda0();
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventsManager.class);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: enable$lambda-0, reason: not valid java name */
public static final void m521enable$lambda0() {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventsManager.class)) {
return;
}
try {
AtomicBoolean atomicBoolean = enabled;
if (atomicBoolean.get()) {
return;
}
atomicBoolean.set(true);
INSTANCE.initialize();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventsManager.class);
}
}
private final void initialize() {
String suggestedEventsSetting;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.INSTANCE;
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
if (queryAppSettings == null || (suggestedEventsSetting = queryAppSettings.getSuggestedEventsSetting()) == null) {
return;
}
populateEventsFromRawJsonString$facebook_core_release(suggestedEventsSetting);
if (!(!productionEvents.isEmpty()) && !(!eligibleEvents.isEmpty())) {
return;
}
ModelManager modelManager = ModelManager.INSTANCE;
File ruleFile = ModelManager.getRuleFile(ModelManager.Task.MTML_APP_EVENT_PREDICTION);
if (ruleFile == null) {
return;
}
FeatureExtractor.initialize(ruleFile);
Activity currentActivity = ActivityLifecycleTracker.getCurrentActivity();
if (currentActivity != null) {
trackActivity(currentActivity);
}
} catch (Exception unused) {
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@VisibleForTesting(otherwise = 2)
public final void populateEventsFromRawJsonString$facebook_core_release(String str) {
JSONArray jSONArray;
int length;
JSONArray jSONArray2;
int length2;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
JSONObject jSONObject = new JSONObject(str);
int i = 0;
if (jSONObject.has(PRODUCTION_EVENTS_KEY) && (length2 = (jSONArray2 = jSONObject.getJSONArray(PRODUCTION_EVENTS_KEY)).length()) > 0) {
int i2 = 0;
while (true) {
int i3 = i2 + 1;
Set<String> set = productionEvents;
String string = jSONArray2.getString(i2);
Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
set.add(string);
if (i3 >= length2) {
break;
} else {
i2 = i3;
}
}
}
if (!jSONObject.has(ELIGIBLE_EVENTS_KEY) || (length = (jSONArray = jSONObject.getJSONArray(ELIGIBLE_EVENTS_KEY)).length()) <= 0) {
return;
}
while (true) {
int i4 = i + 1;
Set<String> set2 = eligibleEvents;
String string2 = jSONArray.getString(i);
Intrinsics.checkNotNullExpressionValue(string2, "jsonArray.getString(i)");
set2.add(string2);
if (i4 >= length) {
return;
} else {
i = i4;
}
}
} catch (Exception unused) {
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final void trackActivity(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventsManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
try {
if (!enabled.get() || !FeatureExtractor.isInitialized() || (productionEvents.isEmpty() && eligibleEvents.isEmpty())) {
ViewObserver.Companion.stopTrackingActivity(activity);
return;
}
ViewObserver.Companion.startTrackingActivity(activity);
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventsManager.class);
}
}
public static final boolean isEnabled() {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventsManager.class)) {
return false;
}
try {
return enabled.get();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventsManager.class);
return false;
}
}
public static final boolean isProductionEvents$facebook_core_release(String event) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventsManager.class)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(event, "event");
return productionEvents.contains(event);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventsManager.class);
return false;
}
}
public static final boolean isEligibleEvents$facebook_core_release(String event) {
if (CrashShieldHandler.isObjectCrashing(SuggestedEventsManager.class)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(event, "event");
return eligibleEvents.contains(event);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, SuggestedEventsManager.class);
return false;
}
}
}

View File

@@ -0,0 +1,233 @@
package com.facebook.appevents.suggestedevents;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.ViewTreeObserver;
import com.facebook.appevents.codeless.internal.SensitiveUserDataUtils;
import com.facebook.appevents.internal.AppEventUtility;
import com.facebook.appevents.suggestedevents.ViewOnClickListener;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ViewObserver implements ViewTreeObserver.OnGlobalLayoutListener {
private static final int MAX_TEXT_LENGTH = 300;
private final WeakReference<Activity> activityWeakReference;
private final AtomicBoolean isTracking;
private final Handler uiThreadHandler;
public static final Companion Companion = new Companion(null);
private static final Map<Integer, ViewObserver> observers = new HashMap();
public /* synthetic */ ViewObserver(Activity activity, DefaultConstructorMarker defaultConstructorMarker) {
this(activity);
}
public static final void startTrackingActivity(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(ViewObserver.class)) {
return;
}
try {
Companion.startTrackingActivity(activity);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewObserver.class);
}
}
public static final void stopTrackingActivity(Activity activity) {
if (CrashShieldHandler.isObjectCrashing(ViewObserver.class)) {
return;
}
try {
Companion.stopTrackingActivity(activity);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewObserver.class);
}
}
private ViewObserver(Activity activity) {
this.activityWeakReference = new WeakReference<>(activity);
this.uiThreadHandler = new Handler(Looper.getMainLooper());
this.isTracking = new AtomicBoolean(false);
}
public static final /* synthetic */ Map access$getObservers$cp() {
if (CrashShieldHandler.isObjectCrashing(ViewObserver.class)) {
return null;
}
try {
return observers;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewObserver.class);
return null;
}
}
public static final /* synthetic */ void access$startTracking(ViewObserver viewObserver) {
if (CrashShieldHandler.isObjectCrashing(ViewObserver.class)) {
return;
}
try {
viewObserver.startTracking();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewObserver.class);
}
}
public static final /* synthetic */ void access$stopTracking(ViewObserver viewObserver) {
if (CrashShieldHandler.isObjectCrashing(ViewObserver.class)) {
return;
}
try {
viewObserver.stopTracking();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewObserver.class);
}
}
private final void startTracking() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (this.isTracking.getAndSet(true)) {
return;
}
AppEventUtility appEventUtility = AppEventUtility.INSTANCE;
View rootView = AppEventUtility.getRootView(this.activityWeakReference.get());
if (rootView == null) {
return;
}
ViewTreeObserver viewTreeObserver = rootView.getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.addOnGlobalLayoutListener(this);
process();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void stopTracking() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (this.isTracking.getAndSet(false)) {
AppEventUtility appEventUtility = AppEventUtility.INSTANCE;
View rootView = AppEventUtility.getRootView(this.activityWeakReference.get());
if (rootView == null) {
return;
}
ViewTreeObserver viewTreeObserver = rootView.getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.removeOnGlobalLayoutListener(this);
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
public void onGlobalLayout() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
process();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void process() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Runnable runnable = new Runnable() { // from class: com.facebook.appevents.suggestedevents.ViewObserver$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ViewObserver.m522process$lambda0(ViewObserver.this);
}
};
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
runnable.run();
} else {
this.uiThreadHandler.post(runnable);
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: process$lambda-0, reason: not valid java name */
public static final void m522process$lambda0(ViewObserver this$0) {
if (CrashShieldHandler.isObjectCrashing(ViewObserver.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(this$0, "this$0");
try {
AppEventUtility appEventUtility = AppEventUtility.INSTANCE;
View rootView = AppEventUtility.getRootView(this$0.activityWeakReference.get());
Activity activity = this$0.activityWeakReference.get();
if (rootView != null && activity != null) {
for (View view : SuggestedEventViewHierarchy.getAllClickableViews(rootView)) {
if (!SensitiveUserDataUtils.isSensitiveUserData(view)) {
String textOfViewRecursively = SuggestedEventViewHierarchy.getTextOfViewRecursively(view);
if (textOfViewRecursively.length() > 0 && textOfViewRecursively.length() <= 300) {
ViewOnClickListener.Companion companion = ViewOnClickListener.Companion;
String localClassName = activity.getLocalClassName();
Intrinsics.checkNotNullExpressionValue(localClassName, "activity.localClassName");
companion.attachListener$facebook_core_release(view, rootView, localClassName);
}
}
}
}
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewObserver.class);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final void startTrackingActivity(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
int hashCode = activity.hashCode();
Map access$getObservers$cp = ViewObserver.access$getObservers$cp();
Integer valueOf = Integer.valueOf(hashCode);
Object obj = access$getObservers$cp.get(valueOf);
if (obj == null) {
obj = new ViewObserver(activity, null);
access$getObservers$cp.put(valueOf, obj);
}
ViewObserver.access$startTracking((ViewObserver) obj);
}
public final void stopTrackingActivity(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ViewObserver viewObserver = (ViewObserver) ViewObserver.access$getObservers$cp().remove(Integer.valueOf(activity.hashCode()));
if (viewObserver == null) {
return;
}
ViewObserver.access$stopTracking(viewObserver);
}
}
}

View File

@@ -0,0 +1,283 @@
package com.facebook.appevents.suggestedevents;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.appevents.codeless.internal.ViewHierarchy;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.appevents.ml.ModelManager;
import com.facebook.appevents.suggestedevents.ViewOnClickListener;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.tapjoy.TJAdUnitConstants;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes2.dex */
public final class ViewOnClickListener implements View.OnClickListener {
private static final String API_ENDPOINT = "%s/suggested_events";
public static final String OTHER_EVENT = "other";
private final String activityName;
private final View.OnClickListener baseListener;
private final WeakReference<View> hostViewWeakReference;
private final WeakReference<View> rootViewWeakReference;
public static final Companion Companion = new Companion(null);
private static final Set<Integer> viewsAttachedListener = new HashSet();
public /* synthetic */ ViewOnClickListener(View view, View view2, String str, DefaultConstructorMarker defaultConstructorMarker) {
this(view, view2, str);
}
public static final void attachListener$facebook_core_release(View view, View view2, String str) {
if (CrashShieldHandler.isObjectCrashing(ViewOnClickListener.class)) {
return;
}
try {
Companion.attachListener$facebook_core_release(view, view2, str);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewOnClickListener.class);
}
}
private ViewOnClickListener(View view, View view2, String str) {
String replace$default;
this.baseListener = ViewHierarchy.getExistingOnClickListener(view);
this.rootViewWeakReference = new WeakReference<>(view2);
this.hostViewWeakReference = new WeakReference<>(view);
if (str == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String lowerCase = str.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
replace$default = StringsKt__StringsJVMKt.replace$default(lowerCase, "activity", "", false, 4, (Object) null);
this.activityName = replace$default;
}
public static final /* synthetic */ Set access$getViewsAttachedListener$cp() {
if (CrashShieldHandler.isObjectCrashing(ViewOnClickListener.class)) {
return null;
}
try {
return viewsAttachedListener;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewOnClickListener.class);
return null;
}
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(view, "view");
View.OnClickListener onClickListener = this.baseListener;
if (onClickListener != null) {
onClickListener.onClick(view);
}
process();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
}
}
private final void process() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
View view = this.rootViewWeakReference.get();
View view2 = this.hostViewWeakReference.get();
if (view == null || view2 == null) {
return;
}
try {
String textOfViewRecursively = SuggestedEventViewHierarchy.getTextOfViewRecursively(view2);
String pathID = PredictionHistoryManager.getPathID(view2, textOfViewRecursively);
if (pathID == null || Companion.queryHistoryAndProcess(pathID, textOfViewRecursively)) {
return;
}
JSONObject jSONObject = new JSONObject();
jSONObject.put("view", SuggestedEventViewHierarchy.getDictionaryOfView(view, view2));
jSONObject.put(ViewHierarchyConstants.SCREEN_NAME_KEY, this.activityName);
predictAndProcess(pathID, textOfViewRecursively, jSONObject);
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void predictAndProcess(final String str, final String str2, final JSONObject jSONObject) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Utility utility = Utility.INSTANCE;
Utility.runOnNonUiThread(new Runnable() { // from class: com.facebook.appevents.suggestedevents.ViewOnClickListener$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ViewOnClickListener.m523predictAndProcess$lambda0(jSONObject, str2, this, str);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: predictAndProcess$lambda-0, reason: not valid java name */
public static final void m523predictAndProcess$lambda0(JSONObject viewData, String buttonText, ViewOnClickListener this$0, String pathID) {
if (CrashShieldHandler.isObjectCrashing(ViewOnClickListener.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(viewData, "$viewData");
Intrinsics.checkNotNullParameter(buttonText, "$buttonText");
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(pathID, "$pathID");
try {
Utility utility = Utility.INSTANCE;
String appName = Utility.getAppName(FacebookSdk.getApplicationContext());
if (appName == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String lowerCase = appName.toLowerCase();
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
float[] denseFeatures = FeatureExtractor.getDenseFeatures(viewData, lowerCase);
String textFeature = FeatureExtractor.getTextFeature(buttonText, this$0.activityName, lowerCase);
if (denseFeatures == null) {
return;
}
ModelManager modelManager = ModelManager.INSTANCE;
String[] predict = ModelManager.predict(ModelManager.Task.MTML_APP_EVENT_PREDICTION, new float[][]{denseFeatures}, new String[]{textFeature});
if (predict == null) {
return;
}
String str = predict[0];
PredictionHistoryManager.addPrediction(pathID, str);
if (Intrinsics.areEqual(str, "other")) {
return;
}
Companion.processPredictedResult(str, buttonText, denseFeatures);
} catch (Exception unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ViewOnClickListener.class);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final void attachListener$facebook_core_release(View hostView, View rootView, String activityName) {
Intrinsics.checkNotNullParameter(hostView, "hostView");
Intrinsics.checkNotNullParameter(rootView, "rootView");
Intrinsics.checkNotNullParameter(activityName, "activityName");
int hashCode = hostView.hashCode();
if (ViewOnClickListener.access$getViewsAttachedListener$cp().contains(Integer.valueOf(hashCode))) {
return;
}
ViewHierarchy viewHierarchy = ViewHierarchy.INSTANCE;
ViewHierarchy.setOnClickListener(hostView, new ViewOnClickListener(hostView, rootView, activityName, null));
ViewOnClickListener.access$getViewsAttachedListener$cp().add(Integer.valueOf(hashCode));
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean queryHistoryAndProcess(String str, final String str2) {
final String queryEvent = PredictionHistoryManager.queryEvent(str);
if (queryEvent == null) {
return false;
}
if (Intrinsics.areEqual(queryEvent, "other")) {
return true;
}
Utility utility = Utility.INSTANCE;
Utility.runOnNonUiThread(new Runnable() { // from class: com.facebook.appevents.suggestedevents.ViewOnClickListener$Companion$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ViewOnClickListener.Companion.m524queryHistoryAndProcess$lambda0(queryEvent, str2);
}
});
return true;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: queryHistoryAndProcess$lambda-0, reason: not valid java name */
public static final void m524queryHistoryAndProcess$lambda0(String queriedEvent, String buttonText) {
Intrinsics.checkNotNullParameter(queriedEvent, "$queriedEvent");
Intrinsics.checkNotNullParameter(buttonText, "$buttonText");
ViewOnClickListener.Companion.processPredictedResult(queriedEvent, buttonText, new float[0]);
}
/* JADX INFO: Access modifiers changed from: private */
public final void processPredictedResult(String str, String str2, float[] fArr) {
if (SuggestedEventsManager.isProductionEvents$facebook_core_release(str)) {
new InternalAppEventsLogger(FacebookSdk.getApplicationContext()).logEventFromSE(str, str2);
} else if (SuggestedEventsManager.isEligibleEvents$facebook_core_release(str)) {
sendPredictedResult(str, str2, fArr);
}
}
private final void sendPredictedResult(String str, String str2, float[] fArr) {
Bundle bundle = new Bundle();
try {
bundle.putString(TJAdUnitConstants.PARAM_PLACEMENT_NAME, str);
JSONObject jSONObject = new JSONObject();
StringBuilder sb = new StringBuilder();
int length = fArr.length;
int i = 0;
while (i < length) {
float f = fArr[i];
i++;
sb.append(f);
sb.append(",");
}
jSONObject.put("dense", sb.toString());
jSONObject.put("button_text", str2);
bundle.putString("metadata", jSONObject.toString());
GraphRequest.Companion companion = GraphRequest.Companion;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, ViewOnClickListener.API_ENDPOINT, Arrays.copyOf(new Object[]{FacebookSdk.getApplicationId()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
GraphRequest newPostRequest = companion.newPostRequest(null, format, null, null);
newPostRequest.setParameters(bundle);
newPostRequest.executeAndWait();
} catch (JSONException unused) {
}
}
}
}