mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
WorkManager's persisted work database and JobScheduler jobs survive an upgrade from the free flavor (shared applicationId). On startup, WorkManagerInitializer reschedules that stale network-constrained work, and WorkManager 2.11.2 tracks it via ConnectivityManager.registerDefaultNetworkCallback, which throws SecurityException because the offline flavor removes ACCESS_NETWORK_STATE. The flavor guards in Amber only prevent new enqueues and cannot stop this. WorkManager is unused in the offline flavor (all enqueues are flavor-guarded and ConnectivityService never starts), so strip all of its manifest components there: WorkManagerInitializer plus SystemJobService, SystemForegroundService, ForceStopRunnable receiver, RescheduleReceiver and DiagnosticsReceiver, which would otherwise crash via stale jobs or BOOT_COMPLETED after initialization is disabled. Also guard cancelBackupApplicationsAlarm (reachable from ApplicationsBackupScreen) with isOfflineFlavor like its siblings, and extend check-offline-permissions.yml to fail if WorkManagerInitializer or SystemJobService reappear in the offline merged manifest.