soul-browser/sources/java/kotlin/UnsignedKt.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

188 lines
9.1 KiB
Java

package kotlin;
import com.google.android.gms.ads.RequestConfiguration;
import kotlin.internal.InlineOnly;
import kotlin.jvm.JvmName;
import kotlin.jvm.internal.IntCompanionObject;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.CharsKt;
import org.jetbrains.annotations.NotNull;
@Metadata(d1 = {"\u00008\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0000\n\u0002\u0010\t\n\u0002\b\u0005\n\u0002\u0010\u0007\n\u0002\b\u0003\n\u0002\u0010\u0006\n\u0002\b\t\n\u0002\u0010\u000e\n\u0002\b\u0003\u001a\u001f\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u0001H\u0001¢\u0006\u0004\b\u0004\u0010\u0005\u001a\u001f\u0010\u0006\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u0001H\u0001¢\u0006\u0004\b\u0007\u0010\u0005\u001a\u001f\u0010\b\u001a\u00020\t2\u0006\u0010\u0002\u001a\u00020\t2\u0006\u0010\u0003\u001a\u00020\tH\u0001¢\u0006\u0004\b\n\u0010\u000b\u001a\u001f\u0010\f\u001a\u00020\t2\u0006\u0010\u0002\u001a\u00020\t2\u0006\u0010\u0003\u001a\u00020\tH\u0001¢\u0006\u0004\b\r\u0010\u000b\u001a\u0018\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0002\u001a\u00020\u000f2\u0006\u0010\u0003\u001a\u00020\u000fH\u0001\u001a\u0018\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0002\u001a\u00020\u00112\u0006\u0010\u0003\u001a\u00020\u0011H\u0001\u001a\u0016\u0010\u0012\u001a\u00020\t2\u0006\u0010\u0013\u001a\u00020\u000fH\u0081\\u0006\u0002\u0010\u0014\u001a\u0011\u0010\u0015\u001a\u00020\u00112\u0006\u0010\u0013\u001a\u00020\u000fH\u0081\b\u001a\u0011\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0013\u001a\u00020\u000fH\u0081\b\u001a\u0016\u0010\u0018\u001a\u00020\u00012\u0006\u0010\u0013\u001a\u00020\u0017H\u0081\\u0006\u0002\u0010\u0019\u001a\u0010\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u0013\u001a\u00020\u000fH\u0001\u001a\u0015\u0010\u001c\u001a\u00020\u00012\u0006\u0010\u0013\u001a\u00020\u001bH\u0001¢\u0006\u0002\u0010\u001d\u001a\u0011\u0010\u001e\u001a\u00020\u00172\u0006\u0010\u0013\u001a\u00020\u0011H\u0081\b\u001a\u0016\u0010\u001f\u001a\u00020\t2\u0006\u0010\u0013\u001a\u00020\u0017H\u0081\\u0006\u0002\u0010 \u001a\u0010\u0010!\u001a\u00020\u001b2\u0006\u0010\u0013\u001a\u00020\u0011H\u0001\u001a\u0015\u0010\"\u001a\u00020\t2\u0006\u0010\u0013\u001a\u00020\u001bH\u0001¢\u0006\u0002\u0010#\u001a\u0011\u0010$\u001a\u00020%2\u0006\u0010\u0013\u001a\u00020\u000fH\u0081\b\u001a\u0019\u0010$\u001a\u00020%2\u0006\u0010\u0013\u001a\u00020\u000f2\u0006\u0010&\u001a\u00020\u000fH\u0081\b\u001a\u0011\u0010'\u001a\u00020%2\u0006\u0010\u0013\u001a\u00020\u0011H\u0081\b\u001a\u0018\u0010'\u001a\u00020%2\u0006\u0010\u0013\u001a\u00020\u00112\u0006\u0010&\u001a\u00020\u000fH\u0000¨\u0006("}, d2 = {"uintRemainder", "Lkotlin/UInt;", "v1", "v2", "uintRemainder-J1ME1BU", "(II)I", "uintDivide", "uintDivide-J1ME1BU", "ulongDivide", "Lkotlin/ULong;", "ulongDivide-eb3DHEI", "(JJ)J", "ulongRemainder", "ulongRemainder-eb3DHEI", "uintCompare", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "ulongCompare", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "uintToULong", "value", "(I)J", "uintToLong", "uintToFloat", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "floatToUInt", "(F)I", "uintToDouble", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "doubleToUInt", "(D)I", "ulongToFloat", "floatToULong", "(F)J", "ulongToDouble", "doubleToULong", "(D)J", "uintToString", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "base", "ulongToString", "kotlin-stdlib"}, k = 2, mv = {2, 2, 0}, xi = 48)
@JvmName(name = "UnsignedKt")
/* loaded from: classes3.dex */
public final class UnsignedKt {
@PublishedApi
public static final int doubleToUInt(double d) {
if (Double.isNaN(d) || d <= uintToDouble(0)) {
return 0;
}
if (d >= uintToDouble(-1)) {
return -1;
}
if (d <= 2.147483647E9d) {
return UInt.m125constructorimpl((int) d);
}
return UInt.m125constructorimpl(UInt.m125constructorimpl(Integer.MAX_VALUE) + UInt.m125constructorimpl((int) (d - Integer.MAX_VALUE)));
}
@PublishedApi
public static final long doubleToULong(double d) {
if (Double.isNaN(d) || d <= ulongToDouble(0L)) {
return 0L;
}
if (d >= ulongToDouble(-1L)) {
return -1L;
}
if (d < 9.223372036854776E18d) {
return ULong.m204constructorimpl((long) d);
}
return ULong.m204constructorimpl(ULong.m204constructorimpl((long) (d - 9.223372036854776E18d)) - Long.MIN_VALUE);
}
@PublishedApi
@InlineOnly
private static final int floatToUInt(float f) {
return doubleToUInt(f);
}
@PublishedApi
@InlineOnly
private static final long floatToULong(float f) {
return doubleToULong(f);
}
@PublishedApi
public static final int uintCompare(int i, int i2) {
return Intrinsics.compare(i ^ IntCompanionObject.MIN_VALUE, i2 ^ IntCompanionObject.MIN_VALUE);
}
@PublishedApi
/* renamed from: uintDivide-J1ME1BU, reason: not valid java name */
public static final int m381uintDivideJ1ME1BU(int i, int i2) {
return UInt.m125constructorimpl((int) ((i & 4294967295L) / (i2 & 4294967295L)));
}
@PublishedApi
/* renamed from: uintRemainder-J1ME1BU, reason: not valid java name */
public static final int m382uintRemainderJ1ME1BU(int i, int i2) {
return UInt.m125constructorimpl((int) ((i & 4294967295L) % (i2 & 4294967295L)));
}
@PublishedApi
public static final double uintToDouble(int i) {
return (((i >>> 31) << 30) * 2) + (Integer.MAX_VALUE & i);
}
@PublishedApi
@InlineOnly
private static final float uintToFloat(int i) {
return (float) uintToDouble(i);
}
@PublishedApi
@InlineOnly
private static final long uintToLong(int i) {
return i & 4294967295L;
}
@InlineOnly
private static final String uintToString(int i) {
return String.valueOf(i & 4294967295L);
}
@PublishedApi
@InlineOnly
private static final long uintToULong(int i) {
return ULong.m204constructorimpl(i & 4294967295L);
}
@PublishedApi
public static final int ulongCompare(long j, long j2) {
return Intrinsics.compare(j ^ Long.MIN_VALUE, j2 ^ Long.MIN_VALUE);
}
@PublishedApi
/* renamed from: ulongDivide-eb3DHEI, reason: not valid java name */
public static final long m383ulongDivideeb3DHEI(long j, long j2) {
if (j2 < 0) {
if (Long.compare(j ^ Long.MIN_VALUE, j2 ^ Long.MIN_VALUE) < 0) {
return ULong.m204constructorimpl(0L);
}
return ULong.m204constructorimpl(1L);
}
if (j >= 0) {
return ULong.m204constructorimpl(j / j2);
}
int i = 1;
long j3 = ((j >>> 1) / j2) << 1;
if (Long.compare(ULong.m204constructorimpl(j - (j3 * j2)) ^ Long.MIN_VALUE, ULong.m204constructorimpl(j2) ^ Long.MIN_VALUE) < 0) {
i = 0;
}
return ULong.m204constructorimpl(j3 + i);
}
@PublishedApi
/* renamed from: ulongRemainder-eb3DHEI, reason: not valid java name */
public static final long m384ulongRemaindereb3DHEI(long j, long j2) {
if (j2 < 0) {
if (Long.compare(j ^ Long.MIN_VALUE, Long.MIN_VALUE ^ j2) < 0) {
return j;
}
return ULong.m204constructorimpl(j - j2);
}
if (j >= 0) {
return ULong.m204constructorimpl(j % j2);
}
long j3 = j - ((((j >>> 1) / j2) << 1) * j2);
if (Long.compare(ULong.m204constructorimpl(j3) ^ Long.MIN_VALUE, Long.MIN_VALUE ^ ULong.m204constructorimpl(j2)) < 0) {
j2 = 0;
}
return ULong.m204constructorimpl(j3 - j2);
}
@PublishedApi
public static final double ulongToDouble(long j) {
return ((j >>> 11) * 2048) + (j & 2047);
}
@PublishedApi
@InlineOnly
private static final float ulongToFloat(long j) {
return (float) ulongToDouble(j);
}
@InlineOnly
private static final String ulongToString(long j) {
return ulongToString(j, 10);
}
@InlineOnly
private static final String uintToString(int i, int i2) {
return ulongToString(i & 4294967295L, i2);
}
@NotNull
public static final String ulongToString(long j, int i) {
if (j >= 0) {
String l = Long.toString(j, CharsKt.checkRadix(i));
Intrinsics.checkNotNullExpressionValue(l, "toString(...)");
return l;
}
long j2 = i;
long j3 = ((j >>> 1) / j2) << 1;
long j4 = j - (j3 * j2);
if (j4 >= j2) {
j4 -= j2;
j3++;
}
StringBuilder sb = new StringBuilder();
String l2 = Long.toString(j3, CharsKt.checkRadix(i));
Intrinsics.checkNotNullExpressionValue(l2, "toString(...)");
sb.append(l2);
String l3 = Long.toString(j4, CharsKt.checkRadix(i));
Intrinsics.checkNotNullExpressionValue(l3, "toString(...)");
sb.append(l3);
return sb.toString();
}
}