soul-browser/sources/java/com/google/android/gms/internal/drive/zzmi.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

250 lines
7.1 KiB
Java

package com.google.android.gms.internal.drive;
import j$.util.DesugarCollections;
import java.lang.Comparable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class zzmi<K extends Comparable<K>, V> extends AbstractMap<K, V> {
public static final /* synthetic */ int k = 0;
/* renamed from: c, reason: collision with root package name */
public final int f10248c;
public List f = Collections.EMPTY_LIST;
public Map g;
public boolean h;
public volatile zzmr i;
public Map j;
public zzmi(int i) {
this.f10248c = i;
Map map = Collections.EMPTY_MAP;
this.g = map;
this.j = map;
}
public final int a(Comparable comparable) {
int i;
int size = this.f.size();
int i2 = size - 1;
if (i2 >= 0) {
int compareTo = comparable.compareTo(((zzmp) this.f.get(i2)).f10251c);
if (compareTo > 0) {
i = size + 1;
return -i;
}
if (compareTo == 0) {
return i2;
}
}
int i3 = 0;
while (i3 <= i2) {
int i4 = (i3 + i2) / 2;
int compareTo2 = comparable.compareTo(((zzmp) this.f.get(i4)).f10251c);
if (compareTo2 < 0) {
i2 = i4 - 1;
} else if (compareTo2 > 0) {
i3 = i4 + 1;
} else {
return i4;
}
}
i = i3 + 1;
return -i;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.AbstractMap, java.util.Map
/* renamed from: b, reason: merged with bridge method [inline-methods] */
public final Object put(Comparable comparable, Object obj) {
g();
int a2 = a(comparable);
if (a2 >= 0) {
return ((zzmp) this.f.get(a2)).setValue(obj);
}
g();
boolean isEmpty = this.f.isEmpty();
int i = this.f10248c;
if (isEmpty && !(this.f instanceof ArrayList)) {
this.f = new ArrayList(i);
}
int i2 = -(a2 + 1);
if (i2 >= i) {
return h().put(comparable, obj);
}
if (this.f.size() == i) {
zzmp zzmpVar = (zzmp) this.f.remove(i - 1);
h().put(zzmpVar.f10251c, zzmpVar.f);
}
this.f.add(i2, new zzmp(this, comparable, obj));
return null;
}
public final Map.Entry c(int i) {
return (Map.Entry) this.f.get(i);
}
@Override // java.util.AbstractMap, java.util.Map
public final void clear() {
g();
if (!this.f.isEmpty()) {
this.f.clear();
}
if (!this.g.isEmpty()) {
this.g.clear();
}
}
@Override // java.util.AbstractMap, java.util.Map
public final boolean containsKey(Object obj) {
Comparable comparable = (Comparable) obj;
if (a(comparable) < 0 && !this.g.containsKey(comparable)) {
return false;
}
return true;
}
public final Object d(int i) {
g();
Object obj = ((zzmp) this.f.remove(i)).f;
if (!this.g.isEmpty()) {
Iterator it = h().entrySet().iterator();
List list = this.f;
Map.Entry entry = (Map.Entry) it.next();
list.add(new zzmp(this, (Comparable) entry.getKey(), entry.getValue()));
it.remove();
}
return obj;
}
public void e() {
Map unmodifiableMap;
Map unmodifiableMap2;
if (!this.h) {
if (this.g.isEmpty()) {
unmodifiableMap = Collections.EMPTY_MAP;
} else {
unmodifiableMap = DesugarCollections.unmodifiableMap(this.g);
}
this.g = unmodifiableMap;
if (this.j.isEmpty()) {
unmodifiableMap2 = Collections.EMPTY_MAP;
} else {
unmodifiableMap2 = DesugarCollections.unmodifiableMap(this.j);
}
this.j = unmodifiableMap2;
this.h = true;
}
}
@Override // java.util.AbstractMap, java.util.Map
public final Set entrySet() {
if (this.i == null) {
this.i = new zzmr(this);
}
return this.i;
}
@Override // java.util.AbstractMap, java.util.Map
public final boolean equals(Object obj) {
if (this != obj) {
if (!(obj instanceof zzmi)) {
return super.equals(obj);
}
zzmi zzmiVar = (zzmi) obj;
int size = size();
if (size == zzmiVar.size()) {
int size2 = this.f.size();
if (size2 != zzmiVar.f.size()) {
return ((AbstractSet) entrySet()).equals(zzmiVar.entrySet());
}
for (int i = 0; i < size2; i++) {
if (c(i).equals(zzmiVar.c(i))) {
}
}
if (size2 != size) {
return this.g.equals(zzmiVar.g);
}
return true;
}
return false;
}
return true;
}
public final Iterable f() {
if (this.g.isEmpty()) {
return zzmm.b;
}
return this.g.entrySet();
}
public final void g() {
if (!this.h) {
} else {
throw new UnsupportedOperationException();
}
}
@Override // java.util.AbstractMap, java.util.Map
public final Object get(Object obj) {
Comparable comparable = (Comparable) obj;
int a2 = a(comparable);
if (a2 >= 0) {
return ((zzmp) this.f.get(a2)).f;
}
return this.g.get(comparable);
}
public final SortedMap h() {
g();
if (this.g.isEmpty() && !(this.g instanceof TreeMap)) {
TreeMap treeMap = new TreeMap();
this.g = treeMap;
this.j = treeMap.descendingMap();
}
return (SortedMap) this.g;
}
@Override // java.util.AbstractMap, java.util.Map
public final int hashCode() {
int size = this.f.size();
int i = 0;
for (int i2 = 0; i2 < size; i2++) {
i += ((zzmp) this.f.get(i2)).hashCode();
}
if (this.g.size() > 0) {
return this.g.hashCode() + i;
}
return i;
}
@Override // java.util.AbstractMap, java.util.Map
public final Object remove(Object obj) {
g();
Comparable comparable = (Comparable) obj;
int a2 = a(comparable);
if (a2 >= 0) {
return d(a2);
}
if (this.g.isEmpty()) {
return null;
}
return this.g.remove(comparable);
}
@Override // java.util.AbstractMap, java.util.Map
public final int size() {
return this.g.size() + this.f.size();
}
}