Skip to content

Commit d93b64b

Browse files
Feat noop and conflict (#8)
* Publish new (#1) * feat: change group id * feat: update maven plugin * feat: flashcat site * chore: configure SDK v0.3.0 release settings - Exclude logs, flags, session-replay modules from publishing - Update version to 0.3.0 with dynamic versioning from git tags - Add JVM --add-opens for java.lang.invoke to fix JDK 17+ reflection - Comment out excluded module dependencies in samples and integration tests - Exclude sample projects from build (depend on removed features) * feat: add ding notify * chore: update GitHub Actions trigger branch to publish Update workflows to trigger on the publish branch instead of publish-new: - publish-maven.yml: Change publish trigger branch - codeql-analysis.yml: Change push and pull request target branches * Add "No-Op" modules for Session Replay, Logs, and Profiling features to provide empty implementations with minimal footprint. * refactor: optimize dependency isolation and compatibility - Downgrade androidx.core to 1.12.0 and move key dependencies (Gson, OkHttp, WorkManager) to compileOnly scope to reduce SDK footprint and avoid version conflicts. - Implement WorkManagerUtils with reflection-based safe initialization check to handle optional WorkManager dependency. - Update API surface and transitive dependency lists across multiple modules. - Fix Detekt configuration to handle missing classpath files gracefully. - Bump SDK version to 0.3.1-SNAPSHOT. * Enable Logging, Session Replay, and Feature Flags in sample applications - Add `setApplicationLaunchSampleRate` and `useCustomEndpoint` to `ProfilingConfiguration.Builder` in the no-op profiling module. - Uncomment and enable Log, Session Replay, Feature Flag, and Timber integration dependencies across multiple sample modules (automotive, benchmark, kotlin, tv, vendor-lib, wear). - Restore initialization code for Logs, Session Replay, and Timber in sample application classes. - Downgrade several transitive dependencies (e.g., Gson, OkHttp, Okio, and various AndroidX libraries) to older versions across multiple modules. - Include `:features:dd-sdk-android-flags` and related modules in the global settings. - Implement a dependency substitution rule in the Kotlin sample to use no-op logs when appropriate. * Add no-op implementations for Feature Flags and OpenFeature modules * feat: add `dd-sdk-android-flags-noop` module - Provides a no-op implementation of the Flags SDK to allow safe compilation without the full feature. - Includes core interfaces: `FlagsClient`, `FlagsConfiguration`, `EvaluationContext`, and `ResolutionDetails`. - Defines `NoOpFlagsClient` which returns default values for all flag evaluations. * feat: add `dd-sdk-android-flags-openfeature-noop` module - Provides a no-op implementation of the OpenFeature provider. - Includes `DatadogFlagsProvider` which implements `FeatureProvider` by returning default values. - Adds `asOpenFeatureProvider()` extension on `FlagsClient`. * chore: update sample application - Configure Kotlin sample to use `noop` variants for the `noop` build flavor. - Uncomment and initialize Feature Flags in `SampleApplication.kt` using the new APIs. * build: include new modules in project settings and build configurations. * Noop logs profiling session replay (#2) * Add "No-Op" modules for Session Replay, Logs, and Profiling features to provide empty implementations with minimal footprint. * refactor: optimize dependency isolation and compatibility - Downgrade androidx.core to 1.12.0 and move key dependencies (Gson, OkHttp, WorkManager) to compileOnly scope to reduce SDK footprint and avoid version conflicts. - Implement WorkManagerUtils with reflection-based safe initialization check to handle optional WorkManager dependency. - Update API surface and transitive dependency lists across multiple modules. - Fix Detekt configuration to handle missing classpath files gracefully. - Bump SDK version to 0.3.1-SNAPSHOT. * Enable Logging, Session Replay, and Feature Flags in sample applications - Add `setApplicationLaunchSampleRate` and `useCustomEndpoint` to `ProfilingConfiguration.Builder` in the no-op profiling module. - Uncomment and enable Log, Session Replay, Feature Flag, and Timber integration dependencies across multiple sample modules (automotive, benchmark, kotlin, tv, vendor-lib, wear). - Restore initialization code for Logs, Session Replay, and Timber in sample application classes. - Downgrade several transitive dependencies (e.g., Gson, OkHttp, Okio, and various AndroidX libraries) to older versions across multiple modules. - Include `:features:dd-sdk-android-flags` and related modules in the global settings. - Implement a dependency substitution rule in the Kotlin sample to use no-op logs when appropriate. * Add no-op implementations for Feature Flags and OpenFeature modules * feat: add `dd-sdk-android-flags-noop` module - Provides a no-op implementation of the Flags SDK to allow safe compilation without the full feature. - Includes core interfaces: `FlagsClient`, `FlagsConfiguration`, `EvaluationContext`, and `ResolutionDetails`. - Defines `NoOpFlagsClient` which returns default values for all flag evaluations. * feat: add `dd-sdk-android-flags-openfeature-noop` module - Provides a no-op implementation of the OpenFeature provider. - Includes `DatadogFlagsProvider` which implements `FeatureProvider` by returning default values. - Adds `asOpenFeatureProvider()` extension on `FlagsClient`. * chore: update sample application - Configure Kotlin sample to use `noop` variants for the `noop` build flavor. - Uncomment and initialize Feature Flags in `SampleApplication.kt` using the new APIs. * build: include new modules in project settings and build configurations. * Update build configuration and test dependencies across SDK modules - Add missing test dependencies (`gson`, `okHttp`, `fresco`, `robolectric`) to multiple feature modules - Update `dd-sdk-android-profiling` to use version catalog for AndroidX Core dependencies - Add several unit test exclusions in `dd-sdk-android-flags` and `dd-sdk-android-internal` - Register no-op and alias tasks in `dd-sdk-android-dependencies` to support Android aggregation tasks (assemble, lint, test, etc.) - Define new AndroidX core versions and modules in `libs.versions.toml` - Temporarily comment out `WorkerParametersForgeryFactory` in core tests * Update shadowJar configuration and dependencies * chore: update shadowJar and jar tasks - Change shadowJar archive classifier to "all" - Configure jar task to depend on and include contents of shadowJar (excluding manifest) * chore: update transitive dependencies - Add okhttp, okio, and collection to dd-sdk-android-flags-noop - Add coroutines and kotlin-stdlib-jdk variants to dd-sdk-android-flags-openfeature-noop * Noop logs profiling session replay (#3) * Add "No-Op" modules for Session Replay, Logs, and Profiling features to provide empty implementations with minimal footprint. * refactor: optimize dependency isolation and compatibility - Downgrade androidx.core to 1.12.0 and move key dependencies (Gson, OkHttp, WorkManager) to compileOnly scope to reduce SDK footprint and avoid version conflicts. - Implement WorkManagerUtils with reflection-based safe initialization check to handle optional WorkManager dependency. - Update API surface and transitive dependency lists across multiple modules. - Fix Detekt configuration to handle missing classpath files gracefully. - Bump SDK version to 0.3.1-SNAPSHOT. * Enable Logging, Session Replay, and Feature Flags in sample applications - Add `setApplicationLaunchSampleRate` and `useCustomEndpoint` to `ProfilingConfiguration.Builder` in the no-op profiling module. - Uncomment and enable Log, Session Replay, Feature Flag, and Timber integration dependencies across multiple sample modules (automotive, benchmark, kotlin, tv, vendor-lib, wear). - Restore initialization code for Logs, Session Replay, and Timber in sample application classes. - Downgrade several transitive dependencies (e.g., Gson, OkHttp, Okio, and various AndroidX libraries) to older versions across multiple modules. - Include `:features:dd-sdk-android-flags` and related modules in the global settings. - Implement a dependency substitution rule in the Kotlin sample to use no-op logs when appropriate. * Add no-op implementations for Feature Flags and OpenFeature modules * feat: add `dd-sdk-android-flags-noop` module - Provides a no-op implementation of the Flags SDK to allow safe compilation without the full feature. - Includes core interfaces: `FlagsClient`, `FlagsConfiguration`, `EvaluationContext`, and `ResolutionDetails`. - Defines `NoOpFlagsClient` which returns default values for all flag evaluations. * feat: add `dd-sdk-android-flags-openfeature-noop` module - Provides a no-op implementation of the OpenFeature provider. - Includes `DatadogFlagsProvider` which implements `FeatureProvider` by returning default values. - Adds `asOpenFeatureProvider()` extension on `FlagsClient`. * chore: update sample application - Configure Kotlin sample to use `noop` variants for the `noop` build flavor. - Uncomment and initialize Feature Flags in `SampleApplication.kt` using the new APIs. * build: include new modules in project settings and build configurations. * Update build configuration and test dependencies across SDK modules - Add missing test dependencies (`gson`, `okHttp`, `fresco`, `robolectric`) to multiple feature modules - Update `dd-sdk-android-profiling` to use version catalog for AndroidX Core dependencies - Add several unit test exclusions in `dd-sdk-android-flags` and `dd-sdk-android-internal` - Register no-op and alias tasks in `dd-sdk-android-dependencies` to support Android aggregation tasks (assemble, lint, test, etc.) - Define new AndroidX core versions and modules in `libs.versions.toml` - Temporarily comment out `WorkerParametersForgeryFactory` in core tests * Update shadowJar configuration and dependencies * chore: update shadowJar and jar tasks - Change shadowJar archive classifier to "all" - Configure jar task to depend on and include contents of shadowJar (excluding manifest) * chore: update transitive dependencies - Add okhttp, okio, and collection to dd-sdk-android-flags-noop - Add coroutines and kotlin-stdlib-jdk variants to dd-sdk-android-flags-openfeature-noop * Remove shadowJar artifacts from API and runtime elements - Remove `shadowJar` task artifacts from `apiElements` and `runtimeElements` configurations in `dd-sdk-android-dependencies/build.gradle.kts`. * Remove shadowJar artifacts from API and runtime elements (#4) * Add "No-Op" modules for Session Replay, Logs, and Profiling features to provide empty implementations with minimal footprint. * refactor: optimize dependency isolation and compatibility - Downgrade androidx.core to 1.12.0 and move key dependencies (Gson, OkHttp, WorkManager) to compileOnly scope to reduce SDK footprint and avoid version conflicts. - Implement WorkManagerUtils with reflection-based safe initialization check to handle optional WorkManager dependency. - Update API surface and transitive dependency lists across multiple modules. - Fix Detekt configuration to handle missing classpath files gracefully. - Bump SDK version to 0.3.1-SNAPSHOT. * Enable Logging, Session Replay, and Feature Flags in sample applications - Add `setApplicationLaunchSampleRate` and `useCustomEndpoint` to `ProfilingConfiguration.Builder` in the no-op profiling module. - Uncomment and enable Log, Session Replay, Feature Flag, and Timber integration dependencies across multiple sample modules (automotive, benchmark, kotlin, tv, vendor-lib, wear). - Restore initialization code for Logs, Session Replay, and Timber in sample application classes. - Downgrade several transitive dependencies (e.g., Gson, OkHttp, Okio, and various AndroidX libraries) to older versions across multiple modules. - Include `:features:dd-sdk-android-flags` and related modules in the global settings. - Implement a dependency substitution rule in the Kotlin sample to use no-op logs when appropriate. * Add no-op implementations for Feature Flags and OpenFeature modules * feat: add `dd-sdk-android-flags-noop` module - Provides a no-op implementation of the Flags SDK to allow safe compilation without the full feature. - Includes core interfaces: `FlagsClient`, `FlagsConfiguration`, `EvaluationContext`, and `ResolutionDetails`. - Defines `NoOpFlagsClient` which returns default values for all flag evaluations. * feat: add `dd-sdk-android-flags-openfeature-noop` module - Provides a no-op implementation of the OpenFeature provider. - Includes `DatadogFlagsProvider` which implements `FeatureProvider` by returning default values. - Adds `asOpenFeatureProvider()` extension on `FlagsClient`. * chore: update sample application - Configure Kotlin sample to use `noop` variants for the `noop` build flavor. - Uncomment and initialize Feature Flags in `SampleApplication.kt` using the new APIs. * build: include new modules in project settings and build configurations. * Update build configuration and test dependencies across SDK modules - Add missing test dependencies (`gson`, `okHttp`, `fresco`, `robolectric`) to multiple feature modules - Update `dd-sdk-android-profiling` to use version catalog for AndroidX Core dependencies - Add several unit test exclusions in `dd-sdk-android-flags` and `dd-sdk-android-internal` - Register no-op and alias tasks in `dd-sdk-android-dependencies` to support Android aggregation tasks (assemble, lint, test, etc.) - Define new AndroidX core versions and modules in `libs.versions.toml` - Temporarily comment out `WorkerParametersForgeryFactory` in core tests * Update shadowJar configuration and dependencies * chore: update shadowJar and jar tasks - Change shadowJar archive classifier to "all" - Configure jar task to depend on and include contents of shadowJar (excluding manifest) * chore: update transitive dependencies - Add okhttp, okio, and collection to dd-sdk-android-flags-noop - Add coroutines and kotlin-stdlib-jdk variants to dd-sdk-android-flags-openfeature-noop * Remove shadowJar artifacts from API and runtime elements - Remove `shadowJar` task artifacts from `apiElements` and `runtimeElements` configurations in `dd-sdk-android-dependencies/build.gradle.kts`. * Prevent task registration collisions by checking for existing tasks before registering shadow and aggregation tasks in `dd-sdk-android-dependencies/build.gradle.kts`. * Update task registration for `assembleDebug`, `assembleRelease`, `testDebugUnitTest`, and `testReleaseUnitTest` to use conditional checks. * Apply the same conditional logic to no-op tasks including `lintRelease`, `checkDependencyLicenses`, `checkApiSurfaceChanges`, `checkCompilerMetadataChanges`, `checkTransitiveDependenciesList`, `koverXmlReportRelease`, and `printDetektClasspath`. * fix(build): resolve R8 conflicts, missing test dependencies, and JDK compatibility issues * Fix R8 "defined multiple times" error by optimizing shadowJar configurations. * Fix WorkManager 2.7.1 unit test compilation and runtime errors. * Enhance reflection tools for JDK 17+ compatibility. * Globally add missing test dependencies (Gson/OkHttp) to fix NoClassDefFoundError in feature and integration modules. * Add Proguard -dontwarn rules for missing classes in reliability tests. --------- Co-authored-by: Fiona <baiyang.feng@outlook.com>
1 parent baebb59 commit d93b64b

238 files changed

Lines changed: 11095 additions & 394 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ buildscript {
3434
classpath(libs.sqlDelightGradlePlugin)
3535
classpath(libs.binaryCompatibilityGradlePlugin)
3636
classpath(libs.kotlinxSerializationPlugin)
37+
classpath(libs.shadowPlugin)
3738
}
3839
}
3940

buildSrc/src/main/kotlin/com/datadog/gradle/config/AndroidConfig.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object AndroidConfig {
4040
}
4141
// Local development or other branches → Snapshot
4242
else -> {
43-
Version(0, 3, 0, Version.Type.Snapshot)
43+
Version(0, 3, 1, Version.Type.Snapshot)
4444
}
4545
}
4646
}
@@ -77,6 +77,7 @@ fun Project.androidLibraryConfig() {
7777

7878
defaultConfig {
7979
minSdk = AndroidConfig.MIN_SDK
80+
consumerProguardFiles("${rootDir.absolutePath}/consumer-rules.pro")
8081
}
8182

8283
compileOptions {

buildSrc/src/main/kotlin/com/datadog/gradle/config/DetektCustomConfig.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,28 @@ fun Project.detektCustomConfig() {
122122
}
123123
}
124124

125-
val externalDependencies = File("${projectDir.absolutePath}/detekt_classpath").readText()
125+
val externalDependenciesFile = File("${projectDir.absolutePath}/detekt_classpath")
126+
val externalDependencies = if (externalDependenciesFile.exists()) {
127+
externalDependenciesFile.readText()
128+
} else {
129+
logger.warn("Detekt classpath file missing: ${externalDependenciesFile.path}")
130+
""
131+
}
126132
val moduleDependenciesClasses = moduleDependencies.map {
127133
"${rootDir.absolutePath}${it.replace(':', '/')}/build/extracted/classes.jar"
128134
}.joinToString(":")
129135

130136
val dependencies = if (moduleDependenciesClasses.isBlank()) {
131137
externalDependencies
132138
} else {
133-
"$externalDependencies:$moduleDependenciesClasses"
139+
if (externalDependencies.isBlank()) {
140+
moduleDependenciesClasses
141+
} else {
142+
"$externalDependencies:$moduleDependenciesClasses"
143+
}
134144
}
135145

146+
136147
args("-cp", dependencies)
137148
}
138149
}

