Android 12: Backup and restore - New format for the XML configuration #16699
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #16067
This PR adds backup configuration xml in the new format for apps targetting Android 12. The old configuration is still required for devices running Android 11 or lower, hence renamed and retained.
Testing instructions
targetSdkVersion
to 31 inbuild.gradle
.vanillaDebug
.adb shell bmgr enabled
. If not, enable it fromSettings
>Google
->Backup
.wordpress
database
andorg.wordpress.android_preferences.xml
sharedprefs
file is generated).To verify their existence, check the contents of the directory
/data/data/org.wordpress.android/shared_prefs
and confirm the existence of the fileorg.wordpress.android_preferences.xml
, similarly check/data/data/org.wordpress.android/databases
and confirm the existence of the filewordpress
(you can use the tab "Device File Explorer" from Android Studio for this).adb shell bmgr backupnow org.wordpress.android
./data/data/org.wordpress.android/shared_prefs
and/data/data/org.wordpress.android/databases
.adb shell dumpsys backup
and grab the token of theCurrent
section.adb shell bmgr restore {token} org.wordpress.android
where the token is from the last step./data/data/org.wordpress.android/shared_prefs
and confirm that the fileorg.wordpress.android_preferences.xml
is restored./data/data/org.wordpress.android/databases
and confirm that the filewordpress
is restored.For more details on the testing steps, check the official guide: https://developer.android.com/guide/topics/data/testingbackup
P.S. You may see a transport error on step 5. This section can help in troubleshooting common issues.
The first time I ran the backup command, I got this error:
Transport rejected package because it wasn't able to process it at the time
.The issue was resolved on trying after few hours.
Regression Notes
Potential unintended areas of impact
N/A
What I did to test those areas of impact (or what existing automated tests I relied on)
N/A
What automated tests I added (or what prevented me from doing so)
N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.