Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / weather / src / main / res / xml / data_extraction_rules.xml
data_extraction_rules.xml66 lines · 3.4 KiBRaw
| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- |
| 3 | Weather. Audited state: |
| 4 | * databases/weather-db — Room DB holding SavedLocation (the user's saved |
| 5 | places, genuinely worth restoring) and WeatherCache (forecast responses, |
| 6 | regenerable). |
| 7 | * secure_prefs.xml — SQLCipher passphrase for that DB. |
| 8 | * The Rust/NDK layer (src/main/rust) keeps its HTTP Range block cache in |
| 9 | memory only — Mutex<HashMap<u64, Vec<u8>>> in lib.rs. It writes nothing to |
| 10 | disk, so there is no native cache directory to exclude. |
| 11 | |
| 12 | weather-db is excluded from both sections for the same reason as the other |
| 13 | buildDatabase() apps: it is SQLCipher-encrypted under a passphrase wrapped by |
| 14 | a non-exportable AndroidKeystore key. That key never leaves the device, so a |
| 15 | restored copy of this file cannot be opened — buildDatabase() mints a fresh |
| 16 | key and passphrase, encryptExistingDatabase() skips the already-encrypted |
| 17 | file, and Room throws SQLiteNotADatabaseException. Shipping it would trade a |
| 18 | clean first launch for a crash. |
| 19 | |
| 20 | The saved locations still migrate: weather declares its own BackupAgent, which |
| 21 | uses SqlCipherDbCodec to export the DB to plaintext inside the backup payload |
| 22 | and re-encrypt it under the new device's key on restore. That path is the one |
| 23 | that works; the raw file copy would only get in its way. |
| 24 | |
| 25 | Everything else — UI preferences, units, widget state — backs up normally. |
| 26 | |
| 27 | SCOPE: weather declares android:backupAgent=".util.AppBackupAgent" and does |
| 28 | NOT set android:fullBackupOnly, so Android uses key/value backup here and the |
| 29 | <cloud-backup> section below is NOT consulted. Cloud content is exactly |
| 30 | AppBackupAgent's weatherDbConfigs(this) — weather-db, exported to plaintext by |
| 31 | SqlCipherDbCodec and re-encrypted on restore. That is the path that carries |
| 32 | SavedLocation across, and it works. The rules below govern <device-transfer>, |
| 33 | and are the correct control if the backupAgent is ever removed. |
| 34 | |
| 35 | Worth knowing: because the codec exports to plaintext inside the payload, the |
| 36 | cloud copy includes WeatherCache rows (regenerable forecast data) as well as |
| 37 | saved locations. Trimming that would be a change to weatherDbConfigs, not to |
| 38 | this 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 | <include domain="database" path="." /> |
| 46 | <exclude domain="database" path="weather-db" /> |
| 47 | <exclude domain="database" path="weather-db-wal" /> |
| 48 | <exclude domain="database" path="weather-db-shm" /> |
| 49 | <exclude domain="database" path="weather-db-journal" /> |
| 50 | <include domain="sharedpref" path="." /> |
| 51 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 52 | <include domain="external" path="." /> |
| 53 | </cloud-backup> |
| 54 | <device-transfer> |
| 55 | <include domain="root" path="." /> |
| 56 | <include domain="file" path="." /> |
| 57 | <include domain="database" path="." /> |
| 58 | <exclude domain="database" path="weather-db" /> |
| 59 | <exclude domain="database" path="weather-db-wal" /> |
| 60 | <exclude domain="database" path="weather-db-shm" /> |
| 61 | <exclude domain="database" path="weather-db-journal" /> |
| 62 | <include domain="sharedpref" path="." /> |
| 63 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 64 | <include domain="external" path="." /> |
| 65 | </device-transfer> |
| 66 | </data-extraction-rules> |