soul-browser/sources/java/com/bumptech/glide/load/model/LazyHeaders.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

178 lines
5.6 KiB
Java

package com.bumptech.glide.load.model;
import android.support.v4.media.a;
import android.text.TextUtils;
import j$.util.DesugarCollections;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public final class LazyHeaders implements Headers {
public final Map b;
/* renamed from: c, reason: collision with root package name */
public volatile Map f2293c;
/* loaded from: classes.dex */
public static final class Builder {
public static final Map d;
/* renamed from: a, reason: collision with root package name */
public boolean f2294a = true;
public Map b = d;
/* renamed from: c, reason: collision with root package name */
public boolean f2295c = true;
static {
String property = System.getProperty("http.agent");
if (!TextUtils.isEmpty(property)) {
int length = property.length();
StringBuilder sb = new StringBuilder(property.length());
for (int i = 0; i < length; i++) {
char charAt = property.charAt(i);
if ((charAt > 31 || charAt == '\t') && charAt < 127) {
sb.append(charAt);
} else {
sb.append('?');
}
}
property = sb.toString();
}
HashMap hashMap = new HashMap(2);
if (!TextUtils.isEmpty(property)) {
hashMap.put("User-Agent", Collections.singletonList(new StringHeaderFactory(property)));
}
d = DesugarCollections.unmodifiableMap(hashMap);
}
public final void a(String str, String str2) {
StringHeaderFactory stringHeaderFactory = new StringHeaderFactory(str2);
if (this.f2295c && "User-Agent".equalsIgnoreCase(str)) {
b();
List list = (List) this.b.get(str);
if (list == null) {
list = new ArrayList();
this.b.put(str, list);
}
list.clear();
list.add(stringHeaderFactory);
if (this.f2295c && "User-Agent".equalsIgnoreCase(str)) {
this.f2295c = false;
return;
}
return;
}
b();
List list2 = (List) this.b.get(str);
if (list2 == null) {
list2 = new ArrayList();
this.b.put(str, list2);
}
list2.add(stringHeaderFactory);
}
public final void b() {
if (this.f2294a) {
this.f2294a = false;
HashMap hashMap = new HashMap(this.b.size());
for (Map.Entry entry : this.b.entrySet()) {
hashMap.put((String) entry.getKey(), new ArrayList((Collection) entry.getValue()));
}
this.b = hashMap;
}
}
}
/* loaded from: classes.dex */
public static final class StringHeaderFactory implements LazyHeaderFactory {
/* renamed from: a, reason: collision with root package name */
public final String f2296a;
public StringHeaderFactory(String str) {
this.f2296a = str;
}
@Override // com.bumptech.glide.load.model.LazyHeaderFactory
public final String a() {
return this.f2296a;
}
public final boolean equals(Object obj) {
if (obj instanceof StringHeaderFactory) {
return this.f2296a.equals(((StringHeaderFactory) obj).f2296a);
}
return false;
}
public final int hashCode() {
return this.f2296a.hashCode();
}
public final String toString() {
return a.p(new StringBuilder("StringHeaderFactory{value='"), this.f2296a, "'}");
}
}
public LazyHeaders(Map map) {
this.b = DesugarCollections.unmodifiableMap(map);
}
@Override // com.bumptech.glide.load.model.Headers
public final Map a() {
if (this.f2293c == null) {
synchronized (this) {
try {
if (this.f2293c == null) {
this.f2293c = DesugarCollections.unmodifiableMap(b());
}
} finally {
}
}
}
return this.f2293c;
}
public final HashMap b() {
HashMap hashMap = new HashMap();
for (Map.Entry entry : this.b.entrySet()) {
List list = (List) entry.getValue();
StringBuilder sb = new StringBuilder();
int size = list.size();
for (int i = 0; i < size; i++) {
String a2 = ((LazyHeaderFactory) list.get(i)).a();
if (!TextUtils.isEmpty(a2)) {
sb.append(a2);
if (i != list.size() - 1) {
sb.append(',');
}
}
}
String sb2 = sb.toString();
if (!TextUtils.isEmpty(sb2)) {
hashMap.put((String) entry.getKey(), sb2);
}
}
return hashMap;
}
public final boolean equals(Object obj) {
if (obj instanceof LazyHeaders) {
return this.b.equals(((LazyHeaders) obj).b);
}
return false;
}
public final int hashCode() {
return this.b.hashCode();
}
public final String toString() {
return "LazyHeaders{headers=" + this.b + '}';
}
}