soul-browser/sources/java/kotlin/jvm/internal/Reflection.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

196 lines
7.3 KiB
Java

package kotlin.jvm.internal;
import com.google.android.gms.ads.RequestConfiguration;
import java.util.Arrays;
import java.util.Collections;
import kotlin.SinceKotlin;
import kotlin.collections.ArraysKt;
import kotlin.reflect.KClass;
import kotlin.reflect.KClassifier;
import kotlin.reflect.KDeclarationContainer;
import kotlin.reflect.KFunction;
import kotlin.reflect.KMutableProperty0;
import kotlin.reflect.KMutableProperty1;
import kotlin.reflect.KMutableProperty2;
import kotlin.reflect.KProperty0;
import kotlin.reflect.KProperty1;
import kotlin.reflect.KProperty2;
import kotlin.reflect.KType;
import kotlin.reflect.KTypeParameter;
import kotlin.reflect.KTypeProjection;
import kotlin.reflect.KVariance;
/* loaded from: classes4.dex */
public class Reflection {
private static final KClass[] EMPTY_K_CLASS_ARRAY;
static final String REFLECTION_NOT_AVAILABLE = " (Kotlin reflection is not available)";
private static final ReflectionFactory factory;
static {
ReflectionFactory reflectionFactory = null;
try {
reflectionFactory = (ReflectionFactory) Class.forName("kotlin.reflect.jvm.internal.ReflectionFactoryImpl").newInstance();
} catch (ClassCastException | ClassNotFoundException | IllegalAccessException | InstantiationException unused) {
}
if (reflectionFactory == null) {
reflectionFactory = new ReflectionFactory();
}
factory = reflectionFactory;
EMPTY_K_CLASS_ARRAY = new KClass[0];
}
public static KClass createKotlinClass(Class cls) {
return factory.createKotlinClass(cls);
}
public static KFunction function(FunctionReference functionReference) {
return factory.function(functionReference);
}
public static KClass getOrCreateKotlinClass(Class cls) {
return factory.getOrCreateKotlinClass(cls);
}
public static KClass[] getOrCreateKotlinClasses(Class[] clsArr) {
int length = clsArr.length;
if (length == 0) {
return EMPTY_K_CLASS_ARRAY;
}
KClass[] kClassArr = new KClass[length];
for (int i = 0; i < length; i++) {
kClassArr[i] = getOrCreateKotlinClass(clsArr[i]);
}
return kClassArr;
}
@SinceKotlin(version = "1.4")
public static KDeclarationContainer getOrCreateKotlinPackage(Class cls) {
return factory.getOrCreateKotlinPackage(cls, RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED);
}
@SinceKotlin(version = "1.6")
public static KType mutableCollectionType(KType kType) {
return factory.mutableCollectionType(kType);
}
public static KMutableProperty0 mutableProperty0(MutablePropertyReference0 mutablePropertyReference0) {
return factory.mutableProperty0(mutablePropertyReference0);
}
public static KMutableProperty1 mutableProperty1(MutablePropertyReference1 mutablePropertyReference1) {
return factory.mutableProperty1(mutablePropertyReference1);
}
public static KMutableProperty2 mutableProperty2(MutablePropertyReference2 mutablePropertyReference2) {
return factory.mutableProperty2(mutablePropertyReference2);
}
@SinceKotlin(version = "1.6")
public static KType nothingType(KType kType) {
return factory.nothingType(kType);
}
@SinceKotlin(version = "1.4")
public static KType nullableTypeOf(KClassifier kClassifier) {
return factory.typeOf(kClassifier, Collections.EMPTY_LIST, true);
}
@SinceKotlin(version = "1.6")
public static KType platformType(KType kType, KType kType2) {
return factory.platformType(kType, kType2);
}
public static KProperty0 property0(PropertyReference0 propertyReference0) {
return factory.property0(propertyReference0);
}
public static KProperty1 property1(PropertyReference1 propertyReference1) {
return factory.property1(propertyReference1);
}
public static KProperty2 property2(PropertyReference2 propertyReference2) {
return factory.property2(propertyReference2);
}
@SinceKotlin(version = "1.1")
public static String renderLambdaToString(Lambda lambda) {
return factory.renderLambdaToString(lambda);
}
@SinceKotlin(version = "1.4")
public static void setUpperBounds(KTypeParameter kTypeParameter, KType kType) {
factory.setUpperBounds(kTypeParameter, Collections.singletonList(kType));
}
@SinceKotlin(version = "1.4")
public static KType typeOf(KClassifier kClassifier) {
return factory.typeOf(kClassifier, Collections.EMPTY_LIST, false);
}
@SinceKotlin(version = "1.4")
public static KTypeParameter typeParameter(Object obj, String str, KVariance kVariance, boolean z) {
return factory.typeParameter(obj, str, kVariance, z);
}
public static KClass createKotlinClass(Class cls, String str) {
return factory.createKotlinClass(cls, str);
}
public static KClass getOrCreateKotlinClass(Class cls, String str) {
return factory.getOrCreateKotlinClass(cls, str);
}
public static KDeclarationContainer getOrCreateKotlinPackage(Class cls, String str) {
return factory.getOrCreateKotlinPackage(cls, str);
}
@SinceKotlin(version = "1.4")
public static KType nullableTypeOf(Class cls) {
return factory.typeOf(getOrCreateKotlinClass(cls), Collections.EMPTY_LIST, true);
}
@SinceKotlin(version = "1.3")
public static String renderLambdaToString(FunctionBase functionBase) {
return factory.renderLambdaToString(functionBase);
}
@SinceKotlin(version = "1.4")
public static void setUpperBounds(KTypeParameter kTypeParameter, KType... kTypeArr) {
factory.setUpperBounds(kTypeParameter, ArraysKt.toList(kTypeArr));
}
@SinceKotlin(version = "1.4")
public static KType typeOf(Class cls) {
return factory.typeOf(getOrCreateKotlinClass(cls), Collections.EMPTY_LIST, false);
}
@SinceKotlin(version = "1.4")
public static KType nullableTypeOf(Class cls, KTypeProjection kTypeProjection) {
return factory.typeOf(getOrCreateKotlinClass(cls), Collections.singletonList(kTypeProjection), true);
}
@SinceKotlin(version = "1.4")
public static KType typeOf(Class cls, KTypeProjection kTypeProjection) {
return factory.typeOf(getOrCreateKotlinClass(cls), Collections.singletonList(kTypeProjection), false);
}
@SinceKotlin(version = "1.4")
public static KType nullableTypeOf(Class cls, KTypeProjection kTypeProjection, KTypeProjection kTypeProjection2) {
return factory.typeOf(getOrCreateKotlinClass(cls), Arrays.asList(kTypeProjection, kTypeProjection2), true);
}
@SinceKotlin(version = "1.4")
public static KType typeOf(Class cls, KTypeProjection kTypeProjection, KTypeProjection kTypeProjection2) {
return factory.typeOf(getOrCreateKotlinClass(cls), Arrays.asList(kTypeProjection, kTypeProjection2), false);
}
@SinceKotlin(version = "1.4")
public static KType nullableTypeOf(Class cls, KTypeProjection... kTypeProjectionArr) {
return factory.typeOf(getOrCreateKotlinClass(cls), ArraysKt.toList(kTypeProjectionArr), true);
}
@SinceKotlin(version = "1.4")
public static KType typeOf(Class cls, KTypeProjection... kTypeProjectionArr) {
return factory.typeOf(getOrCreateKotlinClass(cls), ArraysKt.toList(kTypeProjectionArr), false);
}
}