soul-browser/sources/java/androidx/profileinstaller/ProfileVerifier.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

148 lines
5.3 KiB
Java

package androidx.profileinstaller;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.annotation.DoNotInline;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.concurrent.futures.ResolvableFuture;
import j$.util.Objects;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public final class ProfileVerifier {
/* renamed from: a, reason: collision with root package name */
public static final ResolvableFuture f1480a = new Object();
public static final Object b = new Object();
/* renamed from: c, reason: collision with root package name */
public static CompilationStatus f1481c = null;
@RequiresApi
/* loaded from: classes.dex */
public static class Api33Impl {
@DoNotInline
public static PackageInfo a(PackageManager packageManager, Context context) {
return packageManager.getPackageInfo(context.getPackageName(), PackageManager.PackageInfoFlags.of(0L));
}
}
@RestrictTo
/* loaded from: classes.dex */
public static class Cache {
/* renamed from: a, reason: collision with root package name */
public final int f1482a;
public final int b;
/* renamed from: c, reason: collision with root package name */
public final long f1483c;
public final long d;
public Cache(int i, int i2, long j, long j2) {
this.f1482a = i;
this.b = i2;
this.f1483c = j;
this.d = j2;
}
public static Cache a(File file) {
DataInputStream dataInputStream = new DataInputStream(new FileInputStream(file));
try {
Cache cache = new Cache(dataInputStream.readInt(), dataInputStream.readInt(), dataInputStream.readLong(), dataInputStream.readLong());
dataInputStream.close();
return cache;
} finally {
}
}
public final void b(File file) {
file.delete();
DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(file));
try {
dataOutputStream.writeInt(this.f1482a);
dataOutputStream.writeInt(this.b);
dataOutputStream.writeLong(this.f1483c);
dataOutputStream.writeLong(this.d);
dataOutputStream.close();
} catch (Throwable th) {
try {
dataOutputStream.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
throw th;
}
}
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj != null && (obj instanceof Cache)) {
Cache cache = (Cache) obj;
if (this.b == cache.b && this.f1483c == cache.f1483c && this.f1482a == cache.f1482a && this.d == cache.d) {
return true;
}
}
return false;
}
public final int hashCode() {
return Objects.hash(Integer.valueOf(this.b), Long.valueOf(this.f1483c), Integer.valueOf(this.f1482a), Long.valueOf(this.d));
}
}
/* loaded from: classes.dex */
public static class CompilationStatus {
@Retention(RetentionPolicy.SOURCE)
@RestrictTo
/* loaded from: classes.dex */
public @interface ResultCode {
}
}
public static long a(Context context) {
PackageManager packageManager = context.getApplicationContext().getPackageManager();
if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.a(packageManager, context).lastUpdateTime;
}
return packageManager.getPackageInfo(context.getPackageName(), 0).lastUpdateTime;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v0, types: [java.lang.Object, androidx.profileinstaller.ProfileVerifier$CompilationStatus] */
public static CompilationStatus b() {
?? obj = new Object();
f1481c = obj;
f1480a.i(obj);
return f1481c;
}
/* JADX WARN: Can't wrap try/catch for region: R(21:14|(1:80)(1:18)|19|(1:79)(1:23)|24|25|26|(2:64|65)(1:28)|29|(9:36|(1:40)|(1:47)|48|(2:56|57)|52|53|54|55)|(1:63)|(1:40)|(3:42|45|47)|48|(1:50)|56|57|52|53|54|55) */
/* JADX WARN: Code restructure failed: missing block: B:61:0x009e, code lost:
r6 = 1;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static void c(android.content.Context r18, boolean r19) {
/*
Method dump skipped, instructions count: 220
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.profileinstaller.ProfileVerifier.c(android.content.Context, boolean):void");
}
}