buildSrc/src/main/kotlin/com/datadog/gradle/config/MavenConfig.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ fun Project.publishingConfig(
9595
}
9696

9797
signingExtension.apply {
98-
// Signing is required unless explicitly skipped
99-
isRequired = !hasProperty("dd-skip-signing")
98+
// Signing is required unless explicitly skipped or publishing to maven local
99+
val isLocalPublish = gradle.startParameter.taskNames.any {
100+
it.contains("publishToMavenLocal", ignoreCase = true)
101+
}
102+
isRequired = !hasProperty("dd-skip-signing") && !isLocalPublish
100103

101104
val privateKey = System.getenv("GPG_PRIVATE_KEY")
102105
val password = System.getenv("GPG_PASSWORD")

consumer-rules.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# This is needed for the Datadog Error Tracking feature to work reliably,
22
# this file is used by Logs and RUM modules
33
-keepattributes SourceFile,LineNumberTable
4+
5+
# Shaded dependencies
6+
-keep class cloud.flashcat.shaded.** { *; }

dd-sdk-android-core/api/apiSurface

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ fun <T> java.util.concurrent.Future<T>?.getSafe(String, com.datadog.android.api.
344344
object com.datadog.android.core.internal.utils.JsonSerializer
345345
fun toJsonElement(Any?): com.google.gson.JsonElement
346346
fun Map<String, Any?>.safeMapValuesToJson(com.datadog.android.api.InternalLogger): Map<String, com.google.gson.JsonElement>
347+
fun isInitialized(android.content.Context): Boolean
348+
fun getWorkManagerOrNull(android.content.Context): androidx.work.WorkManager?
347349
enum com.datadog.android.core.metrics.MethodCallSamplingRate
348350
constructor(Float)
349351
- ALL

dd-sdk-android-core/api/dd-sdk-android-core.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,11 @@ public final class com/datadog/android/core/internal/utils/JsonSerializer {
890890
public final fun toJsonElement (Ljava/lang/Object;)Lcom/google/gson/JsonElement;
891891
}
892892

893+
public final class com/datadog/android/core/internal/utils/WorkManagerUtilsKt {
894+
public static final fun getWorkManagerOrNull (Landroid/content/Context;)Landroidx/work/WorkManager;
895+
public static final fun isInitialized (Landroid/content/Context;)Z
896+
}
897+
893898
public final class com/datadog/android/core/metrics/MethodCallSamplingRate : java/lang/Enum {
894899
public static final field ALL Lcom/datadog/android/core/metrics/MethodCallSamplingRate;
895900
public static final field HIGH Lcom/datadog/android/core/metrics/MethodCallSamplingRate;

dd-sdk-android-core/build.gradle.kts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ dependencies {
103103
implementation(libs.kotlin)
104104

105105
// Network
106-
implementation(libs.okHttp)
107-
implementation(libs.gson)
106+
compileOnly(libs.okHttp)
107+
compileOnly(libs.gson)
108+
implementation(project(":dd-sdk-android-dependencies"))
108109
implementation(libs.kronosNTP)
109110

110111
// Android Instrumentation
111112
implementation(libs.androidXAnnotation)
112113
implementation(libs.androidXCollection)
113-
implementation(libs.androidXWorkManager)
114+
compileOnly(libs.androidXWorkManager)
114115

115116
implementation(project(":dd-sdk-android-internal"))
116117

@@ -130,6 +131,9 @@ dependencies {
130131
}
131132
}
132133
testImplementation(testFixtures(project(":dd-sdk-android-internal")))
134+
testImplementation(libs.gson)
135+
testImplementation(libs.okHttp)
136+
testImplementation(libs.androidXWorkManager)
133137
testImplementation(libs.bundles.jUnit5)
134138
testImplementation(libs.bundles.testTools)
135139
unmock(libs.robolectric)

dd-sdk-android-core/src/main/kotlin/com/datadog/android/Datadog.kt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package com.datadog.android
88

99
import android.content.Context
10+
import android.util.Log
1011
import androidx.annotation.AnyThread
1112
import androidx.annotation.WorkerThread
1213
import com.datadog.android.Datadog.clearAccountInfo
@@ -63,6 +64,7 @@ object Datadog {
6364
configuration: Configuration,
6465
trackingConsent: TrackingConsent
6566
): SdkCore? {
67+
checkRuntimeDependencies()
6668
synchronized(registry) {
6769
val existing = registry.getInstance(instanceName)
6870
if (existing != null) {
@@ -432,6 +434,53 @@ object Datadog {
432434

433435
// endregion
434436

437+
// region Internal
438+
439+
private fun checkRuntimeDependencies() {
440+
val missingDependencies = mutableListOf<String>()
441+
if (!isClassAvailable("com.google.gson.Gson")) {
442+
missingDependencies.add("Gson (com.google.code.gson:gson)")
443+
}
444+
if (!isClassAvailable("okhttp3.OkHttpClient")) {
445+
missingDependencies.add("OkHttp (com.squareup.okhttp3:okhttp)")
446+
}
447+
448+
if (missingDependencies.isNotEmpty()) {
449+
val message = MISSING_DEPENDENCIES_ERROR.format(
450+
Locale.US,
451+
missingDependencies.joinToString(", ")
452+
)
453+
android.util.Log.e("Datadog", message)
454+
unboundInternalLogger.log(
455+
InternalLogger.Level.ERROR,
456+
InternalLogger.Target.USER,
457+
{ message }
458+
)
459+
throw IllegalStateException(message)
460+
}
461+
462+
if (!isClassAvailable("androidx.work.WorkManager")) {
463+
unboundInternalLogger.log(
464+
InternalLogger.Level.WARN,
465+
InternalLogger.Target.USER,
466+
{ WARNING_WORKMANAGER_MISSING }
467+
)
468+
}
469+
}
470+
471+
private fun isClassAvailable(className: String): Boolean {
472+
return try {
473+
Class.forName(className)
474+
true
475+
} catch (e: ClassNotFoundException) {
476+
false
477+
} catch (e: LinkageError) {
478+
false
479+
}
480+
}
481+
482+
// endregion
483+
435484
// region Constants
436485

437486
internal const val MESSAGE_ALREADY_INITIALIZED =
@@ -445,6 +494,13 @@ object Datadog {
445494
internal const val CANNOT_CREATE_SDK_INSTANCE_ID_ERROR =
446495
"Cannot create SDK instance ID, stopping SDK initialization."
447496

497+
internal const val MISSING_DEPENDENCIES_ERROR =
498+
"FlashCat SDK initialization failed because of missing dependencies: %s. " +
499+
"Please make sure you have added them to your app's build.gradle file."
500+
501+
internal const val WARNING_WORKMANAGER_MISSING =
502+
"WorkManager library not found. Background upload capabilities will be disabled."
503+
448504
internal const val DD_SOURCE_TAG = "_dd.source"
449505
internal const val DD_SDK_VERSION_TAG = "_dd.sdk_version"
450506
internal const val DD_APP_VERSION_TAG = "_dd.version"

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/lifecycle/ProcessLifecycleCallback.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import android.content.Context
1010
import androidx.work.WorkManager
1111
import com.datadog.android.api.InternalLogger
1212
import com.datadog.android.core.internal.utils.cancelUploadWorker
13+
import com.datadog.android.core.internal.utils.isInitialized
1314
import com.datadog.android.core.internal.utils.triggerUploadWorker
1415
import java.lang.ref.Reference
1516
import java.lang.ref.WeakReference
@@ -25,7 +26,7 @@ internal class ProcessLifecycleCallback(
2526

2627
override fun onStarted() {
2728
contextWeakRef.get()?.let {
28-
if (WorkManager.isInitialized()) {
29+
if (isInitialized(it)) {
2930
cancelUploadWorker(it, instanceName, internalLogger)
3031
}
3132
}
@@ -37,7 +38,7 @@ internal class ProcessLifecycleCallback(
3738

3839
override fun onStopped() {
3940
contextWeakRef.get()?.let {
40-
if (WorkManager.isInitialized()) {
41+
if (isInitialized(it)) {
4142
triggerUploadWorker(it, instanceName, internalLogger)
4243
}
4344
}

0 commit comments

Comments
 (0)