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

143 lines
5.8 KiB
Java

package androidx.work.impl.utils;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteAccessPermException;
import android.database.sqlite.SQLiteCantOpenDatabaseException;
import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteDatabaseCorruptException;
import android.database.sqlite.SQLiteDatabaseLockedException;
import android.database.sqlite.SQLiteTableLockedException;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.RestrictTo;
import androidx.core.os.BuildCompat;
import androidx.work.Configuration;
import androidx.work.Logger;
import androidx.work.impl.WorkDatabasePathHelper;
import androidx.work.impl.WorkManagerImpl;
import java.util.concurrent.TimeUnit;
@RestrictTo
/* loaded from: classes.dex */
public class ForceStopRunnable implements Runnable {
public static final String h = Logger.e("ForceStopRunnable");
public static final long i = TimeUnit.DAYS.toMillis(3650);
/* renamed from: c, reason: collision with root package name */
public final Context f1947c;
public final WorkManagerImpl f;
public int g = 0;
@RestrictTo
/* loaded from: classes.dex */
public static class BroadcastReceiver extends android.content.BroadcastReceiver {
/* renamed from: a, reason: collision with root package name */
public static final String f1948a = Logger.e("ForceStopRunnable$Rcvr");
@Override // android.content.BroadcastReceiver
public final void onReceive(Context context, Intent intent) {
if (intent != null && "ACTION_FORCE_STOP_RESCHEDULE".equals(intent.getAction())) {
if (((Logger.LogcatLogger) Logger.c()).b <= 2) {
Log.v(f1948a, "Rescheduling alarm that keeps track of force-stops.");
}
ForceStopRunnable.c(context);
}
}
}
public ForceStopRunnable(Context context, WorkManagerImpl workManagerImpl) {
this.f1947c = context.getApplicationContext();
this.f = workManagerImpl;
}
public static void c(Context context) {
int i2;
AlarmManager alarmManager = (AlarmManager) context.getSystemService("alarm");
if (BuildCompat.b()) {
i2 = 167772160;
} else {
i2 = 134217728;
}
Intent intent = new Intent();
intent.setComponent(new ComponentName(context, (Class<?>) BroadcastReceiver.class));
intent.setAction("ACTION_FORCE_STOP_RESCHEDULE");
PendingIntent broadcast = PendingIntent.getBroadcast(context, -1, intent, i2);
long currentTimeMillis = System.currentTimeMillis() + i;
if (alarmManager != null) {
alarmManager.setExact(0, currentTimeMillis, broadcast);
}
}
/* JADX WARN: Finally extract failed */
/* JADX WARN: Removed duplicated region for block: B:15:0x0061 A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:19:0x005d A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:94:0x01b6 */
/* JADX WARN: Removed duplicated region for block: B:96:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void a() {
/*
Method dump skipped, instructions count: 494
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.work.impl.utils.ForceStopRunnable.a():void");
}
public final boolean b() {
Configuration configuration = this.f.b;
configuration.getClass();
boolean isEmpty = TextUtils.isEmpty(null);
String str = h;
if (isEmpty) {
Logger.c().a(str, "The default process name was not specified.", new Throwable[0]);
return true;
}
boolean a2 = ProcessUtils.a(this.f1947c, configuration);
Logger.c().a(str, "Is default app process = " + a2, new Throwable[0]);
return a2;
}
@Override // java.lang.Runnable
public final void run() {
String str = h;
WorkManagerImpl workManagerImpl = this.f;
try {
if (!b()) {
return;
}
while (true) {
WorkDatabasePathHelper.a(this.f1947c);
Logger.c().a(str, "Performing cleanup operations.", new Throwable[0]);
try {
a();
return;
} catch (SQLiteAccessPermException | SQLiteCantOpenDatabaseException | SQLiteConstraintException | SQLiteDatabaseCorruptException | SQLiteDatabaseLockedException | SQLiteTableLockedException e) {
int i2 = this.g + 1;
this.g = i2;
if (i2 < 3) {
long j = i2 * 300;
Logger.c().a(str, "Retrying after " + j, e);
try {
Thread.sleep(this.g * 300);
} catch (InterruptedException unused) {
}
} else {
Logger.c().b(str, "The file system on the device is in a bad state. WorkManager cannot access the app's internal data store.", e);
IllegalStateException illegalStateException = new IllegalStateException("The file system on the device is in a bad state. WorkManager cannot access the app's internal data store.", e);
workManagerImpl.b.getClass();
throw illegalStateException;
}
}
}
} finally {
workManagerImpl.e();
}
}
}