soul-browser/sources/java/com/mycompany/app/down/DownParseTsfile.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

156 lines
6.1 KiB
Java

package com.mycompany.app.down;
import android.content.Context;
import android.support.v4.media.a;
import android.text.TextUtils;
import com.mycompany.app.main.MainDownSvc;
import com.mycompany.app.main.MainUtil;
import java.util.ArrayList;
import java.util.Locale;
/* loaded from: classes3.dex */
public class DownParseTsfile {
public static ArrayList a(Context context, String str, String str2, MainDownSvc.DownItem downItem, boolean z, MainUtil.LoopCancelListener loopCancelListener) {
int lastIndexOf;
int i;
int lastIndexOf2;
boolean z2;
int i2;
int i3;
int b;
ArrayList arrayList = null;
if (downItem != null || loopCancelListener != null) {
String M0 = MainUtil.M0(str);
if (!TextUtils.isEmpty(M0)) {
if (z) {
lastIndexOf = M0.lastIndexOf(46);
} else {
lastIndexOf = M0.lastIndexOf(".ts");
}
int i4 = lastIndexOf;
if (i4 > 0 && i4 < M0.length() && (lastIndexOf2 = M0.lastIndexOf(47, i4 - 1)) > 0) {
int lastIndexOf3 = M0.lastIndexOf("-v1-a1", i);
if (lastIndexOf3 > lastIndexOf2 && lastIndexOf3 < i4) {
z2 = true;
} else {
z2 = false;
String J1 = MainUtil.J1(M0, false);
if (!TextUtils.isEmpty(J1)) {
z2 = J1.endsWith("cdn.qooqlevideo.com");
}
}
if (!z2) {
int i5 = -1;
i3 = -1;
while (i != lastIndexOf2) {
char charAt = M0.charAt(i);
if (charAt >= '0' && charAt <= '9') {
if (i3 == -1) {
i3 = i + 1;
}
i5 = i;
} else if (i3 != -1) {
break;
}
i--;
}
if (i5 != -1 && i3 != -1) {
i2 = b(M0, i5, i3, z);
arrayList = d(context, M0, str2, i2, i3, downItem, loopCancelListener);
if (arrayList != null && arrayList.size() > 1) {
return arrayList;
}
}
} else {
i2 = -1;
i3 = -1;
}
int i6 = -1;
int i7 = -1;
for (int i8 = lastIndexOf2 + 1; i8 != i4; i8++) {
char charAt2 = M0.charAt(i8);
if (charAt2 >= '0' && charAt2 <= '9') {
if (i6 == -1) {
i6 = i8;
}
i7 = i8 + 1;
} else if (i6 != -1) {
break;
}
}
if (i6 != -1 && i7 != -1 && i2 != (b = b(M0, i6, i7, z)) && i3 != i7) {
return d(context, M0, str2, b, i7, downItem, loopCancelListener);
}
}
}
}
return arrayList;
}
public static int b(String str, int i, int i2, boolean z) {
if (z) {
int indexOf = str.indexOf("000", i);
if (indexOf >= i && indexOf < i2 - 3) {
return indexOf;
}
int indexOf2 = str.indexOf("00", i);
if (indexOf2 >= i && indexOf2 < i2 - 2) {
return indexOf2;
}
int indexOf3 = str.indexOf(48, i);
if (indexOf3 >= i && indexOf3 < i2 - 1) {
return indexOf3;
}
}
return Math.max(i, i2 - 5);
}
public static int c(Context context, int i, int i2, String str, String str2, String str3, String str4, MainDownSvc.DownItem downItem, MainUtil.LoopCancelListener loopCancelListener) {
int i3;
do {
i3 = i;
i += i2;
if (i >= 100000) {
break;
}
if (f(downItem, loopCancelListener)) {
return -1;
}
} while (MainUtil.j6(context, e(i, str, str2, str3), str4));
return i3;
}
/* JADX WARN: Removed duplicated region for block: B:34:0x00b0 */
/* JADX WARN: Removed duplicated region for block: B:46:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.util.ArrayList d(android.content.Context r12, java.lang.String r13, java.lang.String r14, int r15, int r16, com.mycompany.app.main.MainDownSvc.DownItem r17, com.mycompany.app.main.MainUtil.LoopCancelListener r18) {
/*
Method dump skipped, instructions count: 247
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.mycompany.app.down.DownParseTsfile.d(android.content.Context, java.lang.String, java.lang.String, int, int, com.mycompany.app.main.MainDownSvc$DownItem, com.mycompany.app.main.MainUtil$LoopCancelListener):java.util.ArrayList");
}
public static String e(int i, String str, String str2, String str3) {
StringBuilder t = a.t(str);
t.append(String.format(Locale.US, str2, Integer.valueOf(i)));
t.append(str3);
return t.toString();
}
public static boolean f(MainDownSvc.DownItem downItem, MainUtil.LoopCancelListener loopCancelListener) {
if (downItem != null) {
if (downItem.f16518c == 6) {
return true;
}
return false;
}
if (loopCancelListener != null && loopCancelListener.isCancelled()) {
return true;
}
return false;
}
}