soul-browser/sources/java/com/bumptech/glide/load/resource/bitmap/BitmapEncoder.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

147 lines
6.1 KiB
Java

package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.load.EncodeStrategy;
import com.bumptech.glide.load.Option;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
/* loaded from: classes.dex */
public class BitmapEncoder implements ResourceEncoder<Bitmap> {
public static final Option b = Option.a(90, "com.bumptech.glide.load.resource.bitmap.BitmapEncoder.CompressionQuality");
/* renamed from: c, reason: collision with root package name */
public static final Option f2346c = new Option("com.bumptech.glide.load.resource.bitmap.BitmapEncoder.CompressionFormat", null, Option.e);
/* renamed from: a, reason: collision with root package name */
public final ArrayPool f2347a;
public BitmapEncoder(ArrayPool arrayPool) {
this.f2347a = arrayPool;
}
/* JADX WARN: Removed duplicated region for block: B:20:0x007a */
@Override // com.bumptech.glide.load.Encoder
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final boolean a(java.lang.Object r9, java.io.File r10, com.bumptech.glide.load.Options r11) {
/*
r8 = this;
com.bumptech.glide.load.engine.Resource r9 = (com.bumptech.glide.load.engine.Resource) r9
java.lang.String r0 = "BitmapEncoder"
java.lang.Object r9 = r9.get()
android.graphics.Bitmap r9 = (android.graphics.Bitmap) r9
com.bumptech.glide.load.Option r1 = com.bumptech.glide.load.resource.bitmap.BitmapEncoder.f2346c
java.lang.Object r2 = r11.c(r1)
android.graphics.Bitmap$CompressFormat r2 = (android.graphics.Bitmap.CompressFormat) r2
if (r2 == 0) goto L15
goto L20
L15:
boolean r2 = r9.hasAlpha()
if (r2 == 0) goto L1e
android.graphics.Bitmap$CompressFormat r2 = android.graphics.Bitmap.CompressFormat.PNG
goto L20
L1e:
android.graphics.Bitmap$CompressFormat r2 = android.graphics.Bitmap.CompressFormat.JPEG
L20:
r9.getWidth()
r9.getHeight()
int r3 = com.bumptech.glide.util.LogTime.b
long r3 = android.os.SystemClock.elapsedRealtimeNanos()
com.bumptech.glide.load.Option r5 = com.bumptech.glide.load.resource.bitmap.BitmapEncoder.b
java.lang.Object r5 = r11.c(r5)
java.lang.Integer r5 = (java.lang.Integer) r5
int r5 = r5.intValue()
r6 = 0
java.io.FileOutputStream r7 = new java.io.FileOutputStream // Catch: java.lang.Throwable -> L5e java.io.IOException -> L60
r7.<init>(r10) // Catch: java.lang.Throwable -> L5e java.io.IOException -> L60
com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool r10 = r8.f2347a
if (r10 == 0) goto L4f
com.bumptech.glide.load.data.BufferedOutputStream r6 = new com.bumptech.glide.load.data.BufferedOutputStream // Catch: java.lang.Throwable -> L48 java.io.IOException -> L4c
r6.<init>(r7, r10) // Catch: java.lang.Throwable -> L48 java.io.IOException -> L4c
goto L50
L48:
r9 = move-exception
r6 = r7
goto Lbc
L4c:
r10 = move-exception
r6 = r7
goto L61
L4f:
r6 = r7
L50:
r9.compress(r2, r5, r6) // Catch: java.lang.Throwable -> L5e java.io.IOException -> L60
r6.close() // Catch: java.lang.Throwable -> L5e java.io.IOException -> L60
r6.close() // Catch: java.lang.Throwable -> L5a java.io.IOException -> L5c
goto L5c
L5a:
r9 = move-exception
goto Lc2
L5c:
r10 = 1
goto L73
L5e:
r9 = move-exception
goto Lbc
L60:
r10 = move-exception
L61:
r5 = 3
boolean r5 = android.util.Log.isLoggable(r0, r5) // Catch: java.lang.Throwable -> L5e
if (r5 == 0) goto L6d
java.lang.String r5 = "Failed to encode Bitmap"
android.util.Log.d(r0, r5, r10) // Catch: java.lang.Throwable -> L5e
L6d:
if (r6 == 0) goto L72
r6.close() // Catch: java.lang.Throwable -> L5a java.io.IOException -> L72
L72:
r10 = 0
L73:
r5 = 2
boolean r5 = android.util.Log.isLoggable(r0, r5)
if (r5 == 0) goto Lbb
java.lang.StringBuilder r5 = new java.lang.StringBuilder
java.lang.String r6 = "Compressed with type: "
r5.<init>(r6)
r5.append(r2)
java.lang.String r2 = " of size "
r5.append(r2)
int r2 = com.bumptech.glide.util.Util.c(r9)
r5.append(r2)
java.lang.String r2 = " in "
r5.append(r2)
double r2 = com.bumptech.glide.util.LogTime.a(r3)
r5.append(r2)
java.lang.String r2 = ", options format: "
r5.append(r2)
java.lang.Object r11 = r11.c(r1)
r5.append(r11)
java.lang.String r11 = ", hasAlpha: "
r5.append(r11)
boolean r9 = r9.hasAlpha()
r5.append(r9)
java.lang.String r9 = r5.toString()
android.util.Log.v(r0, r9)
Lbb:
return r10
Lbc:
if (r6 == 0) goto Lc3
r6.close() // Catch: java.lang.Throwable -> L5a java.io.IOException -> Lc3
goto Lc3
Lc2:
throw r9
Lc3:
throw r9
*/
throw new UnsupportedOperationException("Method not decompiled: com.bumptech.glide.load.resource.bitmap.BitmapEncoder.a(java.lang.Object, java.io.File, com.bumptech.glide.load.Options):boolean");
}
@Override // com.bumptech.glide.load.ResourceEncoder
public final EncodeStrategy b(Options options) {
return EncodeStrategy.f;
}
}