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

317 lines
11 KiB
Java

package androidx.collection;
import android.support.v4.media.a;
import androidx.collection.internal.ContainerHelpersKt;
import com.google.android.gms.ads.RequestConfiguration;
import java.util.Arrays;
import kotlin.Metadata;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u001a\n\u0000\b\u0016\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u0002¨\u0006\u0003"}, d2 = {"Landroidx/collection/LongSparseArray;", "E", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "collection"}, k = 1, mv = {1, 8, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nLongSparseArray.jvm.kt\nKotlin\n*S Kotlin\n*F\n+ 1 LongSparseArray.jvm.kt\nandroidx/collection/LongSparseArray\n+ 2 LongSparseArray.kt\nandroidx/collection/LongSparseArrayKt\n*L\n1#1,255:1\n243#2:256\n256#2,6:257\n248#2,14:263\n267#2,8:277\n267#2,8:285\n278#2,9:293\n291#2,5:302\n299#2,8:307\n315#2,9:315\n349#2,12:324\n328#2,18:336\n363#2,26:354\n392#2,5:380\n400#2,5:385\n409#2,2:390\n328#2,18:392\n412#2:410\n416#2:411\n420#2,6:412\n328#2,18:418\n427#2:436\n432#2,6:437\n328#2,18:443\n441#2:461\n446#2,6:462\n328#2,18:468\n453#2,2:486\n458#2,2:488\n328#2,18:490\n461#2:508\n466#2,2:509\n328#2,18:511\n469#2,6:529\n479#2:535\n484#2:536\n489#2,8:537\n500#2,6:545\n328#2,18:551\n507#2,10:569\n520#2,21:579\n*S KotlinDebug\n*F\n+ 1 LongSparseArray.jvm.kt\nandroidx/collection/LongSparseArray\n*L\n93#1:256\n93#1:257,6\n100#1:263,14\n106#1:277,8\n111#1:285,8\n120#1:293,9\n125#1:302,5\n134#1:307,8\n145#1:315,9\n151#1:324,12\n151#1:336,18\n151#1:354,26\n157#1:380,5\n168#1:385,5\n173#1:390,2\n173#1:392,18\n173#1:410\n180#1:411\n192#1:412,6\n192#1:418,18\n192#1:436\n204#1:437,6\n204#1:443,18\n204#1:461\n212#1:462,6\n212#1:468,18\n212#1:486,2\n219#1:488,2\n219#1:490,18\n219#1:508\n228#1:509,2\n228#1:511,18\n228#1:529,6\n231#1:535\n234#1:536\n239#1:537,8\n245#1:545,6\n245#1:551,18\n245#1:569,10\n253#1:579,21\n*E\n"})
/* loaded from: classes.dex */
public class LongSparseArray<E> implements Cloneable {
/* renamed from: c, reason: collision with root package name */
public /* synthetic */ boolean f445c;
public /* synthetic */ long[] f;
public /* synthetic */ Object[] g;
public /* synthetic */ int h;
public LongSparseArray(int i) {
if (i == 0) {
this.f = ContainerHelpersKt.b;
this.g = ContainerHelpersKt.f477c;
return;
}
int i2 = i * 8;
int i3 = 4;
while (true) {
if (i3 >= 32) {
break;
}
int i4 = (1 << i3) - 12;
if (i2 <= i4) {
i2 = i4;
break;
}
i3++;
}
int i5 = i2 / 8;
this.f = new long[i5];
this.g = new Object[i5];
}
public final void a(long j, Long l) {
int i = this.h;
if (i != 0 && j <= this.f[i - 1]) {
g(j, l);
return;
}
if (this.f445c) {
long[] jArr = this.f;
if (i >= jArr.length) {
Object[] objArr = this.g;
int i2 = 0;
for (int i3 = 0; i3 < i; i3++) {
Object obj = objArr[i3];
if (obj != LongSparseArrayKt.f446a) {
if (i3 != i2) {
jArr[i2] = jArr[i3];
objArr[i2] = obj;
objArr[i3] = null;
}
i2++;
}
}
this.f445c = false;
this.h = i2;
}
}
int i4 = this.h;
if (i4 >= this.f.length) {
int i5 = (i4 + 1) * 8;
int i6 = 4;
while (true) {
if (i6 >= 32) {
break;
}
int i7 = (1 << i6) - 12;
if (i5 <= i7) {
i5 = i7;
break;
}
i6++;
}
int i8 = i5 / 8;
long[] copyOf = Arrays.copyOf(this.f, i8);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
this.f = copyOf;
Object[] copyOf2 = Arrays.copyOf(this.g, i8);
Intrinsics.checkNotNullExpressionValue(copyOf2, "copyOf(this, newSize)");
this.g = copyOf2;
}
this.f[i4] = j;
this.g[i4] = l;
this.h = i4 + 1;
}
public final void b() {
int i = this.h;
Object[] objArr = this.g;
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = null;
}
this.h = 0;
this.f445c = false;
}
/* renamed from: c, reason: merged with bridge method [inline-methods] */
public final LongSparseArray clone() {
Object clone = super.clone();
Intrinsics.checkNotNull(clone, "null cannot be cast to non-null type androidx.collection.LongSparseArray<E of androidx.collection.LongSparseArray>");
LongSparseArray longSparseArray = (LongSparseArray) clone;
longSparseArray.f = (long[]) this.f.clone();
longSparseArray.g = (Object[]) this.g.clone();
return longSparseArray;
}
public final Object d(long j) {
Object obj;
int b = ContainerHelpersKt.b(this.f, this.h, j);
if (b >= 0 && (obj = this.g[b]) != LongSparseArrayKt.f446a) {
return obj;
}
return null;
}
public final Object e(long j) {
Object obj;
int b = ContainerHelpersKt.b(this.f, this.h, j);
if (b < 0 || (obj = this.g[b]) == LongSparseArrayKt.f446a) {
return -1L;
}
return obj;
}
public final long f(int i) {
int i2;
if (i >= 0 && i < (i2 = this.h)) {
if (this.f445c) {
long[] jArr = this.f;
Object[] objArr = this.g;
int i3 = 0;
for (int i4 = 0; i4 < i2; i4++) {
Object obj = objArr[i4];
if (obj != LongSparseArrayKt.f446a) {
if (i4 != i3) {
jArr[i3] = jArr[i4];
objArr[i3] = obj;
objArr[i4] = null;
}
i3++;
}
}
this.f445c = false;
this.h = i3;
}
return this.f[i];
}
throw new IllegalArgumentException(a.e(i, "Expected index to be within 0..size()-1, but was ").toString());
}
public final void g(long j, Object obj) {
int b = ContainerHelpersKt.b(this.f, this.h, j);
if (b >= 0) {
this.g[b] = obj;
return;
}
int i = ~b;
int i2 = this.h;
Object obj2 = LongSparseArrayKt.f446a;
if (i < i2) {
Object[] objArr = this.g;
if (objArr[i] == obj2) {
this.f[i] = j;
objArr[i] = obj;
return;
}
}
if (this.f445c) {
long[] jArr = this.f;
if (i2 >= jArr.length) {
Object[] objArr2 = this.g;
int i3 = 0;
for (int i4 = 0; i4 < i2; i4++) {
Object obj3 = objArr2[i4];
if (obj3 != obj2) {
if (i4 != i3) {
jArr[i3] = jArr[i4];
objArr2[i3] = obj3;
objArr2[i4] = null;
}
i3++;
}
}
this.f445c = false;
this.h = i3;
i = ~ContainerHelpersKt.b(this.f, i3, j);
}
}
int i5 = this.h;
if (i5 >= this.f.length) {
int i6 = (i5 + 1) * 8;
int i7 = 4;
while (true) {
if (i7 >= 32) {
break;
}
int i8 = (1 << i7) - 12;
if (i6 <= i8) {
i6 = i8;
break;
}
i7++;
}
int i9 = i6 / 8;
long[] copyOf = Arrays.copyOf(this.f, i9);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
this.f = copyOf;
Object[] copyOf2 = Arrays.copyOf(this.g, i9);
Intrinsics.checkNotNullExpressionValue(copyOf2, "copyOf(this, newSize)");
this.g = copyOf2;
}
int i10 = this.h;
if (i10 - i != 0) {
long[] jArr2 = this.f;
int i11 = i + 1;
ArraysKt___ArraysJvmKt.copyInto(jArr2, jArr2, i11, i, i10);
Object[] objArr3 = this.g;
ArraysKt___ArraysJvmKt.copyInto(objArr3, objArr3, i11, i, this.h);
}
this.f[i] = j;
this.g[i] = obj;
this.h++;
}
public final int h() {
if (this.f445c) {
int i = this.h;
long[] jArr = this.f;
Object[] objArr = this.g;
int i2 = 0;
for (int i3 = 0; i3 < i; i3++) {
Object obj = objArr[i3];
if (obj != LongSparseArrayKt.f446a) {
if (i3 != i2) {
jArr[i2] = jArr[i3];
objArr[i2] = obj;
objArr[i3] = null;
}
i2++;
}
}
this.f445c = false;
this.h = i2;
}
return this.h;
}
public final Object i(int i) {
int i2;
if (i >= 0 && i < (i2 = this.h)) {
if (this.f445c) {
long[] jArr = this.f;
Object[] objArr = this.g;
int i3 = 0;
for (int i4 = 0; i4 < i2; i4++) {
Object obj = objArr[i4];
if (obj != LongSparseArrayKt.f446a) {
if (i4 != i3) {
jArr[i3] = jArr[i4];
objArr[i3] = obj;
objArr[i4] = null;
}
i3++;
}
}
this.f445c = false;
this.h = i3;
}
return this.g[i];
}
throw new IllegalArgumentException(a.e(i, "Expected index to be within 0..size()-1, but was ").toString());
}
public final String toString() {
if (h() <= 0) {
return "{}";
}
StringBuilder sb = new StringBuilder(this.h * 28);
sb.append('{');
int i = this.h;
for (int i2 = 0; i2 < i; i2++) {
if (i2 > 0) {
sb.append(", ");
}
sb.append(f(i2));
sb.append('=');
Object i3 = i(i2);
if (i3 != sb) {
sb.append(i3);
} else {
sb.append("(this Map)");
}
}
sb.append('}');
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder(capacity).…builderAction).toString()");
return sb2;
}
public LongSparseArray() {
this(10);
}
}