soul-browser/sources/java/okhttp3/internal/tls/OkHostnameVerifier.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

128 lines
5.5 KiB
Java

package okhttp3.internal.tls;
import android.support.v4.media.a;
import java.security.cert.Certificate;
import java.security.cert.CertificateParsingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSession;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lokhttp3/internal/tls/OkHostnameVerifier;", "Ljavax/net/ssl/HostnameVerifier;", "okhttp"}, k = 1, mv = {2, 2, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nOkHostnameVerifier.kt\nKotlin\n*S Kotlin\n*F\n+ 1 OkHostnameVerifier.kt\nokhttp3/internal/tls/OkHostnameVerifier\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,224:1\n1761#2,3:225\n1761#2,3:228\n*S KotlinDebug\n*F\n+ 1 OkHostnameVerifier.kt\nokhttp3/internal/tls/OkHostnameVerifier\n*L\n69#1:225,3\n80#1:228,3\n*E\n"})
/* loaded from: classes4.dex */
public final class OkHostnameVerifier implements HostnameVerifier {
/* renamed from: a, reason: collision with root package name */
public static final OkHostnameVerifier f22190a = new Object();
public static List a(X509Certificate x509Certificate, int i) {
Object obj;
try {
Collection<List<?>> subjectAlternativeNames = x509Certificate.getSubjectAlternativeNames();
if (subjectAlternativeNames == null) {
return CollectionsKt.emptyList();
}
ArrayList arrayList = new ArrayList();
for (List<?> list : subjectAlternativeNames) {
if (list != null && list.size() >= 2 && Intrinsics.areEqual(list.get(0), Integer.valueOf(i)) && (obj = list.get(1)) != null) {
arrayList.add((String) obj);
}
}
return arrayList;
} catch (CertificateParsingException unused) {
return CollectionsKt.emptyList();
}
}
public static boolean b(String str) {
int i;
char c2;
int length = str.length();
int length2 = str.length();
Intrinsics.checkNotNullParameter(str, "<this>");
if (length2 >= 0) {
if (length2 <= str.length()) {
long j = 0;
int i2 = 0;
while (i2 < length2) {
char charAt = str.charAt(i2);
if (charAt < 128) {
j++;
} else {
if (charAt < 2048) {
i = 2;
} else if (charAt >= 55296 && charAt <= 57343) {
int i3 = i2 + 1;
if (i3 < length2) {
c2 = str.charAt(i3);
} else {
c2 = 0;
}
if (charAt <= 56319 && c2 >= 56320 && c2 <= 57343) {
j += 4;
i2 += 2;
} else {
j++;
i2 = i3;
}
} else {
i = 3;
}
j += i;
}
i2++;
}
if (length != ((int) j)) {
return false;
}
return true;
}
StringBuilder s = a.s(length2, "endIndex > string.length: ", " > ");
s.append(str.length());
throw new IllegalArgumentException(s.toString().toString());
}
throw new IllegalArgumentException(a.f(length2, "endIndex < beginIndex: ", " < 0").toString());
}
/* JADX WARN: Code restructure failed: missing block: B:72:0x012f, code lost:
if (r0 != (-1)) goto L65;
*/
/* JADX WARN: Removed duplicated region for block: B:57:0x0135 A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:58:? A[LOOP:1: B:26:0x0073->B:58:?, LOOP_END, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static boolean c(java.lang.String r11, java.security.cert.X509Certificate r12) {
/*
Method dump skipped, instructions count: 311
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.tls.OkHostnameVerifier.c(java.lang.String, java.security.cert.X509Certificate):boolean");
}
@Override // javax.net.ssl.HostnameVerifier
public final boolean verify(String host, SSLSession session) {
Intrinsics.checkNotNullParameter(host, "host");
Intrinsics.checkNotNullParameter(session, "session");
if (b(host)) {
try {
Certificate certificate = session.getPeerCertificates()[0];
Intrinsics.checkNotNull(certificate, "null cannot be cast to non-null type java.security.cert.X509Certificate");
return c(host, (X509Certificate) certificate);
} catch (SSLException unused) {
return false;
}
}
return false;
}
}