OneSignal-Android-SDK
OneSignal-Android-SDK copied to clipboard
chore: [SDK-4213] remove background-threading FF, make async init default
Summary
The sdk_background_threading remote feature flag is fully rolled out (100%), so this removes the flag entirely and makes the background/async init path the unconditional default. This eliminates the FF/cached-config read from the init decision path (the StrictMode bootstrap disk-read goal) and removes the legacy synchronous-blocking code path.
Resolves SDK-4213.
Production changes
FeatureFlag.kt— removed theSDK_BACKGROUND_THREADINGenum entry. The genericFeatureActivationModeframework andSDK_IDENTITY_VERIFICATIONremain.ThreadingMode.kt— deleted (it only existed to holduseBackgroundThreading).ThreadUtils.kt— collapsed everyif (ThreadingMode.useBackgroundThreading) … else …branch to theOneSignalDispatcherspath, dropping the legacythread { runBlocking { … } }/GlobalScope.launchfallbacks. RenamedrunOnSerialIOIfBackgroundThreading→runOnSerialIOand updated all call sites.OneSignalImp.kt— removedisBackgroundThreadingEnabled, thefeatureManagerfield, the injectableioDispatcherconstructor param, and the now-deadrequireInitForOperation/warnIfBlockingOnMainThread.initWithContextalways dispatchesinternalInitviasuspendifyOnIO(never blocks the caller);login/logout/updateUserJwt/JWT-listener methods always usewaitForInit; suspend accessors useOneSignalDispatchers.IOdirectly.StartupService.kt— removed theIFeatureManagerlookup;scheduleStart()always launches onOneSignalDispatchers.launchOnDefault.OneSignalCrashUploaderWrapper.kt— removed the FF check instart(); always launches on IO (featureManagerstill injected for OTel telemetry).FeatureManager.kt— removed theSDK_BACKGROUND_THREADINGside-effect.
Test changes
- Removed FF on/off matrix tests and
ThreadingModetoggling across the affected suites. - Renamed
ThreadUtilsFeatureFlagTests→ThreadUtilsDispatchTests(tests the now-unconditional dispatch contracts). - Re-pointed the saturated-IO
waitForInitSUCCESS fast-path regression tests (Flutter #1163) to the default async path; removed the obsoletewarnIfBlockingOnMainThreadtest.
Net: +274 / −1004 across 26 files.
Test plan
- [x]
compileDebugUnitTestKotlingreen across all modules - [x] Affected unit tests pass (
SDKInitTests,OneSignalImpTests,FeatureManagerTests,FeatureFlagTests,ThreadUtilsDispatchTests,BackgroundManagerTests,StartupServiceTests,OneSignalCrashUploaderWrapperTest,SessionServiceTests,FeatureFlagsRefreshServiceTests,NotificationsManagerTests,NotificationPermissionControllerTests) - [x]
detektpasses for:coreand:notifications - [ ] Full CI suite
Notes / follow-ups
- The generic
FeatureActivationMode.APP_STARTUPmode + latching logic inFeatureManageris retained but is now unused by any flag; could be removed in a follow-up if no APP_STARTUP flags are planned. - A few telemetry/config/parser tests still use the literal string
"sdk_background_threading"as an arbitrary remote-flag fixture (no longer maps to any enum) — left as-is since they exercise generic plumbing.
Made with Cursor