updater,auto,watch,logviewer: make backup rules coherent
- Commit
1c33623f160b35d204676ca4606a2df8c82fbec4- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-04 21:58 UTC (1 day ago)
- Parents
8f0a4f9
updater declared allowBackup=false alongside include-everything data-extraction rules, so the rules were dead and misleading. Its only persisted state is one DataStore file mixing two user toggles with device-bound transient state (pending-reboot build for the inactive A/B slot, last check result, partial-download artifact name, a refused incremental); restoring it on another device would import a reboot claim for a slot that does not exist there. The rules now deny every domain on both channels, with the audit in a comment, matching allowBackup=false. auto had the same dead include-everything rules, but it does hold user state worth restoring: the pinned car-launcher dock, the sole key it writes to the shared DataStore file. allowBackup is now true and both channels include exactly that file (cloud gated on device encryption). The messaging and music-capture consents and the version-keyed refused-apps list stay out via the allowlist, so consent is re-granted per device, fail-closed. watch and logviewer had no dataExtractionRules at all on targetSdk 37, so device transfer would have swept their whole sandboxes by default. Neither stores anything restorable: watch's conduit runtime state is in-memory and re-derived on reconnect (streams only pass through cache scratch), and logviewer is a read-only viewer of system logcat/tombstones whose shares live in an in-memory provider cache. Both now declare allowBackup=false plus explicit deny-all rules for cloud backup and device transfer, with the audit in each file. No raw SQLCipher database is copied by any of the four (none of them has one). Verified with JAVA_HOME=jdk21, ANDROID_HOME and the shared Gradle cache, --max-workers=128: :updater:lint, :auto:lint and :watch:lint pass (0 errors), as do their lintVitalRelease tasks; testDevUnitTest passes for all four modules (702 tests, 0 failures). :logviewer:lint and :logviewer:lintVitalRelease fail on one pre-existing DialogAsRoute error in LogViewerScreen.kt:219, reproduced byte-identically on a pristine checkout of the base commit 30be4a93a with no changes, so it is not caused by this change; logviewer's lint reports contain no backup-related findings.
Diff
auto/src/main/AndroidManifest.xml
diff --git a/auto/src/main/AndroidManifest.xml b/auto/src/main/AndroidManifest.xmlindex fb6baadbad..4110c3a41e 100644--- a/auto/src/main/AndroidManifest.xml+++ b/auto/src/main/AndroidManifest.xml@@ -193,7 +193,7 @@ </queries> <application- android:allowBackup="false"+ android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
auto/src/main/res/xml/data_extraction_rules.xml
diff --git a/auto/src/main/res/xml/data_extraction_rules.xml b/auto/src/main/res/xml/data_extraction_rules.xmlindex 81a97e0f26..e68f0cbd90 100644--- a/auto/src/main/res/xml/data_extraction_rules.xml+++ b/auto/src/main/res/xml/data_extraction_rules.xml@@ -1,17 +1,29 @@ <?xml version="1.0" encoding="utf-8"?>+<!-- Storage audited:+ file/datastore_default.preferences_pb the app's only user state+ worth restoring: the car launcher's pinned dock (PinnedAppsPrefs,+ an ordered list of car-app ids the user chose). It is the sole+ key this app writes to the shared DataStoreUtils store.+ sharedpref/ma_auto_messaging.xml messaging-mirror consent.+ sharedpref/ma_auto_music_capture.xml music-capture consent.+ Both consents are deliberately NOT carried: consent to mirror+ messages or capture music off the phone is granted per device,+ fail-closed, and must be re-granted on a new device (the system+ notification-access / media-projection grants do not transfer+ either).+ sharedpref/ma_auto_refused_car_apps.xml car apps that refused the+ handshake, keyed to their version code; re-derived on first+ connection to each app, so also left out by the allowlist.+ No database, no SQLCipher, no other app-private files (TTS scratch+ lives in cacheDir, which Android never backs up).++ Only the pinned dock travels, on both channels; cloud backup is+ gated on device encryption. Everything not listed is excluded. --> <data-extraction-rules>- <cloud-backup>- <include domain="root" path="." />- <include domain="file" path="." />- <include domain="database" path="." />- <include domain="sharedpref" path="." />- <include domain="external" path="." />+ <cloud-backup disableIfNoEncryptionCapabilities="true">+ <include domain="file" path="datastore_default.preferences_pb" /> </cloud-backup> <device-transfer>- <include domain="root" path="." />- <include domain="file" path="." />- <include domain="database" path="." />- <include domain="sharedpref" path="." />- <include domain="external" path="." />+ <include domain="file" path="datastore_default.preferences_pb" /> </device-transfer> </data-extraction-rules>
logviewer/src/main/AndroidManifest.xml
diff --git a/logviewer/src/main/AndroidManifest.xml b/logviewer/src/main/AndroidManifest.xmlindex d3215c4bcd..2b230442ef 100644--- a/logviewer/src/main/AndroidManifest.xml+++ b/logviewer/src/main/AndroidManifest.xml@@ -73,6 +73,8 @@ and it is inert for a non-system install (the branch above is only reached for a system app), where the reflection simply keeps degrading to omitted lines. --> <application+ android:allowBackup="false"+ android:dataExtractionRules="@xml/data_extraction_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher"
logviewer/src/main/res/xml/data_extraction_rules.xml
diff --git a/logviewer/src/main/res/xml/data_extraction_rules.xml b/logviewer/src/main/res/xml/data_extraction_rules.xmlnew file mode 100644index 0000000000..01fc503c3d--- /dev/null+++ b/logviewer/src/main/res/xml/data_extraction_rules.xml@@ -0,0 +1,27 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Deny-all. This is a read-only viewer with no persisted state of its+ own: it reads the live system logcat and tombstones from+ /data/tombstones (outside the app sandbox), and shares snapshots+ from an in-memory cache in BlobProvider that dies with the process.+ The logs it displays are system data that can contain any app's+ output, so they must never be swept into cloud backup or a+ device-transfer copy of the app sandbox either. There is no+ database, SharedPreferences, DataStore, or app-private file to+ restore, so both channels carry nothing, matching+ android:allowBackup="false". -->+<data-extraction-rules>+ <cloud-backup>+ <exclude domain="root" path="." />+ <exclude domain="file" path="." />+ <exclude domain="database" path="." />+ <exclude domain="sharedpref" path="." />+ <exclude domain="external" path="." />+ </cloud-backup>+ <device-transfer>+ <exclude domain="root" path="." />+ <exclude domain="file" path="." />+ <exclude domain="database" path="." />+ <exclude domain="sharedpref" path="." />+ <exclude domain="external" path="." />+ </device-transfer>+</data-extraction-rules>
updater/src/main/res/xml/data_extraction_rules.xml
diff --git a/updater/src/main/res/xml/data_extraction_rules.xml b/updater/src/main/res/xml/data_extraction_rules.xmlindex 81a97e0f26..dc611a7a74 100644--- a/updater/src/main/res/xml/data_extraction_rules.xml+++ b/updater/src/main/res/xml/data_extraction_rules.xml@@ -1,17 +1,36 @@ <?xml version="1.0" encoding="utf-8"?>+<!-- Deny-all. This app holds no user data worth restoring, and+ android:allowBackup="false" already opts it out of cloud backup;+ these rules make the same denial explicit for device transfer.++ Storage audited:+ file/datastore_default.preferences_pb the app's only persisted+ state (UpdaterPreferences via DataStoreUtils): two user toggles+ (auto-install, metered-allowed) mixed in one file with+ device-bound transient state — the build waiting on the+ inactive A/B slot for a reboot, the last check result and its+ timestamp, the artifact name of the partial download, and an+ incremental update_engine already refused. Restoring that file+ on another device would import a pending-reboot claim for a+ slot that does not exist there, so even the toggles are not+ carried: they are two switches to re-set on the new device.+ /data/ota_package/update.zip the staged OTA package, outside the+ app sandbox (update_engine reads it as its own uid); never in+ backup scope.+ No database, no SharedPreferences, no SQLCipher. --> <data-extraction-rules> <cloud-backup>- <include domain="root" path="." />- <include domain="file" path="." />- <include domain="database" path="." />- <include domain="sharedpref" path="." />- <include domain="external" path="." />+ <exclude domain="root" path="." />+ <exclude domain="file" path="." />+ <exclude domain="database" path="." />+ <exclude domain="sharedpref" path="." />+ <exclude domain="external" path="." /> </cloud-backup> <device-transfer>- <include domain="root" path="." />- <include domain="file" path="." />- <include domain="database" path="." />- <include domain="sharedpref" path="." />- <include domain="external" path="." />+ <exclude domain="root" path="." />+ <exclude domain="file" path="." />+ <exclude domain="database" path="." />+ <exclude domain="sharedpref" path="." />+ <exclude domain="external" path="." /> </device-transfer> </data-extraction-rules>
watch/src/main/AndroidManifest.xml
diff --git a/watch/src/main/AndroidManifest.xml b/watch/src/main/AndroidManifest.xmlindex 192879ddaa..55872b0e6a 100644--- a/watch/src/main/AndroidManifest.xml+++ b/watch/src/main/AndroidManifest.xml@@ -19,7 +19,8 @@ android:protectionLevel="signature" /> <application- android:allowBackup="true"+ android:allowBackup="false"+ android:dataExtractionRules="@xml/data_extraction_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher"
watch/src/main/res/xml/data_extraction_rules.xml
diff --git a/watch/src/main/res/xml/data_extraction_rules.xml b/watch/src/main/res/xml/data_extraction_rules.xmlnew file mode 100644index 0000000000..f94cacffed--- /dev/null+++ b/watch/src/main/res/xml/data_extraction_rules.xml@@ -0,0 +1,26 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Deny-all. The conduit holds no persisted user data: ConduitRuntime+ state (link state, registered apps, per-app counters) is in-memory+ only and is re-derived when ConduitService restarts and the watch+ reconnects; streamed payloads pass through cacheDir scratch files,+ which Android never backs up. The Bluetooth bond itself is system+ state, not app data. There is no database, SharedPreferences,+ DataStore, or app-private file to restore, so cloud backup and+ device transfer both carry nothing, matching+ android:allowBackup="false". -->+<data-extraction-rules>+ <cloud-backup>+ <exclude domain="root" path="." />+ <exclude domain="file" path="." />+ <exclude domain="database" path="." />+ <exclude domain="sharedpref" path="." />+ <exclude domain="external" path="." />+ </cloud-backup>+ <device-transfer>+ <exclude domain="root" path="." />+ <exclude domain="file" path="." />+ <exclude domain="database" path="." />+ <exclude domain="sharedpref" path="." />+ <exclude domain="external" path="." />+ </device-transfer>+</data-extraction-rules>