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

183 lines
8.4 KiB
Java

package okhttp3.internal.platform;
import android.os.Build;
import android.support.v4.media.a;
import com.google.android.gms.ads.RequestConfiguration;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.X509TrustManager;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.internal.platform.android.AndroidLog;
import okhttp3.internal.tls.BasicCertificateChainCleaner;
import okhttp3.internal.tls.BasicTrustRootIndex;
import okhttp3.internal.tls.CertificateChainCleaner;
import okhttp3.internal.tls.TrustRootIndex;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\b\u0016\u0018\u00002\u00020\u0001:\u0001\u0002¨\u0006\u0003"}, d2 = {"Lokhttp3/internal/platform/Platform;", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "Companion", "okhttp"}, k = 1, mv = {2, 2, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nPlatform.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Platform.kt\nokhttp3/internal/platform/Platform\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,241:1\n1617#2,9:242\n1869#2:251\n1870#2:253\n1626#2:254\n1#3:252\n*S KotlinDebug\n*F\n+ 1 Platform.kt\nokhttp3/internal/platform/Platform\n*L\n134#1:242,9\n134#1:251\n134#1:253\n134#1:254\n134#1:252\n*E\n"})
/* loaded from: classes4.dex */
public class Platform {
/* renamed from: a, reason: collision with root package name */
public static volatile Platform f22173a;
public static final Logger b;
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001R\u0016\u0010\u0003\u001a\u00020\u00028\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0006\u001a\u00020\u00058\u0006X\u0086T¢\u0006\u0006\n\u0004\b\u0006\u0010\u0007R\u0014\u0010\b\u001a\u00020\u00058\u0006X\u0086T¢\u0006\u0006\n\u0004\b\b\u0010\u0007R\u001c\u0010\u000b\u001a\n \n*\u0004\u0018\u00010\t0\t8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u000b\u0010\\u0006\r"}, d2 = {"Lokhttp3/internal/platform/Platform$Companion;", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "Lokhttp3/internal/platform/Platform;", "platform", "Lokhttp3/internal/platform/Platform;", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "INFO", "I", "WARN", "Ljava/util/logging/Logger;", "kotlin.jvm.PlatformType", "logger", "Ljava/util/logging/Logger;", "okhttp"}, k = 1, mv = {2, 2, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nPlatform.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Platform.kt\nokhttp3/internal/platform/Platform$Companion\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,241:1\n774#2:242\n865#2,2:243\n1563#2:245\n1634#2,3:246\n*S KotlinDebug\n*F\n+ 1 Platform.kt\nokhttp3/internal/platform/Platform$Companion\n*L\n219#1:242\n219#1:243,2\n219#1:245\n219#1:246,3\n*E\n"})
/* loaded from: classes4.dex */
public static final class Companion {
public static ArrayList a(List protocols) {
Intrinsics.checkNotNullParameter(protocols, "protocols");
ArrayList arrayList = new ArrayList();
for (Object obj : protocols) {
if (((Protocol) obj) != Protocol.g) {
arrayList.add(obj);
}
}
ArrayList arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(arrayList, 10));
int size = arrayList.size();
int i = 0;
while (i < size) {
Object obj2 = arrayList.get(i);
i++;
arrayList2.add(((Protocol) obj2).f22060c);
}
return arrayList2;
}
/* JADX WARN: Type inference failed for: r0v1, types: [okio.Buffer, java.lang.Object] */
public static byte[] b(List protocols) {
Intrinsics.checkNotNullParameter(protocols, "protocols");
?? obj = new Object();
ArrayList a2 = a(protocols);
int size = a2.size();
int i = 0;
while (i < size) {
Object obj2 = a2.get(i);
i++;
String str = (String) obj2;
obj.v(str.length());
obj.S(str);
}
return obj.i(obj.f);
}
}
static {
Platform platform;
try {
for (Map.Entry entry : AndroidLog.b.entrySet()) {
AndroidLog.b((String) entry.getKey(), (String) entry.getValue());
}
} catch (RuntimeException e) {
System.err.println("Possibly running android unit test without robolectric");
e.printStackTrace();
} catch (UnsatisfiedLinkError e2) {
System.err.println("Possibly running android unit test without robolectric");
e2.printStackTrace();
}
AndroidPlatform androidPlatform = null;
if (Android10Platform.e) {
platform = new Android10Platform();
} else {
platform = null;
}
if (platform == null) {
if (AndroidPlatform.e) {
androidPlatform = new AndroidPlatform();
}
platform = androidPlatform;
}
if (platform != null) {
f22173a = platform;
b = Logger.getLogger(OkHttpClient.class.getName());
return;
}
throw new IllegalStateException(a.e(Build.VERSION.SDK_INT, "Expected Android API level 21+ but was "));
}
public CertificateChainCleaner c(X509TrustManager trustManager) {
Intrinsics.checkNotNullParameter(trustManager, "trustManager");
return new BasicCertificateChainCleaner(d(trustManager));
}
public TrustRootIndex d(X509TrustManager trustManager) {
Intrinsics.checkNotNullParameter(trustManager, "trustManager");
X509Certificate[] acceptedIssuers = trustManager.getAcceptedIssuers();
return new BasicTrustRootIndex((X509Certificate[]) Arrays.copyOf(acceptedIssuers, acceptedIssuers.length));
}
public void e(SSLSocket sslSocket, String str, List protocols) {
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
Intrinsics.checkNotNullParameter(protocols, "protocols");
}
public void f(Socket socket, InetSocketAddress address, int i) {
Intrinsics.checkNotNullParameter(socket, "socket");
Intrinsics.checkNotNullParameter(address, "address");
socket.connect(address, i);
}
public String g(SSLSocket sslSocket) {
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
return null;
}
public Object h() {
Intrinsics.checkNotNullParameter("response.body().close()", "closer");
if (b.isLoggable(Level.FINE)) {
return new Throwable("response.body().close()");
}
return null;
}
public boolean i(String hostname) {
Intrinsics.checkNotNullParameter(hostname, "hostname");
return true;
}
public void j(int i, String message, Throwable th) {
Level level;
Intrinsics.checkNotNullParameter(message, "message");
if (i == 5) {
level = Level.WARNING;
} else {
level = Level.INFO;
}
b.log(level, message, th);
}
public void k(Object obj, String message) {
Intrinsics.checkNotNullParameter(message, "message");
if (obj == null) {
message = a.k(message, " To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);");
}
j(5, message, (Throwable) obj);
}
public SSLContext l() {
SSLContext sSLContext = SSLContext.getInstance("TLS");
Intrinsics.checkNotNullExpressionValue(sSLContext, "getInstance(...)");
return sSLContext;
}
public final String toString() {
String simpleName = getClass().getSimpleName();
Intrinsics.checkNotNullExpressionValue(simpleName, "getSimpleName(...)");
return simpleName;
}
}