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