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

242 lines
10 KiB
Java

package okhttp3.internal.http2;
import com.google.android.gms.ads.RequestConfiguration;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import kotlin.Metadata;
import kotlin.UByte;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.ByteCompanionObject;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal._UtilCommonKt;
import okhttp3.internal.http2.Hpack;
import okhttp3.internal.http2.Http2Connection;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import okio.RealBufferedSource;
import okio.Source;
import okio.Timeout;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001:\u0003\u0002\u0003\u0004¨\u0006\u0005"}, d2 = {"Lokhttp3/internal/http2/Http2Reader;", "Ljava/io/Closeable;", "ContinuationSource", "Handler", "Companion", "okhttp"}, k = 1, mv = {2, 2, 0}, xi = 48)
/* loaded from: classes4.dex */
public final class Http2Reader implements Closeable {
public static final Logger h;
/* renamed from: c, reason: collision with root package name */
public final BufferedSource f22146c;
public final ContinuationSource f;
public final Hpack.Reader g;
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lokhttp3/internal/http2/Http2Reader$Companion;", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "okhttp"}, k = 1, mv = {2, 2, 0}, xi = 48)
/* loaded from: classes4.dex */
public static final class Companion {
public static int a(int i, int i2, int i3) {
if ((i2 & 8) != 0) {
i--;
}
if (i3 <= i) {
return i - i3;
}
throw new IOException(androidx.work.impl.workers.a.s("PROTOCOL_ERROR padding ", i3, i, " > remaining length "));
}
}
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0000\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lokhttp3/internal/http2/Http2Reader$ContinuationSource;", "Lokio/Source;", "okhttp"}, k = 1, mv = {2, 2, 0}, xi = 48)
/* loaded from: classes4.dex */
public static final class ContinuationSource implements Source {
/* renamed from: c, reason: collision with root package name */
public final BufferedSource f22147c;
public int f;
public int g;
public int h;
public int i;
public int j;
public ContinuationSource(BufferedSource source) {
Intrinsics.checkNotNullParameter(source, "source");
this.f22147c = source;
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public final void close() {
}
@Override // okio.Source
public final long p0(long j, Buffer sink) {
int i;
int readInt;
Intrinsics.checkNotNullParameter(sink, "sink");
do {
int i2 = this.i;
BufferedSource bufferedSource = this.f22147c;
if (i2 == 0) {
bufferedSource.skip(this.j);
this.j = 0;
if ((this.g & 4) == 0) {
i = this.h;
int k = _UtilCommonKt.k(bufferedSource);
this.i = k;
this.f = k;
int readByte = bufferedSource.readByte() & UByte.MAX_VALUE;
this.g = bufferedSource.readByte() & UByte.MAX_VALUE;
Logger logger = Http2Reader.h;
if (logger.isLoggable(Level.FINE)) {
ByteString byteString = Http2.f22137a;
logger.fine(Http2.b(true, this.h, this.f, readByte, this.g));
}
readInt = bufferedSource.readInt() & Integer.MAX_VALUE;
this.h = readInt;
if (readByte != 9) {
throw new IOException(readByte + " != TYPE_CONTINUATION");
}
}
} else {
long p0 = bufferedSource.p0(Math.min(j, i2), sink);
if (p0 != -1) {
this.i -= (int) p0;
return p0;
}
}
return -1L;
} while (readInt == i);
throw new IOException("TYPE_CONTINUATION streamId changed");
}
@Override // okio.Source
/* renamed from: timeout */
public final Timeout getF() {
return this.f22147c.getF();
}
}
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bf\u0018\u00002\u00020\u0001¨\u0006\u0002À\u0006\u0003"}, d2 = {"Lokhttp3/internal/http2/Http2Reader$Handler;", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "okhttp"}, k = 1, mv = {2, 2, 0}, xi = 48)
/* loaded from: classes4.dex */
public interface Handler {
}
static {
Logger logger = Logger.getLogger(Http2.class.getName());
Intrinsics.checkNotNullExpressionValue(logger, "getLogger(...)");
h = logger;
}
public Http2Reader(BufferedSource source) {
Intrinsics.checkNotNullParameter(source, "source");
this.f22146c = source;
ContinuationSource continuationSource = new ContinuationSource(source);
this.f = continuationSource;
this.g = new Hpack.Reader(continuationSource);
}
/* JADX WARN: Code restructure failed: missing block: B:132:0x01f6, code lost:
throw new java.io.IOException(android.support.v4.media.a.e(r9, "PROTOCOL_ERROR SETTINGS_MAX_FRAME_SIZE: "));
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final boolean a(boolean r19, okhttp3.internal.http2.Http2Connection.ReaderRunnable r20) {
/*
Method dump skipped, instructions count: 888
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.http2.Http2Reader.a(boolean, okhttp3.internal.http2.Http2Connection$ReaderRunnable):boolean");
}
public final List b(int i, int i2, int i3, int i4) {
ContinuationSource continuationSource = this.f;
continuationSource.i = i;
continuationSource.f = i;
continuationSource.j = i2;
continuationSource.g = i3;
continuationSource.h = i4;
Hpack.Reader reader = this.g;
RealBufferedSource realBufferedSource = reader.f22134c;
ArrayList arrayList = reader.b;
while (!realBufferedSource.D()) {
byte readByte = realBufferedSource.readByte();
byte[] bArr = _UtilCommonKt.f22076a;
int i5 = readByte & UByte.MAX_VALUE;
if (i5 != 128) {
if ((readByte & ByteCompanionObject.MIN_VALUE) == 128) {
int e = reader.e(i5, 127);
int i6 = e - 1;
if (i6 >= 0) {
Header[] headerArr = Hpack.f22132a;
if (i6 <= headerArr.length - 1) {
arrayList.add(headerArr[i6]);
}
}
int length = reader.e + 1 + (i6 - Hpack.f22132a.length);
if (length >= 0) {
Header[] headerArr2 = reader.d;
if (length < headerArr2.length) {
Header header = headerArr2[length];
Intrinsics.checkNotNull(header);
arrayList.add(header);
}
}
throw new IOException(android.support.v4.media.a.e(e, "Header index too large "));
}
if (i5 == 64) {
Header[] headerArr3 = Hpack.f22132a;
ByteString d = reader.d();
Hpack.a(d);
reader.c(new Header(d, reader.d()));
} else if ((readByte & 64) == 64) {
reader.c(new Header(reader.b(reader.e(i5, 63) - 1), reader.d()));
} else if ((readByte & 32) == 32) {
int e2 = reader.e(i5, 31);
reader.f22133a = e2;
if (e2 >= 0 && e2 <= 4096) {
int i7 = reader.g;
if (e2 < i7) {
if (e2 == 0) {
ArraysKt___ArraysJvmKt.fill$default(reader.d, (Object) null, 0, 0, 6, (Object) null);
reader.e = reader.d.length - 1;
reader.f = 0;
reader.g = 0;
} else {
reader.a(i7 - e2);
}
}
} else {
throw new IOException("Invalid dynamic table size update " + reader.f22133a);
}
} else if (i5 != 16 && i5 != 0) {
arrayList.add(new Header(reader.b(reader.e(i5, 15) - 1), reader.d()));
} else {
Header[] headerArr4 = Hpack.f22132a;
ByteString d2 = reader.d();
Hpack.a(d2);
arrayList.add(new Header(d2, reader.d()));
}
} else {
throw new IOException("index == 0");
}
}
List list = CollectionsKt.toList(arrayList);
arrayList.clear();
return list;
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public final void close() {
this.f22146c.close();
}
public final void d(Http2Connection.ReaderRunnable readerRunnable, int i) {
BufferedSource bufferedSource = this.f22146c;
bufferedSource.readInt();
bufferedSource.readByte();
byte[] bArr = _UtilCommonKt.f22076a;
}
}