soul-browser/sources/java/com/google/api/client/util/GenericData.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

216 lines
7 KiB
Java

package com.google.api.client.util;
import android.support.v4.media.a;
import com.google.api.client.util.DataMap;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
/* loaded from: classes3.dex */
public class GenericData extends AbstractMap<String, Object> implements Cloneable {
final ClassInfo classInfo;
Map<String, Object> unknownFields;
/* loaded from: classes3.dex */
public final class EntryIterator implements Iterator<Map.Entry<String, Object>> {
private final Iterator<Map.Entry<String, Object>> fieldIterator;
private boolean startedUnknown;
private final Iterator<Map.Entry<String, Object>> unknownIterator;
public EntryIterator(DataMap.EntrySet entrySet) {
this.fieldIterator = entrySet.iterator();
this.unknownIterator = GenericData.this.unknownFields.entrySet().iterator();
}
@Override // java.util.Iterator
public boolean hasNext() {
if (!this.fieldIterator.hasNext() && !this.unknownIterator.hasNext()) {
return false;
}
return true;
}
@Override // java.util.Iterator
public void remove() {
if (this.startedUnknown) {
this.unknownIterator.remove();
}
this.fieldIterator.remove();
}
@Override // java.util.Iterator
public Map.Entry<String, Object> next() {
if (!this.startedUnknown) {
if (this.fieldIterator.hasNext()) {
return this.fieldIterator.next();
}
this.startedUnknown = true;
}
return this.unknownIterator.next();
}
}
/* loaded from: classes3.dex */
public final class EntrySet extends AbstractSet<Map.Entry<String, Object>> {
private final DataMap.EntrySet dataEntrySet;
public EntrySet() {
this.dataEntrySet = new DataMap(GenericData.this, GenericData.this.classInfo.getIgnoreCase()).entrySet();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
GenericData.this.unknownFields.clear();
this.dataEntrySet.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<String, Object>> iterator() {
return new EntryIterator(this.dataEntrySet);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return GenericData.this.unknownFields.size() + this.dataEntrySet.size();
}
}
/* loaded from: classes3.dex */
public enum Flags {
IGNORE_CASE
}
public GenericData() {
this(EnumSet.noneOf(Flags.class));
}
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<String, Object>> entrySet() {
return new EntrySet();
}
@Override // java.util.AbstractMap, java.util.Map
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && (obj instanceof GenericData)) {
GenericData genericData = (GenericData) obj;
if (super.equals(genericData) && j$.util.Objects.equals(this.classInfo, genericData.classInfo)) {
return true;
}
}
return false;
}
@Override // java.util.AbstractMap, java.util.Map
public final Object get(Object obj) {
if (!(obj instanceof String)) {
return null;
}
String str = (String) obj;
FieldInfo fieldInfo = this.classInfo.getFieldInfo(str);
if (fieldInfo != null) {
return fieldInfo.getValue(this);
}
if (this.classInfo.getIgnoreCase()) {
str = str.toLowerCase(Locale.US);
}
return this.unknownFields.get(str);
}
public final ClassInfo getClassInfo() {
return this.classInfo;
}
public final Map<String, Object> getUnknownKeys() {
return this.unknownFields;
}
@Override // java.util.AbstractMap, java.util.Map
public int hashCode() {
return j$.util.Objects.hash(Integer.valueOf(super.hashCode()), this.classInfo);
}
@Override // java.util.AbstractMap, java.util.Map
public final void putAll(Map<? extends String, ?> map) {
for (Map.Entry<? extends String, ?> entry : map.entrySet()) {
set(entry.getKey(), entry.getValue());
}
}
@Override // java.util.AbstractMap, java.util.Map
public final Object remove(Object obj) {
if (!(obj instanceof String)) {
return null;
}
String str = (String) obj;
if (this.classInfo.getFieldInfo(str) == null) {
if (this.classInfo.getIgnoreCase()) {
str = str.toLowerCase(Locale.US);
}
return this.unknownFields.remove(str);
}
throw new UnsupportedOperationException();
}
public GenericData set(String str, Object obj) {
FieldInfo fieldInfo = this.classInfo.getFieldInfo(str);
if (fieldInfo != null) {
fieldInfo.setValue(this, obj);
return this;
}
if (this.classInfo.getIgnoreCase()) {
str = str.toLowerCase(Locale.US);
}
this.unknownFields.put(str, obj);
return this;
}
public final void setUnknownKeys(Map<String, Object> map) {
this.unknownFields = map;
}
@Override // java.util.AbstractMap
public String toString() {
StringBuilder sb = new StringBuilder("GenericData{classInfo=");
sb.append(this.classInfo.names);
sb.append(", ");
return a.p(sb, super.toString(), "}");
}
public GenericData(EnumSet<Flags> enumSet) {
this.unknownFields = ArrayMap.create();
this.classInfo = ClassInfo.of(getClass(), enumSet.contains(Flags.IGNORE_CASE));
}
@Override // java.util.AbstractMap
public GenericData clone() {
try {
GenericData genericData = (GenericData) super.clone();
Data.deepCopy(this, genericData);
genericData.unknownFields = (Map) Data.clone(this.unknownFields);
return genericData;
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(e);
}
}
@Override // java.util.AbstractMap, java.util.Map
public final Object put(String str, Object obj) {
FieldInfo fieldInfo = this.classInfo.getFieldInfo(str);
if (fieldInfo != null) {
Object value = fieldInfo.getValue(this);
fieldInfo.setValue(this, obj);
return value;
}
if (this.classInfo.getIgnoreCase()) {
str = str.toLowerCase(Locale.US);
}
return this.unknownFields.put(str, obj);
}
}