-
Notifications
You must be signed in to change notification settings - Fork 580
Open
Labels
Impact: MediumModerate perceived user impact (non-blocking bugs and general improvements).Moderate perceived user impact (non-blocking bugs and general improvements).Work: LowSolution is clear and broken into good-first-issue-sized chunks.Solution is clear and broken into good-first-issue-sized chunks.bugEnd user-perceivable behaviors which are not desirable.End user-perceivable behaviors which are not desirable.good first issueThis item is good for new contributors to make their pull request.This item is good for new contributors to make their pull request.
Description
Describe the bug
The createWorkerMethod of the PlatformParemeterSyncUpWorkerFactory and MetricLogSchedulingWorkerFactory is not set up properly. This leads to instances such as duplicate factories being created and/or the worker not being initialised correctly once added to the DelegatingWorkerFactory on the WorkManagerConfigurationModule. This needs to be fixed in a similar way to what is shown below. The fix should also extend to the LogUploadWorkerFactory.
Sample fix;
LogUploadWorkerFactory
class LogUploadWorkerFactory @Inject constructor(
private val workerFactory: LogUploadWorker.Factory
) : WorkerFactory() {
override fun createWorker(
appContext: Context,
workerClassName: String,
workerParameters: WorkerParameters
): ListenableWorker? {
return if (workerClassName == LogUploadWorker::class.java.name) {
workerFactory.create(appContext, workerParameters)
} else null
}
}PlatformParameterSyncUpWorkerFactory
class PlatformParameterSyncUpWorkerFactory @Inject constructor(
private val workerFactory: PlatformParameterSyncUpWorker.Factory
) : WorkerFactory() {
override fun createWorker(
context: Context,
workerClassName: String,
workerParameters: WorkerParameters
): ListenableWorker? {
return if (workerClassName == PlatformParameterSyncUpWorker::class.java.name) {
workerFactory.create(context, workerParameters)
} else null
}
}MetricLogSchedulingWorkerFactory
class MetricLogSchedulingWorkerFactory @Inject constructor(
private val workerFactory: MetricLogSchedulingWorker.Factory
) : WorkerFactory() {
override fun createWorker(
appContext: Context,
workerClassName: String,
workerParameters: WorkerParameters
): ListenableWorker? { // must be nullable!
return if (workerClassName == MetricLogSchedulingWorker::class.java.name) {
workerFactory.create(appContext, workerParameters)
} else null
}
}Steps To Reproduce
- Uninstall the Oppia app or clear storage.
- Open logcat and filter by the keyword "Worker".
- Reinstall the app on a mobile device with Android 10 and below.
- Observe the logcat.
- You should be able to see the MetricLogSchedulingWorker and PlatformParameterSyncUpWorker reporting Failure results after they run.
Expected Behavior
Both workers should succeed.
Screenshots/Videos
What device/emulator are you using?
No response
Which Android version is your device/emulator running?
Android 10
Which version of the Oppia Android app are you using?
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Impact: MediumModerate perceived user impact (non-blocking bugs and general improvements).Moderate perceived user impact (non-blocking bugs and general improvements).Work: LowSolution is clear and broken into good-first-issue-sized chunks.Solution is clear and broken into good-first-issue-sized chunks.bugEnd user-perceivable behaviors which are not desirable.End user-perceivable behaviors which are not desirable.good first issueThis item is good for new contributors to make their pull request.This item is good for new contributors to make their pull request.
Type
Projects
Status
Todo