Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to add a backup rules xml file #2208

Merged
merged 2 commits into from
Aug 31, 2020
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
14 changes: 14 additions & 0 deletions pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@ def make_package(args):
# Folder name for launcher (used by SDL2 bootstrap)
url_scheme = 'kivy'

# Copy backup rules file if specified and update the argument
if args.backup_rules:
res_xml_dir = join(res_dir, 'xml')
ensure_dir(res_xml_dir)
shutil.copy(join(args.private, args.backup_rules), res_xml_dir)
args.backup_rules = split(args.backup_rules)[1][:-4]

# Render out android manifest:
manifest_path = "src/main/AndroidManifest.xml"
render_args = {
Expand Down Expand Up @@ -754,6 +761,13 @@ def parse_args_and_make_package(args=None):
help='Set the launch mode of the main activity in the manifest.')
ap.add_argument('--allow-backup', dest='allow_backup', default='true',
help="if set to 'false', then android won't backup the application.")
ap.add_argument('--backup-rules', dest='backup_rules', default='',
help=('Backup rules for Android Auto Backup. Argument is a '
'filename containing xml. The filename should be '
'located relative to the private directory containing your source code '
'files (containing your main.py entrypoint). '
'See https://developer.android.com/guide/topics/data/'
'autobackup#IncludingFiles for more information'))
ap.add_argument('--no-optimize-python', dest='optimize_python',
action='store_false', default=True,
help=('Whether to compile to optimised .pyo files, using -OO '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
{% if debug %}android:debuggable="true"{% endif %}
android:icon="@drawable/icon"
android:allowBackup="{{ args.allow_backup }}"
{% if args.backup_rules %}android:fullBackupContent="@xml/{{ args.backup_rules }}"{% endif %}
android:theme="{{args.android_apptheme}}{% if not args.window %}.Fullscreen{% endif %}"
android:hardwareAccelerated="true" >
{% for l in args.android_used_libs %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
<application android:label="@string/app_name"
{% if debug %}android:debuggable="true"{% endif %}
android:icon="@drawable/icon"
android:allowBackup="true"
android:allowBackup="{{ args.allow_backup }}"
{% if args.backup_rules %}android:fullBackupContent="@xml/{{ args.backup_rules }}"{% endif %}
android:theme="{{args.android_apptheme}}{% if not args.window %}.Fullscreen{% endif %}"
android:hardwareAccelerated="true" >
{% for l in args.android_used_libs %}
Expand All @@ -72,7 +73,7 @@

{% if service %}
<service android:name="org.kivy.android.PythonService"
android:process=":pythonservice"
android:process=":pythonservice"
android:exported="true"/>
{% endif %}
{% for name in service_names %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
-->
<application android:label="@string/app_name"
android:icon="@drawable/icon"
android:allowBackup="true"
android:allowBackup="{{ args.allow_backup }}"
{% if args.backup_rules %}android:fullBackupContent="@xml/{{ args.backup_rules }}"{% endif %}
android:theme="{{args.android_apptheme}}{% if not args.window %}.Fullscreen{% endif %}"
android:hardwareAccelerated="true"
android:usesCleartextTraffic="true"
Expand Down