soul-browser/sources/java/androidx/work/Data.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

353 lines
14 KiB
Java

package androidx.work;
import android.util.Log;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class Data {
public static final String b = Logger.e("Data");
/* renamed from: c, reason: collision with root package name */
public static final Data f1833c = new Builder().a();
/* renamed from: a, reason: collision with root package name */
public final HashMap f1834a;
/* loaded from: classes.dex */
public static final class Builder {
/* renamed from: a, reason: collision with root package name */
public final HashMap f1835a = new HashMap();
public final Data a() {
Data data = new Data(this.f1835a);
Data.c(data);
return data;
}
public final void b(HashMap hashMap) {
for (Map.Entry entry : hashMap.entrySet()) {
String str = (String) entry.getKey();
Object value = entry.getValue();
HashMap hashMap2 = this.f1835a;
if (value == null) {
hashMap2.put(str, null);
} else {
Class<?> cls = value.getClass();
if (cls != Boolean.class && cls != Byte.class && cls != Integer.class && cls != Long.class && cls != Float.class && cls != Double.class && cls != String.class && cls != Boolean[].class && cls != Byte[].class && cls != Integer[].class && cls != Long[].class && cls != Float[].class && cls != Double[].class && cls != String[].class) {
int i = 0;
if (cls == boolean[].class) {
boolean[] zArr = (boolean[]) value;
String str2 = Data.b;
Boolean[] boolArr = new Boolean[zArr.length];
while (i < zArr.length) {
boolArr[i] = Boolean.valueOf(zArr[i]);
i++;
}
hashMap2.put(str, boolArr);
} else if (cls == byte[].class) {
byte[] bArr = (byte[]) value;
String str3 = Data.b;
Byte[] bArr2 = new Byte[bArr.length];
while (i < bArr.length) {
bArr2[i] = Byte.valueOf(bArr[i]);
i++;
}
hashMap2.put(str, bArr2);
} else if (cls == int[].class) {
int[] iArr = (int[]) value;
String str4 = Data.b;
Integer[] numArr = new Integer[iArr.length];
while (i < iArr.length) {
numArr[i] = Integer.valueOf(iArr[i]);
i++;
}
hashMap2.put(str, numArr);
} else if (cls == long[].class) {
long[] jArr = (long[]) value;
String str5 = Data.b;
Long[] lArr = new Long[jArr.length];
while (i < jArr.length) {
lArr[i] = Long.valueOf(jArr[i]);
i++;
}
hashMap2.put(str, lArr);
} else if (cls == float[].class) {
float[] fArr = (float[]) value;
String str6 = Data.b;
Float[] fArr2 = new Float[fArr.length];
while (i < fArr.length) {
fArr2[i] = Float.valueOf(fArr[i]);
i++;
}
hashMap2.put(str, fArr2);
} else if (cls == double[].class) {
double[] dArr = (double[]) value;
String str7 = Data.b;
Double[] dArr2 = new Double[dArr.length];
while (i < dArr.length) {
dArr2[i] = Double.valueOf(dArr[i]);
i++;
}
hashMap2.put(str, dArr2);
} else {
throw new IllegalArgumentException("Key " + str + " has invalid type " + cls);
}
} else {
hashMap2.put(str, value);
}
}
}
}
}
public Data(Data data) {
this.f1834a = new HashMap(data.f1834a);
}
/* JADX WARN: Code restructure failed: missing block: B:27:0x0052, code lost:
if (r4 != null) goto L49;
*/
/* JADX WARN: Removed duplicated region for block: B:39:0x005d A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static androidx.work.Data a(byte[] r8) {
/*
java.lang.String r0 = "Error in Data#fromByteArray: "
java.lang.String r1 = androidx.work.Data.b
int r2 = r8.length
r3 = 10240(0x2800, float:1.4349E-41)
if (r2 > r3) goto L6e
java.util.HashMap r2 = new java.util.HashMap
r2.<init>()
java.io.ByteArrayInputStream r3 = new java.io.ByteArrayInputStream
r3.<init>(r8)
r8 = 0
java.io.ObjectInputStream r4 = new java.io.ObjectInputStream // Catch: java.lang.Throwable -> L44 java.lang.ClassNotFoundException -> L48 java.io.IOException -> L4d
r4.<init>(r3) // Catch: java.lang.Throwable -> L44 java.lang.ClassNotFoundException -> L48 java.io.IOException -> L4d
int r8 = r4.readInt() // Catch: java.lang.Throwable -> L2d java.lang.ClassNotFoundException -> L2f java.io.IOException -> L31
L1d:
if (r8 <= 0) goto L33
java.lang.String r5 = r4.readUTF() // Catch: java.lang.Throwable -> L2d java.lang.ClassNotFoundException -> L2f java.io.IOException -> L31
java.lang.Object r6 = r4.readObject() // Catch: java.lang.Throwable -> L2d java.lang.ClassNotFoundException -> L2f java.io.IOException -> L31
r2.put(r5, r6) // Catch: java.lang.Throwable -> L2d java.lang.ClassNotFoundException -> L2f java.io.IOException -> L31
int r8 = r8 + (-1)
goto L1d
L2d:
r8 = move-exception
goto L5b
L2f:
r8 = move-exception
goto L4f
L31:
r8 = move-exception
goto L4f
L33:
r4.close() // Catch: java.io.IOException -> L37
goto L3b
L37:
r8 = move-exception
android.util.Log.e(r1, r0, r8)
L3b:
r3.close() // Catch: java.io.IOException -> L3f
goto L55
L3f:
r8 = move-exception
android.util.Log.e(r1, r0, r8)
goto L55
L44:
r2 = move-exception
r4 = r8
r8 = r2
goto L5b
L48:
r4 = move-exception
L49:
r7 = r4
r4 = r8
r8 = r7
goto L4f
L4d:
r4 = move-exception
goto L49
L4f:
android.util.Log.e(r1, r0, r8) // Catch: java.lang.Throwable -> L2d
if (r4 == 0) goto L3b
goto L33
L55:
androidx.work.Data r8 = new androidx.work.Data
r8.<init>(r2)
return r8
L5b:
if (r4 == 0) goto L65
r4.close() // Catch: java.io.IOException -> L61
goto L65
L61:
r2 = move-exception
android.util.Log.e(r1, r0, r2)
L65:
r3.close() // Catch: java.io.IOException -> L69
goto L6d
L69:
r2 = move-exception
android.util.Log.e(r1, r0, r2)
L6d:
throw r8
L6e:
java.lang.IllegalStateException r8 = new java.lang.IllegalStateException
java.lang.String r0 = "Data cannot occupy more than 10240 bytes when serialized"
r8.<init>(r0)
throw r8
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.work.Data.a(byte[]):androidx.work.Data");
}
public static byte[] c(Data data) {
ObjectOutputStream objectOutputStream;
String str = b;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream2 = null;
try {
try {
objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
} catch (Throwable th) {
th = th;
}
} catch (IOException e) {
e = e;
}
try {
objectOutputStream.writeInt(data.f1834a.size());
for (Map.Entry entry : data.f1834a.entrySet()) {
objectOutputStream.writeUTF((String) entry.getKey());
objectOutputStream.writeObject(entry.getValue());
}
try {
objectOutputStream.close();
} catch (IOException e2) {
Log.e(str, "Error in Data#toByteArray: ", e2);
}
try {
byteArrayOutputStream.close();
} catch (IOException e3) {
Log.e(str, "Error in Data#toByteArray: ", e3);
}
if (byteArrayOutputStream.size() <= 10240) {
return byteArrayOutputStream.toByteArray();
}
throw new IllegalStateException("Data cannot occupy more than 10240 bytes when serialized");
} catch (IOException e4) {
e = e4;
objectOutputStream2 = objectOutputStream;
Log.e(str, "Error in Data#toByteArray: ", e);
byte[] byteArray = byteArrayOutputStream.toByteArray();
if (objectOutputStream2 != null) {
try {
objectOutputStream2.close();
} catch (IOException e5) {
Log.e(str, "Error in Data#toByteArray: ", e5);
}
}
try {
byteArrayOutputStream.close();
} catch (IOException e6) {
Log.e(str, "Error in Data#toByteArray: ", e6);
}
return byteArray;
} catch (Throwable th2) {
th = th2;
objectOutputStream2 = objectOutputStream;
if (objectOutputStream2 != null) {
try {
objectOutputStream2.close();
} catch (IOException e7) {
Log.e(str, "Error in Data#toByteArray: ", e7);
}
}
try {
byteArrayOutputStream.close();
throw th;
} catch (IOException e8) {
Log.e(str, "Error in Data#toByteArray: ", e8);
throw th;
}
}
}
public final String b(String str) {
Object obj = this.f1834a.get(str);
if (obj instanceof String) {
return (String) obj;
}
return null;
}
public final boolean equals(Object obj) {
boolean z;
if (this != obj) {
if (obj != null && Data.class == obj.getClass()) {
HashMap hashMap = ((Data) obj).f1834a;
HashMap hashMap2 = this.f1834a;
Set<String> keySet = hashMap2.keySet();
if (keySet.equals(hashMap.keySet())) {
for (String str : keySet) {
Object obj2 = hashMap2.get(str);
Object obj3 = hashMap.get(str);
if (obj2 != null && obj3 != null) {
if ((obj2 instanceof Object[]) && (obj3 instanceof Object[])) {
z = Arrays.deepEquals((Object[]) obj2, (Object[]) obj3);
} else {
z = obj2.equals(obj3);
}
} else if (obj2 == obj3) {
z = true;
} else {
z = false;
}
if (!z) {
}
}
}
}
return false;
}
return true;
}
public final int hashCode() {
return this.f1834a.hashCode() * 31;
}
public final String toString() {
StringBuilder sb = new StringBuilder("Data {");
HashMap hashMap = this.f1834a;
if (!hashMap.isEmpty()) {
for (String str : hashMap.keySet()) {
sb.append(str);
sb.append(" : ");
Object obj = hashMap.get(str);
if (obj instanceof Object[]) {
sb.append(Arrays.toString((Object[]) obj));
} else {
sb.append(obj);
}
sb.append(", ");
}
}
sb.append("}");
return sb.toString();
}
public Data(HashMap hashMap) {
this.f1834a = new HashMap(hashMap);
}
}