- 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
185 lines
7.9 KiB
Java
185 lines
7.9 KiB
Java
package androidx.datastore.preferences.protobuf;
|
|
|
|
import androidx.datastore.preferences.protobuf.GeneratedMessageLite;
|
|
import com.ironsource.v8;
|
|
import java.lang.reflect.Modifier;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.TreeSet;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class MessageLiteToString {
|
|
private static final String BUILDER_LIST_SUFFIX = "OrBuilderList";
|
|
private static final String BYTES_SUFFIX = "Bytes";
|
|
private static final String LIST_SUFFIX = "List";
|
|
private static final String MAP_SUFFIX = "Map";
|
|
|
|
public static String toString(MessageLite messageLite, String str) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("# ");
|
|
sb.append(str);
|
|
reflectivePrintWithIndent(messageLite, sb, 0);
|
|
return sb.toString();
|
|
}
|
|
|
|
private static void reflectivePrintWithIndent(MessageLite messageLite, StringBuilder sb, int i) {
|
|
HashMap hashMap = new HashMap();
|
|
HashMap hashMap2 = new HashMap();
|
|
TreeSet<String> treeSet = new TreeSet();
|
|
for (java.lang.reflect.Method method : messageLite.getClass().getDeclaredMethods()) {
|
|
hashMap2.put(method.getName(), method);
|
|
if (method.getParameterTypes().length == 0) {
|
|
hashMap.put(method.getName(), method);
|
|
if (method.getName().startsWith("get")) {
|
|
treeSet.add(method.getName());
|
|
}
|
|
}
|
|
}
|
|
for (String str : treeSet) {
|
|
String replaceFirst = str.replaceFirst("get", "");
|
|
if (replaceFirst.endsWith(LIST_SUFFIX) && !replaceFirst.endsWith(BUILDER_LIST_SUFFIX) && !replaceFirst.equals(LIST_SUFFIX)) {
|
|
String str2 = replaceFirst.substring(0, 1).toLowerCase() + replaceFirst.substring(1, replaceFirst.length() - 4);
|
|
java.lang.reflect.Method method2 = (java.lang.reflect.Method) hashMap.get(str);
|
|
if (method2 != null && method2.getReturnType().equals(List.class)) {
|
|
printField(sb, i, camelCaseToSnakeCase(str2), GeneratedMessageLite.invokeOrDie(method2, messageLite, new Object[0]));
|
|
}
|
|
}
|
|
if (replaceFirst.endsWith(MAP_SUFFIX) && !replaceFirst.equals(MAP_SUFFIX)) {
|
|
String str3 = replaceFirst.substring(0, 1).toLowerCase() + replaceFirst.substring(1, replaceFirst.length() - 3);
|
|
java.lang.reflect.Method method3 = (java.lang.reflect.Method) hashMap.get(str);
|
|
if (method3 != null && method3.getReturnType().equals(Map.class) && !method3.isAnnotationPresent(Deprecated.class) && Modifier.isPublic(method3.getModifiers())) {
|
|
printField(sb, i, camelCaseToSnakeCase(str3), GeneratedMessageLite.invokeOrDie(method3, messageLite, new Object[0]));
|
|
}
|
|
}
|
|
if (((java.lang.reflect.Method) hashMap2.get("set" + replaceFirst)) != null) {
|
|
if (replaceFirst.endsWith(BYTES_SUFFIX)) {
|
|
if (hashMap.containsKey("get" + replaceFirst.substring(0, replaceFirst.length() - 5))) {
|
|
}
|
|
}
|
|
String str4 = replaceFirst.substring(0, 1).toLowerCase() + replaceFirst.substring(1);
|
|
java.lang.reflect.Method method4 = (java.lang.reflect.Method) hashMap.get("get" + replaceFirst);
|
|
java.lang.reflect.Method method5 = (java.lang.reflect.Method) hashMap.get("has" + replaceFirst);
|
|
if (method4 != null) {
|
|
Object invokeOrDie = GeneratedMessageLite.invokeOrDie(method4, messageLite, new Object[0]);
|
|
if (method5 == null) {
|
|
if (!isDefaultValue(invokeOrDie)) {
|
|
printField(sb, i, camelCaseToSnakeCase(str4), invokeOrDie);
|
|
}
|
|
} else if (((Boolean) GeneratedMessageLite.invokeOrDie(method5, messageLite, new Object[0])).booleanValue()) {
|
|
printField(sb, i, camelCaseToSnakeCase(str4), invokeOrDie);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (messageLite instanceof GeneratedMessageLite.ExtendableMessage) {
|
|
Iterator<Map.Entry<GeneratedMessageLite.ExtensionDescriptor, Object>> it = ((GeneratedMessageLite.ExtendableMessage) messageLite).extensions.iterator();
|
|
while (it.hasNext()) {
|
|
Map.Entry<GeneratedMessageLite.ExtensionDescriptor, Object> next = it.next();
|
|
printField(sb, i, v8.i.d + next.getKey().getNumber() + v8.i.e, next.getValue());
|
|
}
|
|
}
|
|
UnknownFieldSetLite unknownFieldSetLite = ((GeneratedMessageLite) messageLite).unknownFields;
|
|
if (unknownFieldSetLite != null) {
|
|
unknownFieldSetLite.printWithIndent(sb, i);
|
|
}
|
|
}
|
|
|
|
private static boolean isDefaultValue(Object obj) {
|
|
if (obj instanceof Boolean) {
|
|
return !((Boolean) obj).booleanValue();
|
|
}
|
|
if (obj instanceof Integer) {
|
|
return ((Integer) obj).intValue() == 0;
|
|
}
|
|
if (obj instanceof Float) {
|
|
return ((Float) obj).floatValue() == 0.0f;
|
|
}
|
|
if (obj instanceof Double) {
|
|
return ((Double) obj).doubleValue() == 0.0d;
|
|
}
|
|
if (obj instanceof String) {
|
|
return obj.equals("");
|
|
}
|
|
if (obj instanceof ByteString) {
|
|
return obj.equals(ByteString.EMPTY);
|
|
}
|
|
return obj instanceof MessageLite ? obj == ((MessageLite) obj).getDefaultInstanceForType() : (obj instanceof java.lang.Enum) && ((java.lang.Enum) obj).ordinal() == 0;
|
|
}
|
|
|
|
public static final void printField(StringBuilder sb, int i, String str, Object obj) {
|
|
if (obj instanceof List) {
|
|
Iterator it = ((List) obj).iterator();
|
|
while (it.hasNext()) {
|
|
printField(sb, i, str, it.next());
|
|
}
|
|
return;
|
|
}
|
|
if (obj instanceof Map) {
|
|
Iterator it2 = ((Map) obj).entrySet().iterator();
|
|
while (it2.hasNext()) {
|
|
printField(sb, i, str, (Map.Entry) it2.next());
|
|
}
|
|
return;
|
|
}
|
|
sb.append('\n');
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
sb.append(' ');
|
|
}
|
|
sb.append(str);
|
|
if (obj instanceof String) {
|
|
sb.append(": \"");
|
|
sb.append(TextFormatEscaper.escapeText((String) obj));
|
|
sb.append('\"');
|
|
return;
|
|
}
|
|
if (obj instanceof ByteString) {
|
|
sb.append(": \"");
|
|
sb.append(TextFormatEscaper.escapeBytes((ByteString) obj));
|
|
sb.append('\"');
|
|
return;
|
|
}
|
|
if (obj instanceof GeneratedMessageLite) {
|
|
sb.append(" {");
|
|
reflectivePrintWithIndent((GeneratedMessageLite) obj, sb, i + 2);
|
|
sb.append("\n");
|
|
while (i2 < i) {
|
|
sb.append(' ');
|
|
i2++;
|
|
}
|
|
sb.append("}");
|
|
return;
|
|
}
|
|
if (obj instanceof Map.Entry) {
|
|
sb.append(" {");
|
|
Map.Entry entry = (Map.Entry) obj;
|
|
int i4 = i + 2;
|
|
printField(sb, i4, "key", entry.getKey());
|
|
printField(sb, i4, "value", entry.getValue());
|
|
sb.append("\n");
|
|
while (i2 < i) {
|
|
sb.append(' ');
|
|
i2++;
|
|
}
|
|
sb.append("}");
|
|
return;
|
|
}
|
|
sb.append(": ");
|
|
sb.append(obj.toString());
|
|
}
|
|
|
|
private static final String camelCaseToSnakeCase(String str) {
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < str.length(); i++) {
|
|
char charAt = str.charAt(i);
|
|
if (Character.isUpperCase(charAt)) {
|
|
sb.append("_");
|
|
}
|
|
sb.append(Character.toLowerCase(charAt));
|
|
}
|
|
return sb.toString();
|
|
}
|
|
}
|