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

133 lines
6.7 KiB
Java

package kotlin.io;
import com.google.android.gms.ads.RequestConfiguration;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.StringsKt__StringsKt;
import org.jetbrains.annotations.NotNull;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000&\n\u0000\n\u0002\u0010\b\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u001a\u0011\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0002¢\u0006\u0002\b\u0003\u001a\f\u0010\u000e\u001a\u00020\u000f*\u00020\u0005H\u0000\u001a\u001c\u0010\u0010\u001a\u00020\u0005*\u00020\u00052\u0006\u0010\u0011\u001a\u00020\u00012\u0006\u0010\u0012\u001a\u00020\u0001H\u0000\"\u0018\u0010\u0004\u001a\u00020\u0002*\u00020\u00058@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u0006\u0010\u0007\"\u0018\u0010\b\u001a\u00020\u0005*\u00020\u00058@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\t\u0010\n\"\u0015\u0010\u000b\u001a\u00020\f*\u00020\u00058F¢\u0006\u0006\u001a\u0004\b\u000b\u0010\\u0006\u0013"}, d2 = {"getRootLength", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "getRootLength$FilesKt__FilePathComponentsKt", "rootName", "Ljava/io/File;", "getRootName", "(Ljava/io/File;)Ljava/lang/String;", "root", "getRoot", "(Ljava/io/File;)Ljava/io/File;", "isRooted", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "(Ljava/io/File;)Z", "toComponents", "Lkotlin/io/FilePathComponents;", "subPath", "beginIndex", "endIndex", "kotlin-stdlib"}, k = 5, mv = {2, 2, 0}, xi = 49, xs = "kotlin/io/FilesKt")
@SourceDebugExtension({"SMAP\nFilePathComponents.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FilePathComponents.kt\nkotlin/io/FilesKt__FilePathComponentsKt\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,149:1\n1563#2:150\n1634#2,3:151\n*S KotlinDebug\n*F\n+ 1 FilePathComponents.kt\nkotlin/io/FilesKt__FilePathComponentsKt\n*L\n134#1:150\n134#1:151,3\n*E\n"})
/* loaded from: classes.dex */
public class FilesKt__FilePathComponentsKt {
@NotNull
public static final File getRoot(@NotNull File file) {
Intrinsics.checkNotNullParameter(file, "<this>");
return new File(getRootName(file));
}
/* JADX WARN: Code restructure failed: missing block: B:7:0x0017, code lost:
r1 = kotlin.text.StringsKt__StringsKt.indexOf$default(r5, r0, 2, false, 4, (java.lang.Object) null);
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static final int getRootLength$FilesKt__FilePathComponentsKt(java.lang.String r5) {
/*
char r0 = java.io.File.separatorChar
r1 = 0
r2 = 4
int r3 = kotlin.text.StringsKt.u(r5, r0, r1, r2)
r4 = 1
if (r3 != 0) goto L2d
int r1 = r5.length()
if (r1 <= r4) goto L2c
char r1 = r5.charAt(r4)
if (r1 != r0) goto L2c
r1 = 2
int r1 = kotlin.text.StringsKt.u(r5, r0, r1, r2)
if (r1 < 0) goto L2c
int r1 = r1 + r4
int r0 = kotlin.text.StringsKt.u(r5, r0, r1, r2)
if (r0 < 0) goto L27
int r0 = r0 + r4
return r0
L27:
int r5 = r5.length()
return r5
L2c:
return r4
L2d:
r0 = 58
if (r3 <= 0) goto L3b
int r2 = r3 + (-1)
char r2 = r5.charAt(r2)
if (r2 != r0) goto L3b
int r3 = r3 + r4
return r3
L3b:
r2 = -1
if (r3 != r2) goto L49
boolean r0 = kotlin.text.StringsKt.r(r0, r5)
if (r0 == 0) goto L49
int r5 = r5.length()
return r5
L49:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: kotlin.io.FilesKt__FilePathComponentsKt.getRootLength$FilesKt__FilePathComponentsKt(java.lang.String):int");
}
@NotNull
public static final String getRootName(@NotNull File file) {
Intrinsics.checkNotNullParameter(file, "<this>");
String path = file.getPath();
Intrinsics.checkNotNullExpressionValue(path, "getPath(...)");
String path2 = file.getPath();
Intrinsics.checkNotNullExpressionValue(path2, "getPath(...)");
String substring = path.substring(0, getRootLength$FilesKt__FilePathComponentsKt(path2));
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
return substring;
}
public static final boolean isRooted(@NotNull File file) {
Intrinsics.checkNotNullParameter(file, "<this>");
String path = file.getPath();
Intrinsics.checkNotNullExpressionValue(path, "getPath(...)");
if (getRootLength$FilesKt__FilePathComponentsKt(path) > 0) {
return true;
}
return false;
}
@NotNull
public static final File subPath(@NotNull File file, int i, int i2) {
Intrinsics.checkNotNullParameter(file, "<this>");
return toComponents(file).subPath(i, i2);
}
@NotNull
public static final FilePathComponents toComponents(@NotNull File file) {
List split$default;
List list;
Intrinsics.checkNotNullParameter(file, "<this>");
String path = file.getPath();
Intrinsics.checkNotNull(path);
int rootLength$FilesKt__FilePathComponentsKt = getRootLength$FilesKt__FilePathComponentsKt(path);
String substring = path.substring(0, rootLength$FilesKt__FilePathComponentsKt);
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
String substring2 = path.substring(rootLength$FilesKt__FilePathComponentsKt);
Intrinsics.checkNotNullExpressionValue(substring2, "substring(...)");
if (substring2.length() != 0) {
split$default = StringsKt__StringsKt.split$default((CharSequence) substring2, new char[]{File.separatorChar}, false, 0, 6, (Object) null);
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(split$default, 10));
Iterator it = split$default.iterator();
while (it.hasNext()) {
arrayList.add(new File((String) it.next()));
}
list = arrayList;
} else {
list = CollectionsKt.emptyList();
}
return new FilePathComponents(new File(substring), list);
}
}