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