Modern Apps git

← Modern-Apps.git

notes: fix backup agent class name in manifest

Commit
7ce51d60584bdae66a321355134fbb75d9239c80
Author
Vayun Mathur <[email protected]>
When
2026-11-07 20:08 UTC (29 days ago)
Parents
05b6fca
Symptom: Android cloud backup / device transfer for notes silently
never ran, so notes were missing after a device move despite
data_extraction_rules.xml including the database.

Root cause: AndroidManifest declared android:backupAgent as
.util.AppBackupAgent, but the class lives in
com.vayunmathur.notes.platform. The framework cannot instantiate
the named class, so backup fails before any data is written.

Fix: point the manifest at .platform.AppBackupAgent.

Verification: new MainActivityTest.manifestBackupAgentClassExists
asserts the merged manifest names the real class and that it loads;
run with the notes unit-test suite at the end of this stack.

Diff

notes/src/main/AndroidManifest.xml
diff --git a/notes/src/main/AndroidManifest.xml b/notes/src/main/AndroidManifest.xmlindex 1c60476838..1976fc20f0 100644--- a/notes/src/main/AndroidManifest.xml+++ b/notes/src/main/AndroidManifest.xml@@ -21,7 +21,7 @@      <application         android:allowBackup="true"-        android:backupAgent=".util.AppBackupAgent"+        android:backupAgent=".platform.AppBackupAgent"         android:dataExtractionRules="@xml/data_extraction_rules"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"
notes/src/test/java/com/vayunmathur/notes/MainActivityTest.kt
diff --git a/notes/src/test/java/com/vayunmathur/notes/MainActivityTest.kt b/notes/src/test/java/com/vayunmathur/notes/MainActivityTest.ktindex 039c227fdc..d0b4341956 100644--- a/notes/src/test/java/com/vayunmathur/notes/MainActivityTest.kt+++ b/notes/src/test/java/com/vayunmathur/notes/MainActivityTest.kt@@ -39,6 +39,17 @@ class MainActivityTest {         controller.pause().stop().destroy()     } +    @Test fun manifestBackupAgentClassExists() {+        val info = app.packageManager.getApplicationInfo(app.packageName, 0)+        val agentName = info.backupAgentName+        assertEquals("com.vayunmathur.notes.platform.AppBackupAgent", agentName)+        // The named class must actually load, or Android backup silently never runs.+        assertEquals(+            com.vayunmathur.notes.platform.AppBackupAgent::class.java,+            Class.forName(agentName),+        )+    }+     @Test fun onNewIntentWithDataUriDoesNotCrash() {         val controller = Robolectric.buildActivity(MainActivity::class.java).create().start().resume()         val intent = Intent(Intent.ACTION_VIEW).apply { data = Uri.parse("content://x/new.md") }