soul-browser/sources/java/androidx/collection/ArrayMap.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

551 lines
17 KiB
Java

package androidx.collection;
import j$.util.Map;
import java.lang.reflect.Array;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class ArrayMap<K, V> extends SimpleArrayMap<K, V> implements Map<K, V>, j$.util.Map {
public EntrySet h;
public KeySet i;
public ValueCollection j;
/* loaded from: classes.dex */
public final class EntrySet extends AbstractSet<Map.Entry<K, V>> {
public EntrySet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public final Iterator iterator() {
return new MapIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public final int size() {
return ArrayMap.this.g;
}
}
/* loaded from: classes.dex */
public final class KeyIterator extends IndexBasedArrayIterator<K> {
public KeyIterator() {
super(ArrayMap.this.g);
}
@Override // androidx.collection.IndexBasedArrayIterator
public final Object a(int i) {
return ArrayMap.this.f(i);
}
@Override // androidx.collection.IndexBasedArrayIterator
public final void b(int i) {
ArrayMap.this.h(i);
}
}
/* loaded from: classes.dex */
public final class MapIterator implements Iterator<Map.Entry<K, V>>, Map.Entry<K, V> {
/* renamed from: c, reason: collision with root package name */
public int f434c;
public int f = -1;
public boolean g;
public MapIterator() {
this.f434c = ArrayMap.this.g - 1;
}
@Override // java.util.Map.Entry
public final boolean equals(Object obj) {
if (this.g) {
if (obj instanceof Map.Entry) {
Map.Entry entry = (Map.Entry) obj;
Object key = entry.getKey();
int i = this.f;
ArrayMap arrayMap = ArrayMap.this;
if (Intrinsics.areEqual(key, arrayMap.f(i)) && Intrinsics.areEqual(entry.getValue(), arrayMap.j(this.f))) {
return true;
}
return false;
}
return false;
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
@Override // java.util.Map.Entry
public final Object getKey() {
if (this.g) {
return ArrayMap.this.f(this.f);
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
@Override // java.util.Map.Entry
public final Object getValue() {
if (this.g) {
return ArrayMap.this.j(this.f);
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
@Override // java.util.Iterator
public final boolean hasNext() {
if (this.f < this.f434c) {
return true;
}
return false;
}
@Override // java.util.Map.Entry
public final int hashCode() {
int hashCode;
if (this.g) {
int i = this.f;
ArrayMap arrayMap = ArrayMap.this;
Object f = arrayMap.f(i);
Object j = arrayMap.j(this.f);
int i2 = 0;
if (f == null) {
hashCode = 0;
} else {
hashCode = f.hashCode();
}
if (j != null) {
i2 = j.hashCode();
}
return hashCode ^ i2;
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
@Override // java.util.Iterator
public final Object next() {
if (hasNext()) {
this.f++;
this.g = true;
return this;
}
throw new NoSuchElementException();
}
@Override // java.util.Iterator
public final void remove() {
if (this.g) {
ArrayMap.this.h(this.f);
this.f--;
this.f434c--;
this.g = false;
return;
}
throw new IllegalStateException();
}
@Override // java.util.Map.Entry
public final Object setValue(Object obj) {
if (this.g) {
return ArrayMap.this.i(this.f, obj);
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
public final String toString() {
return getKey() + "=" + getValue();
}
}
/* loaded from: classes.dex */
public final class ValueIterator extends IndexBasedArrayIterator<V> {
public ValueIterator() {
super(ArrayMap.this.g);
}
@Override // androidx.collection.IndexBasedArrayIterator
public final Object a(int i) {
return ArrayMap.this.j(i);
}
@Override // androidx.collection.IndexBasedArrayIterator
public final void b(int i) {
ArrayMap.this.h(i);
}
}
@Override // java.util.Map, j$.util.Map
public /* synthetic */ Object compute(Object obj, BiFunction biFunction) {
return Map.CC.$default$compute(this, obj, biFunction);
}
@Override // java.util.Map, j$.util.Map
public /* synthetic */ Object computeIfAbsent(Object obj, Function function) {
return Map.CC.$default$computeIfAbsent(this, obj, function);
}
@Override // java.util.Map, j$.util.Map
public /* synthetic */ Object computeIfPresent(Object obj, BiFunction biFunction) {
return Map.CC.$default$computeIfPresent(this, obj, biFunction);
}
@Override // java.util.Map
public final Set entrySet() {
EntrySet entrySet = this.h;
if (entrySet == null) {
EntrySet entrySet2 = new EntrySet();
this.h = entrySet2;
return entrySet2;
}
return entrySet;
}
@Override // java.util.Map, j$.util.Map
public /* synthetic */ void forEach(BiConsumer biConsumer) {
Map.CC.$default$forEach(this, biConsumer);
}
public final boolean k(Collection collection) {
Iterator it = collection.iterator();
while (it.hasNext()) {
if (!super.containsKey(it.next())) {
return false;
}
}
return true;
}
@Override // java.util.Map
public final Set keySet() {
KeySet keySet = this.i;
if (keySet == null) {
KeySet keySet2 = new KeySet();
this.i = keySet2;
return keySet2;
}
return keySet;
}
public final boolean l(Collection collection) {
int i = this.g;
Iterator it = collection.iterator();
while (it.hasNext()) {
super.remove(it.next());
}
if (i != this.g) {
return true;
}
return false;
}
public final boolean m(Collection collection) {
int i = this.g;
for (int i2 = i - 1; i2 >= 0; i2--) {
if (!collection.contains(f(i2))) {
h(i2);
}
}
if (i != this.g) {
return true;
}
return false;
}
@Override // java.util.Map, j$.util.Map
public /* synthetic */ Object merge(Object obj, Object obj2, BiFunction biFunction) {
return Map.CC.$default$merge(this, obj, obj2, biFunction);
}
@Override // java.util.Map
public final void putAll(java.util.Map map) {
b(map.size() + this.g);
for (Map.Entry<K, V> entry : map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
@Override // java.util.Map, j$.util.Map
public /* synthetic */ void replaceAll(BiFunction biFunction) {
Map.CC.$default$replaceAll(this, biFunction);
}
@Override // java.util.Map
public final Collection values() {
ValueCollection valueCollection = this.j;
if (valueCollection == null) {
ValueCollection valueCollection2 = new ValueCollection();
this.j = valueCollection2;
return valueCollection2;
}
return valueCollection;
}
/* loaded from: classes.dex */
public final class KeySet implements Set<K> {
public KeySet() {
}
@Override // java.util.Set, java.util.Collection
public final boolean add(Object obj) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public final boolean addAll(Collection collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public final void clear() {
ArrayMap.this.clear();
}
@Override // java.util.Set, java.util.Collection
public final boolean contains(Object obj) {
return ArrayMap.this.containsKey(obj);
}
@Override // java.util.Set, java.util.Collection
public final boolean containsAll(Collection collection) {
return ArrayMap.this.k(collection);
}
@Override // java.util.Set, java.util.Collection
public final boolean equals(Object obj) {
ArrayMap arrayMap = ArrayMap.this;
if (this != obj) {
if (obj instanceof Set) {
Set set = (Set) obj;
try {
if (arrayMap.g == set.size()) {
if (arrayMap.k(set)) {
return true;
}
return false;
}
return false;
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
return false;
}
return true;
}
@Override // java.util.Set, java.util.Collection
public final int hashCode() {
int hashCode;
ArrayMap arrayMap = ArrayMap.this;
int i = 0;
for (int i2 = arrayMap.g - 1; i2 >= 0; i2--) {
Object f = arrayMap.f(i2);
if (f == null) {
hashCode = 0;
} else {
hashCode = f.hashCode();
}
i += hashCode;
}
return i;
}
@Override // java.util.Set, java.util.Collection
public final boolean isEmpty() {
return ArrayMap.this.isEmpty();
}
@Override // java.util.Set, java.util.Collection, java.lang.Iterable
public final Iterator iterator() {
return new KeyIterator();
}
@Override // java.util.Set, java.util.Collection
public final boolean remove(Object obj) {
ArrayMap arrayMap = ArrayMap.this;
int d = arrayMap.d(obj);
if (d >= 0) {
arrayMap.h(d);
return true;
}
return false;
}
@Override // java.util.Set, java.util.Collection
public final boolean removeAll(Collection collection) {
return ArrayMap.this.l(collection);
}
@Override // java.util.Set, java.util.Collection
public final boolean retainAll(Collection collection) {
return ArrayMap.this.m(collection);
}
@Override // java.util.Set, java.util.Collection
public final int size() {
return ArrayMap.this.g;
}
@Override // java.util.Set, java.util.Collection
public final Object[] toArray() {
ArrayMap arrayMap = ArrayMap.this;
int i = arrayMap.g;
Object[] objArr = new Object[i];
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = arrayMap.f(i2);
}
return objArr;
}
@Override // java.util.Set, java.util.Collection
public final Object[] toArray(Object[] objArr) {
ArrayMap arrayMap = ArrayMap.this;
int i = arrayMap.g;
if (objArr.length < i) {
objArr = (Object[]) Array.newInstance(objArr.getClass().getComponentType(), i);
}
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = arrayMap.f(i2);
}
if (objArr.length > i) {
objArr[i] = null;
}
return objArr;
}
}
/* loaded from: classes.dex */
public final class ValueCollection implements Collection<V> {
public ValueCollection() {
}
@Override // java.util.Collection
public final boolean add(Object obj) {
throw new UnsupportedOperationException();
}
@Override // java.util.Collection
public final boolean addAll(Collection collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Collection
public final void clear() {
ArrayMap.this.clear();
}
@Override // java.util.Collection
public final boolean contains(Object obj) {
if (ArrayMap.this.a(obj) >= 0) {
return true;
}
return false;
}
@Override // java.util.Collection
public final boolean containsAll(Collection collection) {
Iterator it = collection.iterator();
while (it.hasNext()) {
if (!contains(it.next())) {
return false;
}
}
return true;
}
@Override // java.util.Collection
public final boolean isEmpty() {
return ArrayMap.this.isEmpty();
}
@Override // java.util.Collection, java.lang.Iterable
public final Iterator iterator() {
return new ValueIterator();
}
@Override // java.util.Collection
public final boolean remove(Object obj) {
ArrayMap arrayMap = ArrayMap.this;
int a2 = arrayMap.a(obj);
if (a2 >= 0) {
arrayMap.h(a2);
return true;
}
return false;
}
@Override // java.util.Collection
public final boolean removeAll(Collection collection) {
ArrayMap arrayMap = ArrayMap.this;
int i = arrayMap.g;
int i2 = 0;
boolean z = false;
while (i2 < i) {
if (collection.contains(arrayMap.j(i2))) {
arrayMap.h(i2);
i2--;
i--;
z = true;
}
i2++;
}
return z;
}
@Override // java.util.Collection
public final boolean retainAll(Collection collection) {
ArrayMap arrayMap = ArrayMap.this;
int i = arrayMap.g;
int i2 = 0;
boolean z = false;
while (i2 < i) {
if (!collection.contains(arrayMap.j(i2))) {
arrayMap.h(i2);
i2--;
i--;
z = true;
}
i2++;
}
return z;
}
@Override // java.util.Collection
public final int size() {
return ArrayMap.this.g;
}
@Override // java.util.Collection
public final Object[] toArray() {
ArrayMap arrayMap = ArrayMap.this;
int i = arrayMap.g;
Object[] objArr = new Object[i];
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = arrayMap.j(i2);
}
return objArr;
}
@Override // java.util.Collection
public final Object[] toArray(Object[] objArr) {
ArrayMap arrayMap = ArrayMap.this;
int i = arrayMap.g;
if (objArr.length < i) {
objArr = (Object[]) Array.newInstance(objArr.getClass().getComponentType(), i);
}
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = arrayMap.j(i2);
}
if (objArr.length > i) {
objArr[i] = null;
}
return objArr;
}
}
}