soul-browser/sources/java/com/google/android/gms/internal/cast/zzaak.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

167 lines
5.5 KiB
Java

package com.google.android.gms.internal.cast;
import java.lang.reflect.Field;
import java.nio.Buffer;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import kotlin.KotlinVersion;
import sun.misc.Unsafe;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class zzaak {
/* renamed from: a, reason: collision with root package name */
public static final Unsafe f9608a;
public static final Class b;
/* renamed from: c, reason: collision with root package name */
public static final zzaaj f9609c;
public static final boolean d;
public static final boolean e;
public static final long f;
public static final boolean g;
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:15:0x014d */
/* JADX WARN: Removed duplicated region for block: B:20:0x015f */
/* JADX WARN: Removed duplicated region for block: B:24:0x008c */
/* JADX WARN: Type inference failed for: r16v0 */
/* JADX WARN: Type inference failed for: r16v1 */
/* JADX WARN: Type inference failed for: r16v2 */
/* JADX WARN: Type inference failed for: r16v3 */
static {
/*
Method dump skipped, instructions count: 356
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.cast.zzaak.<clinit>():void");
}
public static void a(Class cls) {
if (e) {
f9609c.f9607a.arrayIndexScale(cls);
}
}
public static Field b() {
Field field;
Field field2;
int i = zzxb.f9867a;
try {
field = Buffer.class.getDeclaredField("effectiveDirectAddress");
} catch (Throwable unused) {
field = null;
}
if (field == null) {
try {
field2 = Buffer.class.getDeclaredField("address");
} catch (Throwable unused2) {
field2 = null;
}
if (field2 == null || field2.getType() != Long.TYPE) {
return null;
}
return field2;
}
return field;
}
public static void c(Object obj, long j, byte b2) {
Unsafe unsafe = f9609c.f9607a;
long j2 = (-4) & j;
int i = unsafe.getInt(obj, j2);
int i2 = ((~((int) j)) & 3) << 3;
unsafe.putInt(obj, j2, ((255 & b2) << i2) | (i & (~(KotlinVersion.MAX_COMPONENT_VALUE << i2))));
}
public static void d(Object obj, long j, byte b2) {
Unsafe unsafe = f9609c.f9607a;
long j2 = (-4) & j;
int i = (((int) j) & 3) << 3;
unsafe.putInt(obj, j2, ((255 & b2) << i) | (unsafe.getInt(obj, j2) & (~(KotlinVersion.MAX_COMPONENT_VALUE << i))));
}
public static Object e(Class cls) {
try {
return f9608a.allocateInstance(cls);
} catch (InstantiationException e2) {
throw new IllegalStateException(e2);
}
}
public static int f(long j, Object obj) {
return f9609c.f9607a.getInt(obj, j);
}
public static void g(int i, long j, Object obj) {
f9609c.f9607a.putInt(obj, j, i);
}
public static long h(long j, Object obj) {
return f9609c.f9607a.getLong(obj, j);
}
public static void i(Object obj, long j, long j2) {
f9609c.f9607a.putLong(obj, j, j2);
}
public static Object j(long j, Object obj) {
return f9609c.f9607a.getObject(obj, j);
}
public static void k(long j, Object obj, Object obj2) {
f9609c.f9607a.putObject(obj, j, obj2);
}
/* JADX WARN: Type inference failed for: r0v1, types: [java.lang.Object, java.security.PrivilegedExceptionAction] */
public static Unsafe l() {
try {
return (Unsafe) AccessController.doPrivileged((PrivilegedExceptionAction) new Object());
} catch (Throwable unused) {
return null;
}
}
/* JADX WARN: Multi-variable type inference failed */
public static boolean m(Class cls) {
int i = zzxb.f9867a;
try {
Class cls2 = b;
Class cls3 = Boolean.TYPE;
cls2.getMethod("peekLong", cls, cls3);
cls2.getMethod("pokeLong", cls, Long.TYPE, cls3);
Class cls4 = Integer.TYPE;
cls2.getMethod("pokeInt", cls, cls4, cls3);
cls2.getMethod("peekInt", cls, cls3);
cls2.getMethod("pokeByte", cls, Byte.TYPE);
cls2.getMethod("peekByte", cls);
cls2.getMethod("pokeByteArray", cls, byte[].class, cls4, cls4);
cls2.getMethod("peekByteArray", cls, byte[].class, cls4, cls4);
return true;
} catch (Throwable unused) {
return false;
}
}
public static /* synthetic */ boolean n(long j, Object obj) {
if (((byte) ((f9609c.f9607a.getInt(obj, (-4) & j) >>> ((int) (((~j) & 3) << 3))) & KotlinVersion.MAX_COMPONENT_VALUE)) != 0) {
return true;
}
return false;
}
public static /* synthetic */ boolean o(long j, Object obj) {
if (((byte) ((f9609c.f9607a.getInt(obj, (-4) & j) >>> ((int) ((j & 3) << 3))) & KotlinVersion.MAX_COMPONENT_VALUE)) != 0) {
return true;
}
return false;
}
public static int p(Class cls) {
if (e) {
return f9609c.f9607a.arrayBaseOffset(cls);
}
return -1;
}
}