fix(learn): nothing of Learn's goes to Android's backup or to another phone (ADR 0019, D9)
The device keeps private studysets open in its database, which Android's backup (Google's, or Seedvault where turned on) and a transfer to a new phone took open. allowBackup and fullBackupContent are off, and from Android 12 on the data extraction rules exclude every folder from the transfer too, which allowBackup alone no longer stops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
f47c2767a3
commit
0ec15d2fb2
3 changed files with 116 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- The app syncs with its server: release builds need this too (Flutter's
|
||||
template grants it to debug and profile builds only). -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
|
@ -15,10 +16,18 @@
|
|||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" android:maxSdkVersion="32"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<!-- Nothing of Learn's goes to Android's backup or to another phone (ADR 0019,
|
||||
D9): the device keeps private studysets open in its database. allowBackup
|
||||
and fullBackupContent stop both through Android 11; from 12 on the backup
|
||||
alone, and the rules stop the transfer. -->
|
||||
<application
|
||||
android:label="Halkyon Learn"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:allowBackup="false"
|
||||
android:fullBackupContent="false"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
tools:targetApi="s">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Nothing of Learn's goes to a backup or to another phone, from Android 12
|
||||
on (ADR 0019, D9): allowBackup="false" stops the backup, and only these
|
||||
rules stop the transfer. What Learn keeps open stays on this phone;
|
||||
what is sealed comes back from the instance on the next. -->
|
||||
<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="."/>
|
||||
<exclude domain="device_root" path="."/>
|
||||
<exclude domain="device_file" path="."/>
|
||||
<exclude domain="device_database" path="."/>
|
||||
<exclude domain="device_sharedpref" 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="."/>
|
||||
<exclude domain="device_root" path="."/>
|
||||
<exclude domain="device_file" path="."/>
|
||||
<exclude domain="device_database" path="."/>
|
||||
<exclude domain="device_sharedpref" path="."/>
|
||||
</device-transfer>
|
||||
</data-extraction-rules>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
/// Nothing of Learn's leaves the phone by Android's backup or a transfer to
|
||||
/// another phone (ADR 0019, D9): what the device keeps of a private
|
||||
/// studyset is open in its database, and would go there open; what is
|
||||
/// sealed comes back from the instance anyway.
|
||||
void main() {
|
||||
final manifest = File(
|
||||
'android/app/src/main/AndroidManifest.xml',
|
||||
).readAsStringSync();
|
||||
final application = RegExp(
|
||||
'<application[^>]*>',
|
||||
).firstMatch(manifest)!.group(0)!;
|
||||
|
||||
test('backup is off, through Android 11 as from 12 on', () {
|
||||
expect(application, contains('android:allowBackup="false"'));
|
||||
expect(application, contains('android:fullBackupContent="false"'));
|
||||
expect(
|
||||
application,
|
||||
contains('android:dataExtractionRules="@xml/data_extraction_rules"'),
|
||||
);
|
||||
});
|
||||
|
||||
test('from Android 12 on, neither a backup nor a transfer takes any of the '
|
||||
"app's folders", () {
|
||||
// allowBackup="false" leaves a transfer to another phone on from
|
||||
// Android 12 on: the rules have to exclude it too, folder by folder.
|
||||
final rules = File(
|
||||
'android/app/src/main/res/xml/data_extraction_rules.xml',
|
||||
).readAsStringSync();
|
||||
for (final kind in ['cloud-backup', 'device-transfer']) {
|
||||
final section = RegExp(
|
||||
'<$kind>(.*?)</$kind>',
|
||||
dotAll: true,
|
||||
).firstMatch(rules)?.group(1);
|
||||
expect(section, isNotNull, reason: '$kind is missing');
|
||||
final excluded = {
|
||||
for (final match in RegExp(
|
||||
r'<exclude domain="(\w+)" path="\."\s*/>',
|
||||
).allMatches(section!))
|
||||
match.group(1),
|
||||
};
|
||||
expect(excluded, {
|
||||
'root',
|
||||
'file',
|
||||
'database',
|
||||
'sharedpref',
|
||||
'external',
|
||||
'device_root',
|
||||
'device_file',
|
||||
'device_database',
|
||||
'device_sharedpref',
|
||||
}, reason: '$kind excludes');
|
||||
expect(section, isNot(contains('<include')), reason: kind);
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue