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

207 lines
7 KiB
Java

package com.google.api.client.util;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public final class DataMap extends AbstractMap<String, Object> {
final ClassInfo classInfo;
final Object object;
/* loaded from: classes3.dex */
public final class Entry implements Map.Entry<String, Object> {
private final FieldInfo fieldInfo;
private Object fieldValue;
public Entry(FieldInfo fieldInfo, Object obj) {
this.fieldInfo = fieldInfo;
this.fieldValue = Preconditions.checkNotNull(obj);
}
@Override // java.util.Map.Entry
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
if (getKey().equals(entry.getKey()) && getValue().equals(entry.getValue())) {
return true;
}
return false;
}
@Override // java.util.Map.Entry
public Object getValue() {
return this.fieldValue;
}
@Override // java.util.Map.Entry
public int hashCode() {
return getKey().hashCode() ^ getValue().hashCode();
}
@Override // java.util.Map.Entry
public Object setValue(Object obj) {
Object obj2 = this.fieldValue;
this.fieldValue = Preconditions.checkNotNull(obj);
this.fieldInfo.setValue(DataMap.this.object, obj);
return obj2;
}
@Override // java.util.Map.Entry
public String getKey() {
String name = this.fieldInfo.getName();
return DataMap.this.classInfo.getIgnoreCase() ? name.toLowerCase(Locale.US) : name;
}
}
/* loaded from: classes3.dex */
public final class EntryIterator implements Iterator<Map.Entry<String, Object>> {
private FieldInfo currentFieldInfo;
private boolean isComputed;
private boolean isRemoved;
private FieldInfo nextFieldInfo;
private Object nextFieldValue;
private int nextKeyIndex = -1;
public EntryIterator() {
}
@Override // java.util.Iterator
public boolean hasNext() {
if (!this.isComputed) {
this.isComputed = true;
this.nextFieldValue = null;
while (this.nextFieldValue == null) {
int i = this.nextKeyIndex + 1;
this.nextKeyIndex = i;
if (i >= DataMap.this.classInfo.names.size()) {
break;
}
ClassInfo classInfo = DataMap.this.classInfo;
FieldInfo fieldInfo = classInfo.getFieldInfo(classInfo.names.get(this.nextKeyIndex));
this.nextFieldInfo = fieldInfo;
this.nextFieldValue = fieldInfo.getValue(DataMap.this.object);
}
}
if (this.nextFieldValue != null) {
return true;
}
return false;
}
@Override // java.util.Iterator
public void remove() {
boolean z;
if (this.currentFieldInfo != null && !this.isRemoved) {
z = true;
} else {
z = false;
}
Preconditions.checkState(z);
this.isRemoved = true;
this.currentFieldInfo.setValue(DataMap.this.object, null);
}
@Override // java.util.Iterator
public Map.Entry<String, Object> next() {
if (hasNext()) {
FieldInfo fieldInfo = this.nextFieldInfo;
this.currentFieldInfo = fieldInfo;
Object obj = this.nextFieldValue;
this.isComputed = false;
this.isRemoved = false;
this.nextFieldInfo = null;
this.nextFieldValue = null;
return new Entry(fieldInfo, obj);
}
throw new NoSuchElementException();
}
}
/* loaded from: classes3.dex */
public final class EntrySet extends AbstractSet<Map.Entry<String, Object>> {
public EntrySet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
Iterator<String> it = DataMap.this.classInfo.names.iterator();
while (it.hasNext()) {
DataMap.this.classInfo.getFieldInfo(it.next()).setValue(DataMap.this.object, null);
}
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
Iterator<String> it = DataMap.this.classInfo.names.iterator();
while (it.hasNext()) {
if (DataMap.this.classInfo.getFieldInfo(it.next()).getValue(DataMap.this.object) != null) {
return false;
}
}
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
Iterator<String> it = DataMap.this.classInfo.names.iterator();
int i = 0;
while (it.hasNext()) {
if (DataMap.this.classInfo.getFieldInfo(it.next()).getValue(DataMap.this.object) != null) {
i++;
}
}
return i;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public EntryIterator iterator() {
return new EntryIterator();
}
}
public DataMap(Object obj, boolean z) {
this.object = obj;
this.classInfo = ClassInfo.of(obj.getClass(), z);
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
if (get(obj) != null) {
return true;
}
return false;
}
@Override // java.util.AbstractMap, java.util.Map
public Object get(Object obj) {
FieldInfo fieldInfo;
if (!(obj instanceof String) || (fieldInfo = this.classInfo.getFieldInfo((String) obj)) == null) {
return null;
}
return fieldInfo.getValue(this.object);
}
@Override // java.util.AbstractMap, java.util.Map
public EntrySet entrySet() {
return new EntrySet();
}
@Override // java.util.AbstractMap, java.util.Map
public Object put(String str, Object obj) {
FieldInfo fieldInfo = this.classInfo.getFieldInfo(str);
Preconditions.checkNotNull(fieldInfo, "no field of key " + str);
Object value = fieldInfo.getValue(this.object);
fieldInfo.setValue(this.object, Preconditions.checkNotNull(obj));
return value;
}
}