* 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>
226 lines
6.2 KiB
Java
226 lines
6.2 KiB
Java
package org.jsoup.internal;
|
|
|
|
import java.io.BufferedInputStream;
|
|
import java.io.FilterInputStream;
|
|
import java.io.InputStream;
|
|
import java.net.SocketTimeoutException;
|
|
import java.nio.ByteBuffer;
|
|
import org.jsoup.Progress;
|
|
import org.jsoup.helper.Validate;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class ControllableInputStream extends FilterInputStream {
|
|
|
|
/* renamed from: c, reason: collision with root package name */
|
|
public final SimpleBufferedInput f22546c;
|
|
public int f;
|
|
public long g;
|
|
public long h;
|
|
public int i;
|
|
public int j;
|
|
public boolean k;
|
|
public boolean l;
|
|
public Progress m;
|
|
public Object n;
|
|
public int o;
|
|
public int p;
|
|
|
|
public ControllableInputStream(SimpleBufferedInput simpleBufferedInput, int i) {
|
|
super(simpleBufferedInput);
|
|
this.h = 0L;
|
|
this.l = true;
|
|
this.o = -1;
|
|
this.p = 0;
|
|
Validate.isTrue(i >= 0);
|
|
this.f22546c = simpleBufferedInput;
|
|
this.f = i;
|
|
this.i = i;
|
|
this.j = -1;
|
|
this.g = System.nanoTime();
|
|
}
|
|
|
|
public static ByteBuffer readToByteBuffer(InputStream inputStream, int i) {
|
|
boolean z;
|
|
int i2;
|
|
int min;
|
|
boolean z2 = true;
|
|
if (i >= 0) {
|
|
z = true;
|
|
} else {
|
|
z = false;
|
|
}
|
|
Validate.isTrue(z, "maxSize must be 0 (unlimited) or larger");
|
|
Validate.notNull(inputStream);
|
|
if (i <= 0) {
|
|
z2 = false;
|
|
}
|
|
byte[] bArr = (byte[]) SimpleBufferedInput.j.borrow();
|
|
if (z2) {
|
|
i2 = Math.min(i, 8192);
|
|
} else {
|
|
i2 = 8192;
|
|
}
|
|
ByteBuffer allocate = ByteBuffer.allocate(i2);
|
|
while (true) {
|
|
if (z2) {
|
|
try {
|
|
min = Math.min(i, 8192);
|
|
} catch (Throwable th) {
|
|
SimpleBufferedInput.j.release(bArr);
|
|
throw th;
|
|
}
|
|
} else {
|
|
min = 8192;
|
|
}
|
|
int read = inputStream.read(bArr, 0, min);
|
|
if (read != -1) {
|
|
if (allocate.remaining() < read) {
|
|
ByteBuffer allocate2 = ByteBuffer.allocate((int) Math.max(allocate.capacity() * 1.5d, allocate.capacity() + read));
|
|
allocate.flip();
|
|
allocate2.put(allocate);
|
|
allocate = allocate2;
|
|
}
|
|
allocate.put(bArr, 0, read);
|
|
if (z2 && (i = i - read) <= 0) {
|
|
break;
|
|
}
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
allocate.flip();
|
|
SimpleBufferedInput.j.release(bArr);
|
|
return allocate;
|
|
}
|
|
|
|
public static ControllableInputStream wrap(InputStream inputStream, int i) {
|
|
if (inputStream instanceof ControllableInputStream) {
|
|
return (ControllableInputStream) inputStream;
|
|
}
|
|
return new ControllableInputStream(new SimpleBufferedInput(inputStream), i);
|
|
}
|
|
|
|
public final void a() {
|
|
float f;
|
|
if (this.m != null) {
|
|
int i = this.o;
|
|
if (i > 0) {
|
|
f = Math.min(100.0f, (this.p * 100.0f) / i);
|
|
} else {
|
|
f = 0.0f;
|
|
}
|
|
this.m.onProgress(this.p, this.o, f, this.n);
|
|
if (f == 100.0f) {
|
|
this.m = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void allowClose(boolean z) {
|
|
this.l = z;
|
|
}
|
|
|
|
public boolean baseReadFully() {
|
|
return this.f22546c.i;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
if (this.l) {
|
|
super.close();
|
|
}
|
|
}
|
|
|
|
public BufferedInputStream inputStream() {
|
|
return new BufferedInputStream(this.f22546c);
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public void mark(int i) {
|
|
super.mark(i);
|
|
this.j = this.f - this.i;
|
|
}
|
|
|
|
public int max() {
|
|
return this.f;
|
|
}
|
|
|
|
public <ProgressContext> ControllableInputStream onProgress(int i, Progress<ProgressContext> progress, ProgressContext progresscontext) {
|
|
Validate.notNull(progress);
|
|
Validate.notNull(progresscontext);
|
|
this.o = i;
|
|
this.m = progress;
|
|
this.n = progresscontext;
|
|
return this;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public int read(byte[] bArr, int i, int i2) {
|
|
boolean z;
|
|
int i3;
|
|
if (this.p == 0) {
|
|
a();
|
|
}
|
|
if (this.f != 0) {
|
|
z = true;
|
|
} else {
|
|
z = false;
|
|
}
|
|
if (this.k || (z && this.i <= 0)) {
|
|
return -1;
|
|
}
|
|
if (Thread.currentThread().isInterrupted()) {
|
|
this.k = true;
|
|
return -1;
|
|
}
|
|
if (z && i2 > (i3 = this.i)) {
|
|
i2 = i3;
|
|
}
|
|
do {
|
|
if (this.h == 0 || System.nanoTime() - this.g <= this.h) {
|
|
try {
|
|
int read = super.read(bArr, i, i2);
|
|
if (read == -1) {
|
|
this.o = this.p;
|
|
} else {
|
|
this.i -= read;
|
|
this.p += read;
|
|
}
|
|
a();
|
|
return read;
|
|
} catch (SocketTimeoutException e) {
|
|
if (this.h != 0 && System.nanoTime() - this.g > this.h) {
|
|
break;
|
|
}
|
|
throw e;
|
|
}
|
|
}
|
|
throw new SocketTimeoutException("Read timeout");
|
|
} while (this.h != 0);
|
|
throw e;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public void reset() {
|
|
super.reset();
|
|
int i = this.f;
|
|
int i2 = this.j;
|
|
this.i = i - i2;
|
|
this.p = i2;
|
|
}
|
|
|
|
public ControllableInputStream timeout(long j, long j2) {
|
|
this.g = j;
|
|
this.h = j2 * 1000000;
|
|
return this;
|
|
}
|
|
|
|
public void max(int i) {
|
|
this.i = (i - this.f) + this.i;
|
|
this.f = i;
|
|
}
|
|
|
|
public static ControllableInputStream wrap(InputStream inputStream, int i, int i2) {
|
|
return wrap(inputStream, i2);
|
|
}
|
|
}
|