fix(#516): WorkManager's JobScheduler ids kept below the change watch's
This commit is contained in:
1 parent
ad5f0f4662
commit
281d511402
3 files changed
+21
-3
No files matched your search
@@ -485,6 +485,18 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- WorkManager initialises on demand from CalendulaApp's configuration. -->
|
||||
<provider
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="${applicationId}.androidx-startup"
|
||||
android:exported="false"
|
||||
tools:node="merge">
|
||||
<meta-data
|
||||
android:name="androidx.work.WorkManagerInitializer"
|
||||
android:value="androidx.startup"
|
||||
tools:node="remove" />
|
||||
</provider>
|
||||
|
||||
<!-- Hands .ics files we stage in the cache to other apps via a content
|
||||
Uri (single-event share). Authority tracks applicationId so the
|
||||
debug suffix doesn't break getUriForFile. -->
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package de.jeanlucmakiola.calendula
|
||||
|
||||
import android.app.Application
|
||||
import androidx.work.Configuration
|
||||
import dagger.hilt.android.EntryPointAccessors
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import de.jeanlucmakiola.calendula.data.backup.BackupChangeJob
|
||||
import de.jeanlucmakiola.calendula.data.backup.BackupScheduler
|
||||
import de.jeanlucmakiola.calendula.data.calendar.CalendarVisibilityReconciler
|
||||
import de.jeanlucmakiola.calendula.data.backup.BackupWorker
|
||||
@@ -27,7 +29,11 @@ import kotlinx.coroutines.launch
|
||||
* in AndroidManifest.xml. Hilt initializes its component graph here.
|
||||
*/
|
||||
@HiltAndroidApp
|
||||
class CalendulaApp : Application() {
|
||||
class CalendulaApp : Application(), Configuration.Provider {
|
||||
|
||||
/** Keeps WorkManager's JobScheduler ids clear of [BackupChangeJob]'s. */
|
||||
override val workManagerConfiguration: Configuration =
|
||||
Configuration.Builder().setJobSchedulerJobIdRange(0, BackupChangeJob.JOB_ID - 1).build()
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
@@ -51,8 +51,8 @@ class BackupChangeJob : JobService() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
/** Clear of WorkManager's ids, which count up from 0. */
|
||||
private const val JOB_ID = 0x0516_0001
|
||||
/** Above the range WorkManager is given (see CalendulaApp). */
|
||||
const val JOB_ID = 0x0516_0001
|
||||
private const val SETTLE_MINUTES = 2L
|
||||
private const val MAX_WAIT_MINUTES = 15L
|
||||
private const val TAG = "BackupChangeJob"
|
||||
|
||||
Reference in new issue
Block a user