soul-browser/sources/java/com/google/api/client/util/ClassInfo.java
KaKi87 550ddb0413
Decompile and recreate Soul Browser v1.4.85 with APK CI builds (#1)
* Decompile and recreate Soul Browser v1.4.85 with APK CI builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix CI build: include bundled google.jks and remove PR trigger

The apktool build failed in CI because app/unknown/.../google.jks was
excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files
and commit the missing resource.

Also remove the redundant pull_request workflow trigger.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Change package ID to com.github.kaki87.soulbrowser

Rename the application ID so the rebuilt APK can be installed
alongside the original Soul Browser from Google Play.

- Update AndroidManifest package, permissions, providers, and actions
- Update R class references in smali (com/github/kaki87/soulbrowser/R)
- Update shortcuts.xml targetPackage
- Rename app label to "Soul Rebuild" for easy identification

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install compatibility: remove split APK metadata and bundle native libs

The rebuilt APK still declared requiredSplitTypes and Play Store split
metadata, causing Android to reject standalone installs as incompatible.

- Remove requiredSplitTypes and split-related manifest meta-data
- Merge native libs from all ABI splits with uncompressed storage
- Page-align before signing for extractNativeLibs=false
- Add .so to apktool doNotCompress list

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install failure: use apksigner v2/v3 and bundle arm64 native libs

Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only
produces v1 signatures, causing Android to reject the install.

- Sign with apksigner (v1+v2+v3) instead of jarsigner
- Add arm64-v8a native libraries from universal Soul Browser 1.4.79
- Set extractNativeLibs=true for reliable sideload installs
- Commit stable debug keystore for consistent signatures across builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Add committed debug keystore for consistent APK signatures

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix startup crash: use original classes2.dex desugar libraries

Apktool recompiles smali_classes2 into a broken classes2.dex, causing
ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init.

Inject the original classes2.dex (Java 8+ desugar libs) after apktool
build instead of using the recompiled version.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix missing drawable resources from density split APKs

The base APK is an app bundle module; density-specific drawables like
seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild,
causing Resources$NotFoundException at runtime.

- Merge non-9-patch resources from split APKs before apktool build
- Sync public.xml IDs from R smali only when backing files exist
- Add 713 density-specific resource IDs to public.xml

Co-authored-by: KaKi87 <KaKi87@pm.me>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-10 16:07:14 +02:00

156 lines
5.2 KiB
Java

package com.google.api.client.util;
import com.google.android.gms.ads.RequestConfiguration;
import j$.util.DesugarCollections;
import j$.util.concurrent.ConcurrentHashMap;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentMap;
/* loaded from: classes3.dex */
public final class ClassInfo {
private static final ConcurrentMap<Class<?>, ClassInfo> CACHE = new ConcurrentHashMap();
private static final ConcurrentMap<Class<?>, ClassInfo> CACHE_IGNORE_CASE = new ConcurrentHashMap();
private final Class<?> clazz;
private final boolean ignoreCase;
private final IdentityHashMap<String, FieldInfo> nameToFieldInfoMap = new IdentityHashMap<>();
final List<String> names;
private ClassInfo(Class<?> cls, boolean z) {
boolean z2;
List<String> unmodifiableList;
boolean z3;
String str;
Field field;
this.clazz = cls;
this.ignoreCase = z;
if (z && cls.isEnum()) {
z2 = false;
} else {
z2 = true;
}
Preconditions.checkArgument(z2, "cannot ignore case on an enum: " + cls);
TreeSet treeSet = new TreeSet(new Comparator<String>() { // from class: com.google.api.client.util.ClassInfo.1
@Override // java.util.Comparator
public int compare(String str2, String str3) {
if (Objects.equal(str2, str3)) {
return 0;
}
if (str2 == null) {
return -1;
}
if (str3 == null) {
return 1;
}
return str2.compareTo(str3);
}
});
for (Field field2 : cls.getDeclaredFields()) {
FieldInfo of = FieldInfo.of(field2);
if (of != null) {
String name = of.getName();
name = z ? name.toLowerCase(Locale.US).intern() : name;
FieldInfo fieldInfo = this.nameToFieldInfoMap.get(name);
if (fieldInfo == null) {
z3 = true;
} else {
z3 = false;
}
if (z) {
str = "case-insensitive ";
} else {
str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
}
if (fieldInfo == null) {
field = null;
} else {
field = fieldInfo.getField();
}
Preconditions.checkArgument(z3, "two fields have the same %sname <%s>: %s and %s", str, name, field2, field);
this.nameToFieldInfoMap.put(name, of);
treeSet.add(name);
}
}
Class<? super Object> superclass = cls.getSuperclass();
if (superclass != null) {
ClassInfo of2 = of(superclass, z);
treeSet.addAll(of2.names);
for (Map.Entry<String, FieldInfo> entry : of2.nameToFieldInfoMap.entrySet()) {
String key = entry.getKey();
if (!this.nameToFieldInfoMap.containsKey(key)) {
this.nameToFieldInfoMap.put(key, entry.getValue());
}
}
}
if (treeSet.isEmpty()) {
unmodifiableList = Collections.EMPTY_LIST;
} else {
unmodifiableList = DesugarCollections.unmodifiableList(new ArrayList(treeSet));
}
this.names = unmodifiableList;
}
public static ClassInfo of(Class<?> cls) {
return of(cls, false);
}
public Field getField(String str) {
FieldInfo fieldInfo = getFieldInfo(str);
if (fieldInfo == null) {
return null;
}
return fieldInfo.getField();
}
public FieldInfo getFieldInfo(String str) {
if (str != null) {
if (this.ignoreCase) {
str = str.toLowerCase(Locale.US);
}
str = str.intern();
}
return this.nameToFieldInfoMap.get(str);
}
public Collection<FieldInfo> getFieldInfos() {
return DesugarCollections.unmodifiableCollection(this.nameToFieldInfoMap.values());
}
public final boolean getIgnoreCase() {
return this.ignoreCase;
}
public Collection<String> getNames() {
return this.names;
}
public Class<?> getUnderlyingClass() {
return this.clazz;
}
public boolean isEnum() {
return this.clazz.isEnum();
}
public static ClassInfo of(Class<?> cls, boolean z) {
if (cls == null) {
return null;
}
ConcurrentMap<Class<?>, ClassInfo> concurrentMap = z ? CACHE_IGNORE_CASE : CACHE;
ClassInfo classInfo = concurrentMap.get(cls);
if (classInfo != null) {
return classInfo;
}
ClassInfo classInfo2 = new ClassInfo(cls, z);
ClassInfo putIfAbsent = concurrentMap.putIfAbsent(cls, classInfo2);
return putIfAbsent == null ? classInfo2 : putIfAbsent;
}
}