Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / photos / src / main / res / xml / data_extraction_rules.xml
data_extraction_rules.xml78 lines · 4.9 KiBRaw
| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- Overrides the permissive default in the shared :library module. |
| 3 | |
| 4 | Storage audited: |
| 5 | database/passwords-db PhotoDatabase (Photo/Person/PhotoFace): a derived index over |
| 6 | MediaStore plus the on-device analysis built on it — EXIF, |
| 7 | lat/long, OCR text, CLIP embeddings, face embeddings and |
| 8 | cluster centroids. Most of the MediaStore-derived columns are |
| 9 | regenerable by re-running SyncWorker, but Person.name (a |
| 10 | user-assigned name for a face cluster), Person.hidden (a |
| 11 | user-set flag) and the face/OCR/CLIP payloads are user data |
| 12 | built by expensive on-device analysis and cannot be re-derived |
| 13 | cheaply. The database is SQLCipher-encrypted under a passphrase |
| 14 | wrapped by a non-exportable AndroidKeyStore key. |
| 15 | database/vault-db VaultDatabase for the secure folder, opened with a |
| 16 | user-supplied password rather than the keystore passphrase. |
| 17 | file/secure_vault the secure folder's stored photos, AES-GCM-encrypted under a |
| 18 | key derived from that same user password. |
| 19 | file/datastore_default.preferences_pb grid column count and model-version markers. |
| 20 | cache/image_cache Coil disk cache; Android never backs up cacheDir. |
| 21 | |
| 22 | The photo database migrates through the declared BackupAgent |
| 23 | (.platform.AppBackupAgent), which exports it to plaintext inside the backup |
| 24 | payload via SqlCipherDbCodec and re-encrypts it under the new device's key on |
| 25 | restore. That codec path is the one that carries face/people metadata across. |
| 26 | The raw database file must therefore never travel on either channel: a restored |
| 27 | copy cannot be opened (the wrapping key never leaves the old device, the new |
| 28 | device mints a fresh passphrase, and Room then fails to open the file), so the |
| 29 | rules below exclude it and its sidecars everywhere as the control that applies |
| 30 | to device transfer and as the correct fallback if the agent is ever removed. |
| 31 | |
| 32 | The vault is different by key custody, not by sensitivity: vault-db and |
| 33 | secure_vault are encrypted under the user's own password, so a raw device |
| 34 | transfer copy opens again with that same password and hidden photos survive a |
| 35 | phone move without passing through Google. Cloud backup excludes them — the |
| 36 | secure folder is hidden by intent and stays exportable only through its own |
| 37 | password-backed backup in the app. |
| 38 | |
| 39 | The gallery photos themselves are MediaStore content, not app data: the |
| 40 | external domain is never included, and no rule here copies image or video |
| 41 | files. They move with the system's media transfer, and the restored index |
| 42 | re-validates against MediaStore on the first sync. |
| 43 | |
| 44 | SCOPE: photos declares android:backupAgent=".platform.AppBackupAgent" and does |
| 45 | NOT set android:fullBackupOnly, so Android uses key/value backup here and the |
| 46 | <cloud-backup> section below is NOT consulted. Cloud content is exactly |
| 47 | AppBackupAgent's photosDbConfigs(this) — the photo database, exported to |
| 48 | plaintext by SqlCipherDbCodec and re-encrypted on restore — plus its |
| 49 | datastore_default file. The rules below govern <device-transfer>, and are |
| 50 | the correct cloud control if the backupAgent is ever removed. --> |
| 51 | <data-extraction-rules> |
| 52 | <!-- Not consulted while android:backupAgent is declared; see SCOPE above. --> |
| 53 | <cloud-backup disableIfNoEncryptionCapabilities="true"> |
| 54 | <include domain="file" path="." /> |
| 55 | <include domain="database" path="." /> |
| 56 | <include domain="sharedpref" path="." /> |
| 57 | <exclude domain="database" path="passwords-db" /> |
| 58 | <exclude domain="database" path="passwords-db-wal" /> |
| 59 | <exclude domain="database" path="passwords-db-shm" /> |
| 60 | <exclude domain="database" path="passwords-db-journal" /> |
| 61 | <exclude domain="database" path="vault-db" /> |
| 62 | <exclude domain="database" path="vault-db-wal" /> |
| 63 | <exclude domain="database" path="vault-db-shm" /> |
| 64 | <exclude domain="database" path="vault-db-journal" /> |
| 65 | <exclude domain="file" path="secure_vault" /> |
| 66 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 67 | </cloud-backup> |
| 68 | <device-transfer> |
| 69 | <include domain="file" path="." /> |
| 70 | <include domain="database" path="." /> |
| 71 | <include domain="sharedpref" path="." /> |
| 72 | <exclude domain="database" path="passwords-db" /> |
| 73 | <exclude domain="database" path="passwords-db-wal" /> |
| 74 | <exclude domain="database" path="passwords-db-shm" /> |
| 75 | <exclude domain="database" path="passwords-db-journal" /> |
| 76 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 77 | </device-transfer> |
| 78 | </data-extraction-rules> |