Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / health / src / main / res / xml / data_extraction_rules.xml
data_extraction_rules.xml76 lines · 4.2 KiBRaw
| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- |
| 3 | Health. Audited state: |
| 4 | * databases/passwords-db — HealthDatabase (health, nutrition, sleep, |
| 5 | exercise and FHIR medical records). Irreplaceable user data. |
| 6 | * files/medical_attachments/ — vaccination-card scans referenced by |
| 7 | MedicalAttachment rows. Irreplaceable user data. |
| 8 | * files/food.db, food.db.part, food.bin.part, food.bin.meta.json — |
| 9 | Open Food Facts index unpacked from a bundled asset. Fully regenerable. |
| 10 | * files/datastore_default.preferences_pb — Health Connect sync |
| 11 | bookkeeping. Regenerable; restoring it on a new device would skip |
| 12 | re-importing records Health Connect there does not have yet. |
| 13 | * shared_prefs/secure_prefs.xml — SQLCipher passphrase wrapped by a |
| 14 | non-exportable AndroidKeyStore key. |
| 15 | * shared_prefs/sync.xml — declared in HealthAPI but never read or written. |
| 16 | |
| 17 | passwords-db is excluded from both sections: it is SQLCipher-encrypted |
| 18 | under a passphrase wrapped by a key that never leaves the old device, so a |
| 19 | restored raw copy cannot be opened — the repository mints a fresh key and |
| 20 | passphrase, and Room throws on the already-encrypted file. Shipping it |
| 21 | would trade a clean first launch for a crash and lose the records anyway. |
| 22 | |
| 23 | The records still migrate: health declares its own BackupAgent |
| 24 | (.platform.AppBackupAgent), which uses SqlCipherDbCodec to export the DB |
| 25 | to plaintext inside the backup payload and re-encrypt it under the new |
| 26 | device's key on restore, and carries medical_attachments as extra files. |
| 27 | That path is the one that works; the raw file copy would only get in its |
| 28 | way. The food index and sync bookkeeping stay behind on purpose. |
| 29 | |
| 30 | SCOPE: health declares android:backupAgent=".platform.AppBackupAgent" and |
| 31 | does NOT set android:fullBackupOnly, so Android uses key/value backup here |
| 32 | and the <cloud-backup> section below is NOT consulted. Cloud content is |
| 33 | exactly AppBackupAgent's payload — passwords-db exported to plaintext by |
| 34 | SqlCipherDbCodec (re-encrypted on restore) plus medical_attachments. The |
| 35 | rules below govern <device-transfer>, and are the correct control if the |
| 36 | backupAgent is ever removed: without the agent the raw DB must still never |
| 37 | travel, so a rule-only restore keeps the attachments and starts the |
| 38 | database empty rather than crashing on an unopenable file. |
| 39 | --> |
| 40 | <data-extraction-rules> |
| 41 | <!-- Not consulted while android:backupAgent is declared; see SCOPE above. --> |
| 42 | <cloud-backup> |
| 43 | <include domain="root" path="." /> |
| 44 | <include domain="file" path="." /> |
| 45 | <exclude domain="file" path="food.db" /> |
| 46 | <exclude domain="file" path="food.db.part" /> |
| 47 | <exclude domain="file" path="food.bin.part" /> |
| 48 | <exclude domain="file" path="food.bin.meta.json" /> |
| 49 | <exclude domain="file" path="datastore_default.preferences_pb" /> |
| 50 | <include domain="database" path="." /> |
| 51 | <exclude domain="database" path="passwords-db" /> |
| 52 | <exclude domain="database" path="passwords-db-wal" /> |
| 53 | <exclude domain="database" path="passwords-db-shm" /> |
| 54 | <exclude domain="database" path="passwords-db-journal" /> |
| 55 | <include domain="sharedpref" path="." /> |
| 56 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 57 | <include domain="external" path="." /> |
| 58 | </cloud-backup> |
| 59 | <device-transfer> |
| 60 | <include domain="root" path="." /> |
| 61 | <include domain="file" path="." /> |
| 62 | <exclude domain="file" path="food.db" /> |
| 63 | <exclude domain="file" path="food.db.part" /> |
| 64 | <exclude domain="file" path="food.bin.part" /> |
| 65 | <exclude domain="file" path="food.bin.meta.json" /> |
| 66 | <exclude domain="file" path="datastore_default.preferences_pb" /> |
| 67 | <include domain="database" path="." /> |
| 68 | <exclude domain="database" path="passwords-db" /> |
| 69 | <exclude domain="database" path="passwords-db-wal" /> |
| 70 | <exclude domain="database" path="passwords-db-shm" /> |
| 71 | <exclude domain="database" path="passwords-db-journal" /> |
| 72 | <include domain="sharedpref" path="." /> |
| 73 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 74 | <include domain="external" path="." /> |
| 75 | </device-transfer> |
| 76 | </data-extraction-rules> |