Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
<application
android:label="Zulip"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:fullBackupContent="@xml/full_backup_content"
android:dataExtractionRules="@xml/data_extraction_rules"
>
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
47 changes: 47 additions & 0 deletions android/app/src/main/res/xml/data_extraction_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Exclude all data from device backup. For motivation, see:
https://github.com/zulip/zulip-flutter/issues/2158
https://github.com/zulip/zulip-flutter/issues/2159
The data that's essential to exclude is in our database,
at `domain="file" path="zulip.db"`. But once that's excluded,
including any stray other data would at best cause a confusing
mixed state, if it has any effect at all. So exclude it all.

Docs for this file:
https://developer.android.com/identity/data/autobackup#include-exclude-android-12
-->
<data-extraction-rules>
<cloud-backup>
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
<exclude domain="root" />
<exclude domain="device_file" />
<exclude domain="device_database" />
<exclude domain="device_sharedpref" />
<exclude domain="device_root" />
</cloud-backup>
<device-transfer>
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
<exclude domain="root" />
<exclude domain="device_file" />
<exclude domain="device_database" />
<exclude domain="device_sharedpref" />
<exclude domain="device_root" />
</device-transfer>
<cross-platform-transfer platform="ios">
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
<exclude domain="root" />
<exclude domain="device_file" />
<exclude domain="device_database" />
<exclude domain="device_sharedpref" />
<exclude domain="device_root" />
</cross-platform-transfer>
</data-extraction-rules>
29 changes: 29 additions & 0 deletions android/app/src/main/res/xml/full_backup_content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Exclude all data from device backup.
For background, see `data_extraction_rules.xml`.

It's not clear this file has any effect: for Android 12 and up,
the `data_extraction_rules.xml` file
(`android:dataExtractionRules` in the manifest)
is supposed to take precedence.
And for Android 11 and older, the `android:allowBackup="false"`
which we also set is supposed to prevent backups completely.

But including this extra file is cheap. And from experience,
we don't trust Android's documentation to be 100% accurate;
maybe there's some situation where it helps after all.

Docs for this file:
https://developer.android.com/identity/data/autobackup#include-exclude-android-11
-->
<full-backup-content>
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
<exclude domain="root" />
<exclude domain="device_file" />
<exclude domain="device_database" />
<exclude domain="device_sharedpref" />
<exclude domain="device_root" />
</full-backup-content>