* 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>
199 lines
9.5 KiB
Java
199 lines
9.5 KiB
Java
package kotlin.io.encoding;
|
|
|
|
import android.support.v4.media.a;
|
|
import com.google.android.gms.ads.RequestConfiguration;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import kotlin.Metadata;
|
|
import kotlin.UByte;
|
|
import kotlin.collections.ArraysKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
@ExperimentalEncodingApi
|
|
@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0012\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\t\n\u0002\u0010\u0002\n\u0002\b\u000b\b\u0003\u0018\u00002\u00020\u0001B\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0004\b\u0005\u0010\u0006J\b\u0010\u0014\u001a\u00020\u000fH\u0016J \u0010\u0014\u001a\u00020\u000f2\u0006\u0010\u0015\u001a\u00020\u000b2\u0006\u0010\u0016\u001a\u00020\u000f2\u0006\u0010\u0017\u001a\u00020\u000fH\u0016J\b\u0010\u0018\u001a\u00020\u0019H\u0016J(\u0010\u001a\u001a\u00020\u000f2\u0006\u0010\u001b\u001a\u00020\u000b2\u0006\u0010\u001c\u001a\u00020\u000f2\u0006\u0010\u001d\u001a\u00020\u000f2\u0006\u0010\u001e\u001a\u00020\u000fH\u0002J \u0010\u001f\u001a\u00020\u00192\u0006\u0010\u001b\u001a\u00020\u000b2\u0006\u0010\u001c\u001a\u00020\u000f2\u0006\u0010\u0017\u001a\u00020\u000fH\u0002J\b\u0010 \u001a\u00020\u0019H\u0002J\b\u0010!\u001a\u00020\u0019H\u0002J\u0010\u0010\"\u001a\u00020\u000f2\u0006\u0010\u001e\u001a\u00020\u000fH\u0002J\b\u0010#\u001a\u00020\u000fH\u0002R\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0011\u001a\u00020\u000f8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0012\u0010\u0013¨\u0006$"}, d2 = {"Lkotlin/io/encoding/DecodeInputStream;", "Ljava/io/InputStream;", "input", "base64", "Lkotlin/io/encoding/Base64;", "<init>", "(Ljava/io/InputStream;Lkotlin/io/encoding/Base64;)V", "isClosed", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "isEOF", "singleByteBuffer", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "symbolBuffer", "byteBuffer", "byteBufferStartIndex", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "byteBufferEndIndex", "byteBufferLength", "getByteBufferLength", "()I", "read", "destination", "offset", "length", "close", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "decodeSymbolBufferInto", "dst", "dstOffset", "dstEndIndex", "symbolBufferLength", "copyByteBufferInto", "resetByteBufferIfEmpty", "shiftByteBufferToStartIfNeeded", "handlePaddingSymbol", "readNextSymbol", "kotlin-stdlib"}, k = 1, mv = {2, 2, 0}, xi = 48)
|
|
/* loaded from: classes4.dex */
|
|
final class DecodeInputStream extends InputStream {
|
|
|
|
@NotNull
|
|
private final Base64 base64;
|
|
|
|
@NotNull
|
|
private final byte[] byteBuffer;
|
|
private int byteBufferEndIndex;
|
|
private int byteBufferStartIndex;
|
|
|
|
@NotNull
|
|
private final InputStream input;
|
|
private boolean isClosed;
|
|
private boolean isEOF;
|
|
|
|
@NotNull
|
|
private final byte[] singleByteBuffer;
|
|
|
|
@NotNull
|
|
private final byte[] symbolBuffer;
|
|
|
|
public DecodeInputStream(@NotNull InputStream input, @NotNull Base64 base64) {
|
|
Intrinsics.checkNotNullParameter(input, "input");
|
|
Intrinsics.checkNotNullParameter(base64, "base64");
|
|
this.input = input;
|
|
this.base64 = base64;
|
|
this.singleByteBuffer = new byte[1];
|
|
this.symbolBuffer = new byte[1024];
|
|
this.byteBuffer = new byte[1024];
|
|
}
|
|
|
|
private final void copyByteBufferInto(byte[] dst, int dstOffset, int length) {
|
|
byte[] bArr = this.byteBuffer;
|
|
int i = this.byteBufferStartIndex;
|
|
ArraysKt.copyInto(bArr, dst, dstOffset, i, i + length);
|
|
this.byteBufferStartIndex += length;
|
|
resetByteBufferIfEmpty();
|
|
}
|
|
|
|
private final int decodeSymbolBufferInto(byte[] dst, int dstOffset, int dstEndIndex, int symbolBufferLength) {
|
|
int i = this.byteBufferEndIndex;
|
|
this.byteBufferEndIndex = i + this.base64.decodeIntoByteArray(this.symbolBuffer, this.byteBuffer, i, 0, symbolBufferLength);
|
|
int min = Math.min(getByteBufferLength(), dstEndIndex - dstOffset);
|
|
copyByteBufferInto(dst, dstOffset, min);
|
|
shiftByteBufferToStartIfNeeded();
|
|
return min;
|
|
}
|
|
|
|
private final int getByteBufferLength() {
|
|
return this.byteBufferEndIndex - this.byteBufferStartIndex;
|
|
}
|
|
|
|
private final int handlePaddingSymbol(int symbolBufferLength) {
|
|
this.symbolBuffer[symbolBufferLength] = Base64.padSymbol;
|
|
if ((symbolBufferLength & 3) == 2) {
|
|
int readNextSymbol = readNextSymbol();
|
|
if (readNextSymbol >= 0) {
|
|
this.symbolBuffer[symbolBufferLength + 1] = (byte) readNextSymbol;
|
|
}
|
|
return symbolBufferLength + 2;
|
|
}
|
|
return symbolBufferLength + 1;
|
|
}
|
|
|
|
private final int readNextSymbol() {
|
|
int read;
|
|
if (!this.base64.getIsMimeScheme()) {
|
|
return this.input.read();
|
|
}
|
|
do {
|
|
read = this.input.read();
|
|
if (read == -1) {
|
|
break;
|
|
}
|
|
} while (!Base64Kt.isInMimeAlphabet(read));
|
|
return read;
|
|
}
|
|
|
|
private final void resetByteBufferIfEmpty() {
|
|
if (this.byteBufferStartIndex == this.byteBufferEndIndex) {
|
|
this.byteBufferStartIndex = 0;
|
|
this.byteBufferEndIndex = 0;
|
|
}
|
|
}
|
|
|
|
private final void shiftByteBufferToStartIfNeeded() {
|
|
byte[] bArr = this.byteBuffer;
|
|
int length = bArr.length;
|
|
int i = this.byteBufferEndIndex;
|
|
if ((this.symbolBuffer.length / 4) * 3 > length - i) {
|
|
ArraysKt.copyInto(bArr, bArr, 0, this.byteBufferStartIndex, i);
|
|
this.byteBufferEndIndex -= this.byteBufferStartIndex;
|
|
this.byteBufferStartIndex = 0;
|
|
}
|
|
}
|
|
|
|
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
if (!this.isClosed) {
|
|
this.isClosed = true;
|
|
this.input.close();
|
|
}
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int read() {
|
|
int i = this.byteBufferStartIndex;
|
|
if (i < this.byteBufferEndIndex) {
|
|
int i2 = this.byteBuffer[i] & UByte.MAX_VALUE;
|
|
this.byteBufferStartIndex = i + 1;
|
|
resetByteBufferIfEmpty();
|
|
return i2;
|
|
}
|
|
int read = read(this.singleByteBuffer, 0, 1);
|
|
if (read == -1) {
|
|
return -1;
|
|
}
|
|
if (read == 1) {
|
|
return this.singleByteBuffer[0] & UByte.MAX_VALUE;
|
|
}
|
|
throw new IllegalStateException("Unreachable");
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int read(@NotNull byte[] destination, int offset, int length) {
|
|
int i;
|
|
boolean z;
|
|
boolean z2;
|
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
|
if (offset >= 0 && length >= 0 && (i = offset + length) <= destination.length) {
|
|
if (!this.isClosed) {
|
|
if (this.isEOF) {
|
|
return -1;
|
|
}
|
|
if (length == 0) {
|
|
return 0;
|
|
}
|
|
if (getByteBufferLength() >= length) {
|
|
copyByteBufferInto(destination, offset, length);
|
|
return length;
|
|
}
|
|
int byteBufferLength = (((length - getByteBufferLength()) + 2) / 3) * 4;
|
|
int i2 = offset;
|
|
while (true) {
|
|
z = this.isEOF;
|
|
if (z || byteBufferLength <= 0) {
|
|
break;
|
|
}
|
|
int min = Math.min(this.symbolBuffer.length, byteBufferLength);
|
|
int i3 = 0;
|
|
while (true) {
|
|
z2 = this.isEOF;
|
|
if (z2 || i3 >= min) {
|
|
break;
|
|
}
|
|
int readNextSymbol = readNextSymbol();
|
|
if (readNextSymbol == -1) {
|
|
this.isEOF = true;
|
|
} else if (readNextSymbol != 61) {
|
|
this.symbolBuffer[i3] = (byte) readNextSymbol;
|
|
i3++;
|
|
} else {
|
|
i3 = handlePaddingSymbol(i3);
|
|
this.isEOF = true;
|
|
}
|
|
}
|
|
if (!z2 && i3 != min) {
|
|
throw new IllegalStateException("Check failed.");
|
|
}
|
|
byteBufferLength -= i3;
|
|
i2 += decodeSymbolBufferInto(destination, i2, i, i3);
|
|
}
|
|
if (i2 == offset && z) {
|
|
return -1;
|
|
}
|
|
return i2 - offset;
|
|
}
|
|
throw new IOException("The input stream is closed.");
|
|
}
|
|
StringBuilder u = a.u("offset: ", offset, length, ", length: ", ", buffer size: ");
|
|
u.append(destination.length);
|
|
throw new IndexOutOfBoundsException(u.toString());
|
|
}
|
|
}
|