FairEmail/app/src/main/java/com/bugsnag/android/DataCollectionModule.kt

62 lines
1.8 KiB
Kotlin
Raw Normal View History

2021-08-15 12:40:22 +00:00
package com.bugsnag.android
import android.os.Environment
import com.bugsnag.android.internal.dag.ConfigModule
import com.bugsnag.android.internal.dag.ContextModule
import com.bugsnag.android.internal.dag.DependencyModule
import com.bugsnag.android.internal.dag.SystemServiceModule
/**
* A dependency module which constructs the objects that collect data in Bugsnag. For example, this
* class is responsible for creating classes which capture device-specific information.
*/
internal class DataCollectionModule(
contextModule: ContextModule,
configModule: ConfigModule,
systemServiceModule: SystemServiceModule,
trackerModule: TrackerModule,
bgTaskService: BackgroundTaskService,
connectivity: Connectivity,
2021-09-11 18:36:58 +00:00
deviceId: String?,
2022-06-23 18:23:15 +00:00
internalDeviceId: String?,
2021-09-11 18:36:58 +00:00
memoryTrimState: MemoryTrimState
2021-08-15 12:40:22 +00:00
) : DependencyModule() {
private val ctx = contextModule.ctx
private val cfg = configModule.config
private val logger = cfg.logger
private val deviceBuildInfo: DeviceBuildInfo = DeviceBuildInfo.defaultInfo()
private val dataDir = Environment.getDataDirectory()
val appDataCollector by future {
AppDataCollector(
ctx,
ctx.packageManager,
cfg,
trackerModule.sessionTracker,
systemServiceModule.activityManager,
trackerModule.launchCrashTracker,
2021-09-11 18:36:58 +00:00
memoryTrimState
2021-08-15 12:40:22 +00:00
)
}
private val rootDetector by future {
RootDetector(logger = logger, deviceBuildInfo = deviceBuildInfo)
}
val deviceDataCollector by future {
DeviceDataCollector(
connectivity,
ctx,
ctx.resources,
deviceId,
2022-06-23 18:23:15 +00:00
internalDeviceId,
2021-08-15 12:40:22 +00:00
deviceBuildInfo,
dataDir,
rootDetector,
bgTaskService,
logger
)
}
}