* 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>
212 lines
7.5 KiB
Java
212 lines
7.5 KiB
Java
package com.google.android.gms.internal.ads;
|
|
|
|
import android.content.ContentResolver;
|
|
import android.content.Context;
|
|
import android.content.res.AssetFileDescriptor;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import j$.util.Objects;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.nio.channels.FileChannel;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class zzgy extends zzgt {
|
|
public final ContentResolver e;
|
|
public Uri f;
|
|
public AssetFileDescriptor g;
|
|
public FileInputStream h;
|
|
public long i;
|
|
public boolean j;
|
|
|
|
public zzgy(Context context) {
|
|
super(false);
|
|
this.e = context.getContentResolver();
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.ads.zzhb
|
|
public final long a(zzhf zzhfVar) {
|
|
int i;
|
|
int i2;
|
|
AssetFileDescriptor openAssetFileDescriptor;
|
|
long j;
|
|
long min;
|
|
try {
|
|
try {
|
|
Uri uri = zzhfVar.f8483a;
|
|
long j2 = zzhfVar.f8484c;
|
|
Uri normalizeScheme = uri.normalizeScheme();
|
|
this.f = normalizeScheme;
|
|
d(zzhfVar);
|
|
boolean equals = Objects.equals(normalizeScheme.getScheme(), "content");
|
|
ContentResolver contentResolver = this.e;
|
|
if (equals) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putBoolean("android.provider.extra.ACCEPT_ORIGINAL_MEDIA_FORMAT", true);
|
|
openAssetFileDescriptor = contentResolver.openTypedAssetFileDescriptor(normalizeScheme, "*/*", bundle);
|
|
} else {
|
|
openAssetFileDescriptor = contentResolver.openAssetFileDescriptor(normalizeScheme, "r");
|
|
}
|
|
this.g = openAssetFileDescriptor;
|
|
if (openAssetFileDescriptor != null) {
|
|
long length = openAssetFileDescriptor.getLength();
|
|
FileInputStream fileInputStream = new FileInputStream(openAssetFileDescriptor.getFileDescriptor());
|
|
this.h = fileInputStream;
|
|
if (length != -1 && j2 > length) {
|
|
throw new zzhc(2008, (Exception) null);
|
|
}
|
|
long startOffset = openAssetFileDescriptor.getStartOffset();
|
|
long skip = fileInputStream.skip(startOffset + j2) - startOffset;
|
|
if (skip == j2) {
|
|
if (length == -1) {
|
|
FileChannel channel = fileInputStream.getChannel();
|
|
long size = channel.size();
|
|
if (size == 0) {
|
|
this.i = -1L;
|
|
j = -1;
|
|
} else {
|
|
j = size - channel.position();
|
|
this.i = j;
|
|
if (j < 0) {
|
|
throw new zzhc(2008, (Exception) null);
|
|
}
|
|
}
|
|
} else {
|
|
j = length - skip;
|
|
this.i = j;
|
|
if (j < 0) {
|
|
throw new zzhc(2008, (Exception) null);
|
|
}
|
|
}
|
|
long j3 = zzhfVar.d;
|
|
if (j3 != -1) {
|
|
if (j == -1) {
|
|
min = j3;
|
|
} else {
|
|
min = Math.min(j, j3);
|
|
}
|
|
this.i = min;
|
|
}
|
|
this.j = true;
|
|
e(zzhfVar);
|
|
if (j3 != -1) {
|
|
return j3;
|
|
}
|
|
return this.i;
|
|
}
|
|
throw new zzhc(2008, (Exception) null);
|
|
}
|
|
String valueOf = String.valueOf(normalizeScheme);
|
|
StringBuilder sb = new StringBuilder(valueOf.length() + 36);
|
|
sb.append("Could not open file descriptor for: ");
|
|
sb.append(valueOf);
|
|
i = 2000;
|
|
try {
|
|
throw new zzhc(2000, new IOException(sb.toString()));
|
|
} catch (IOException e) {
|
|
e = e;
|
|
if (true != (e instanceof FileNotFoundException)) {
|
|
i2 = i;
|
|
} else {
|
|
i2 = 2005;
|
|
}
|
|
throw new zzhc(i2, e);
|
|
}
|
|
} catch (IOException e2) {
|
|
e = e2;
|
|
i = 2000;
|
|
}
|
|
} catch (zzgx e3) {
|
|
throw e3;
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.ads.zzj
|
|
public final int b(byte[] bArr, int i, int i2) {
|
|
if (i2 == 0) {
|
|
return 0;
|
|
}
|
|
long j = this.i;
|
|
if (j != 0) {
|
|
if (j != -1) {
|
|
try {
|
|
i2 = (int) Math.min(j, i2);
|
|
} catch (IOException e) {
|
|
throw new zzhc(2000, e);
|
|
}
|
|
}
|
|
FileInputStream fileInputStream = this.h;
|
|
String str = zzfj.f7405a;
|
|
int read = fileInputStream.read(bArr, i, i2);
|
|
if (read != -1) {
|
|
long j2 = this.i;
|
|
if (j2 != -1) {
|
|
this.i = j2 - read;
|
|
}
|
|
f(read);
|
|
return read;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.ads.zzhb
|
|
public final Uri zzc() {
|
|
return this.f;
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.ads.zzhb
|
|
public final void zzd() {
|
|
this.f = null;
|
|
try {
|
|
try {
|
|
try {
|
|
FileInputStream fileInputStream = this.h;
|
|
if (fileInputStream != null) {
|
|
fileInputStream.close();
|
|
}
|
|
this.h = null;
|
|
try {
|
|
AssetFileDescriptor assetFileDescriptor = this.g;
|
|
if (assetFileDescriptor != null) {
|
|
assetFileDescriptor.close();
|
|
}
|
|
this.g = null;
|
|
if (this.j) {
|
|
this.j = false;
|
|
g();
|
|
}
|
|
} catch (IOException e) {
|
|
throw new zzhc(2000, e);
|
|
}
|
|
} catch (IOException e2) {
|
|
throw new zzhc(2000, e2);
|
|
}
|
|
} catch (Throwable th) {
|
|
this.h = null;
|
|
try {
|
|
AssetFileDescriptor assetFileDescriptor2 = this.g;
|
|
if (assetFileDescriptor2 != null) {
|
|
assetFileDescriptor2.close();
|
|
}
|
|
this.g = null;
|
|
if (this.j) {
|
|
this.j = false;
|
|
g();
|
|
}
|
|
throw th;
|
|
} catch (IOException e3) {
|
|
throw new zzhc(2000, e3);
|
|
}
|
|
}
|
|
} catch (Throwable th2) {
|
|
this.g = null;
|
|
if (this.j) {
|
|
this.j = false;
|
|
g();
|
|
}
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|