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

245 lines
7.1 KiB
Java

package com.google.android.gms.internal.cast;
import java.util.Locale;
import java.util.logging.Level;
import kotlin.uuid.Uuid;
/* loaded from: classes.dex */
final class zzxn extends zzxp {
public final byte[] d;
public final int e;
public int f;
public zzxn(byte[] bArr, int i) {
int length = bArr.length;
if (((length - i) | i) >= 0) {
this.d = bArr;
this.f = 0;
this.e = i;
return;
}
Locale locale = Locale.US;
throw new IllegalArgumentException(androidx.work.impl.workers.a.s("Array range is invalid. Buffer.length=", length, i, ", offset=0, length="));
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void b(int i, int i2) {
m((i << 3) | i2);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void c(int i, int i2) {
m(i << 3);
l(i2);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void d(int i, int i2) {
m(i << 3);
m(i2);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void e(int i, int i2) {
m((i << 3) | 5);
n(i2);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void f(int i, long j) {
m(i << 3);
o(j);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void g(int i, long j) {
m((i << 3) | 1);
p(j);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void h(int i, boolean z) {
m(i << 3);
k(z ? (byte) 1 : (byte) 0);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void i(int i, String str) {
m((i << 3) | 2);
int i2 = this.f;
try {
int q = zzxp.q(str.length() * 3);
int q2 = zzxp.q(str.length());
int i3 = this.e;
byte[] bArr = this.d;
if (q2 == q) {
int i4 = i2 + q2;
this.f = i4;
int b = zzaam.b(str, bArr, i4, i3 - i4);
this.f = i2;
m((b - i2) - q2);
this.f = b;
return;
}
m(zzaam.a(str));
int i5 = this.f;
this.f = zzaam.b(str, bArr, i5, i3 - i5);
} catch (zzaal e) {
this.f = i2;
zzxp.b.logp(Level.WARNING, "com.google.protobuf.CodedOutputStream", "inefficientWriteStringNoTag", "Converting ill-formed UTF-16. Your Protocol Buffer will not round trip correctly!", (Throwable) e);
byte[] bytes = str.getBytes(zzym.f9882a);
try {
int length = bytes.length;
m(length);
t(bytes, length);
} catch (IndexOutOfBoundsException e2) {
throw new zzxo(e2);
}
} catch (IndexOutOfBoundsException e3) {
throw new zzxo(e3);
}
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void j(int i, zzxk zzxkVar) {
m((i << 3) | 2);
m(zzxkVar.g());
zzxkVar.k(this);
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void k(byte b) {
int i = this.f;
try {
int i2 = i + 1;
try {
this.d[i] = b;
this.f = i2;
} catch (IndexOutOfBoundsException e) {
e = e;
i = i2;
throw new zzxo(i, this.e, 1, e);
}
} catch (IndexOutOfBoundsException e2) {
e = e2;
}
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void l(int i) {
if (i >= 0) {
m(i);
} else {
o(i);
}
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void m(int i) {
int i2;
int i3 = this.f;
while (true) {
int i4 = i & (-128);
byte[] bArr = this.d;
if (i4 == 0) {
i2 = i3 + 1;
bArr[i3] = (byte) i;
this.f = i2;
return;
} else {
i2 = i3 + 1;
try {
bArr[i3] = (byte) (i | Uuid.SIZE_BITS);
i >>>= 7;
i3 = i2;
} catch (IndexOutOfBoundsException e) {
throw new zzxo(i2, this.e, 1, e);
}
}
throw new zzxo(i2, this.e, 1, e);
}
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void n(int i) {
int i2 = this.f;
try {
byte[] bArr = this.d;
bArr[i2] = (byte) i;
bArr[i2 + 1] = (byte) (i >> 8);
bArr[i2 + 2] = (byte) (i >> 16);
bArr[i2 + 3] = (byte) (i >> 24);
this.f = i2 + 4;
} catch (IndexOutOfBoundsException e) {
throw new zzxo(i2, this.e, 4, e);
}
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void o(long j) {
int i;
int i2 = this.f;
int i3 = this.e;
byte[] bArr = this.d;
if (zzxp.f9871c && i3 - i2 >= 10) {
long j2 = j;
while ((j2 & (-128)) != 0) {
zzaak.f9609c.a(bArr, zzaak.f + i2, (byte) (((int) j2) | Uuid.SIZE_BITS));
j2 >>>= 7;
i2++;
}
i = i2 + 1;
zzaak.f9609c.a(bArr, zzaak.f + i2, (byte) j2);
} else {
long j3 = j;
while ((j3 & (-128)) != 0) {
int i4 = i2 + 1;
try {
bArr[i2] = (byte) (((int) j3) | Uuid.SIZE_BITS);
j3 >>>= 7;
i2 = i4;
} catch (IndexOutOfBoundsException e) {
e = e;
i = i4;
throw new zzxo(i, i3, 1, e);
}
}
i = i2 + 1;
try {
bArr[i2] = (byte) j3;
} catch (IndexOutOfBoundsException e2) {
e = e2;
throw new zzxo(i, i3, 1, e);
}
}
this.f = i;
}
@Override // com.google.android.gms.internal.cast.zzxp
public final void p(long j) {
int i = this.f;
try {
byte[] bArr = this.d;
bArr[i] = (byte) j;
bArr[i + 1] = (byte) (j >> 8);
bArr[i + 2] = (byte) (j >> 16);
bArr[i + 3] = (byte) (j >> 24);
bArr[i + 4] = (byte) (j >> 32);
bArr[i + 5] = (byte) (j >> 40);
bArr[i + 6] = (byte) (j >> 48);
bArr[i + 7] = (byte) (j >> 56);
this.f = i + 8;
} catch (IndexOutOfBoundsException e) {
throw new zzxo(i, this.e, 8, e);
}
}
public final void t(byte[] bArr, int i) {
try {
System.arraycopy(bArr, 0, this.d, this.f, i);
this.f += i;
} catch (IndexOutOfBoundsException e) {
throw new zzxo(this.f, this.e, i, e);
}
}
}