Steps 2 and 3 of docs/STORAGE-AND-SYNC.md. Agendula stops depending on a tasks provider app being installed: it now carries one. The module New :provider — the dmfs task provider 1.4.2 (Apache-2.0, DB 23), vendored in-tree, renamed to authority de.jeanlucmakiola.agendula.tasks and permissions de.jeanlucmakiola.agendula.permission.*. It coexists with OpenTasks and tasks.org rather than replacing them; nothing collides with org.dmfs.*, so both can be installed at once. The contract shape is untouched — same tables, same columns — because that is what our data layer and every CalDAV engine already speak. We own the namespace it lives in, not the schema. Vendored rather than depended on because the permission names are hardcoded in the upstream AAR's manifest and cannot be renamed in a prebuilt artifact; in-tree also satisfies F-Droid's from-source rule. provider/PROVENANCE.md records the upstream commit and every deviation, each marked with an AGENDULA CHANGE comment at the site so the list and the code cannot drift apart. The change that matters most is the account cleanup. Upstream holds GET_ACCOUNTS and deletes any task list whose account it cannot see. We dropped that permission — we only ever need our own accounts, which are visible without it — but an account we cannot see is indistinguishable from one that was removed, so left alone the provider would quietly delete synced lists. Cleanup is now restricted to account types this package authenticates itself, which is currently none. ProviderAccountCleanupTest pins that, and answers open question 3: the local path works with no account present at all. Also required by targetSdk 36, none of which upstream faced at 29: FLAG_IMMUTABLE on the notification PendingIntent, an inexact-alarm fallback so a revoked SCHEDULE_EXACT_ALARM cannot kill the app on a timezone change, and an explicit android:exported on the receiver. Storage modes ProviderResolver gains a StorageMode: LOCAL (our provider) or EXTERNAL (an installed one). Not a third SYNCED value — synced is LOCAL with an account attached, which is derived state, and modelling it as a separate store would imply switching sync on is a migration. It isn't. When the user has not chosen, the tell is whether we already hold an external provider's runtime permission. That permission is dangerous-level, so it can only be there because an earlier version asked and they agreed — the signature of an existing Posture A user, who must not be dropped onto an empty store. Fresh installs get local-first. hasPermission now short-circuits for our own provider: same-uid access bypasses the check outright, so ProviderStatus.NEEDS_PERMISSION can no longer fire in Local mode. That was the work item the storage-and-sync doc called for. The resolver's platform calls moved behind ProviderEnvironment so the decision — the part that loses people their data if wrong — is unit-tested on the JVM. Verified: 51 vendored provider tests pass, app tests pass, lintDebug and assembleDebug clean. ProviderAccountCleanupTest skips on ARM64, where Robolectric has no SQLite backend, and runs on x86_64 CI. Not yet exercised on a device. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
67 lines
2.3 KiB
Kotlin
67 lines
2.3 KiB
Kotlin
// Agendula's own task store: the dmfs task provider (Apache-2.0), vendored.
|
|
//
|
|
// This module is a fork, not a dependency. What we changed and why is recorded
|
|
// in PROVENANCE.md; the short version is that the authority and the permission
|
|
// names had to become ours, and the permission names are hardcoded in the
|
|
// upstream AAR's manifest, so no prebuilt artifact could have been used.
|
|
//
|
|
// It stays Java, on upstream's `org.dmfs.*` package names, formatted the way
|
|
// upstream formats it. That is deliberate: every deviation from upstream is a
|
|
// line we have to re-reason about if we ever resync, so the diff is kept
|
|
// legible rather than idiomatic.
|
|
plugins {
|
|
alias(libs.plugins.android.library)
|
|
}
|
|
|
|
android {
|
|
namespace = "de.jeanlucmakiola.agendula.provider"
|
|
compileSdk = 37
|
|
|
|
defaultConfig {
|
|
// Matches :app. Upstream ships minSdk 21 / targetSdk 29; targetSdk is set
|
|
// by the application module anyway, but the SDK floor here has to agree
|
|
// with :app's or the manifest merger rejects it.
|
|
minSdk = 29
|
|
|
|
consumerProguardFiles("proguard-rules.pro")
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
buildFeatures {
|
|
// The provider reads its own authority out of resources, so it needs R.
|
|
// It has no BuildConfig use at all.
|
|
buildConfig = false
|
|
}
|
|
|
|
testOptions {
|
|
unitTests {
|
|
isIncludeAndroidResources = true
|
|
}
|
|
}
|
|
|
|
lint {
|
|
// Upstream's translations are inherited as-is and are partial — a missing
|
|
// string falls back to the English base at runtime. Same call as :app.
|
|
informational += listOf("MissingTranslation")
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.dmfs.jems)
|
|
implementation(libs.dmfs.rfc5545.datetime)
|
|
implementation(libs.dmfs.lib.recur)
|
|
|
|
// Upstream's own JVM test suite, on current versions of its stack. Note this
|
|
// module is JUnit 4 while :app is JUnit 5 — deliberately, see the version
|
|
// catalog. Do not add `useJUnitPlatform()` here.
|
|
testImplementation(libs.junit4)
|
|
testImplementation(libs.robolectric)
|
|
testImplementation(libs.hamcrest)
|
|
testImplementation(libs.mockito.core)
|
|
testImplementation(libs.dmfs.jems.testing)
|
|
}
|