From e6616a8c36383aaeb5d92dcf11e4cea5fae0baa6 Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Wed, 14 Sep 2022 15:21:40 -0300
Subject: [PATCH] Exclude all files from D2D transfers

---
 briar-android/src/main/AndroidManifest.xml    |  1 +
 .../main/res/xml/backup_extraction_rules.xml  | 37 +++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 briar-android/src/main/res/xml/backup_extraction_rules.xml

diff --git a/briar-android/src/main/AndroidManifest.xml b/briar-android/src/main/AndroidManifest.xml
index 3518fe872e..96e2cb1789 100644
--- a/briar-android/src/main/AndroidManifest.xml
+++ b/briar-android/src/main/AndroidManifest.xml
@@ -40,6 +40,7 @@
 		android:name="org.briarproject.briar.android.BriarApplicationImpl"
 		android:allowBackup="false"
 		android:banner="@mipmap/tv_banner"
+		android:dataExtractionRules="@xml/backup_extraction_rules"
 		android:fullBackupContent="@xml/backup_rules"
 		android:icon="@mipmap/ic_launcher_round"
 		android:label="@string/app_name"
diff --git a/briar-android/src/main/res/xml/backup_extraction_rules.xml b/briar-android/src/main/res/xml/backup_extraction_rules.xml
new file mode 100644
index 0000000000..c03286ff83
--- /dev/null
+++ b/briar-android/src/main/res/xml/backup_extraction_rules.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-extraction-rules>
+	<cloud-backup disableIfNoEncryptionCapabilities="true">
+		<!-- docs: https://developer.android.com/guide/topics/data/autobackup#XMLSyntax -->
+		<exclude
+			domain="root"
+			path="." />
+		<!-- the previous entry should exclude things recursively, but we add more just to be sure -->
+		<exclude
+			domain="root"
+			path="app_db" />
+		<exclude
+			domain="root"
+			path="app_key" />
+		<!-- we don't use domain=file (getFilesDir()), but ApplicationInfo#dataDir -->
+		<exclude
+			domain="sharedpref"
+			path="." />
+	</cloud-backup>
+	<device-transfer>
+		<!-- docs: https://developer.android.com/guide/topics/data/autobackup#XMLSyntax -->
+		<exclude
+			domain="root"
+			path="." />
+		<!-- the previous entry should exclude things recursively, but we add more just to be sure -->
+		<exclude
+			domain="root"
+			path="app_db" />
+		<exclude
+			domain="root"
+			path="app_key" />
+		<!-- we don't use domain=file (getFilesDir()), but ApplicationInfo#dataDir -->
+		<exclude
+			domain="sharedpref"
+			path="." />
+	</device-transfer>
+</data-extraction-rules>
-- 
GitLab