I'm trying to add backup support to my app, and have set up a subclass of BackupAgentHelper as described in the Data Backup guide. I've compared my code to several other tutorials and SO posts and don't see any problems here:
public class MyBackupClass extends BackupAgentHelper {
public App app;
@Override
public void onCreate() {
Log.d("MyBackupClass", "** onCreate **");
// get the application delegate for convenience
this.app = (App)this.getApplicationContext();
// add the backup helpers
this.addHelpers();
}
public void addHelpers() {
Log.d("MyBackupClass", "** addHelpers **");
String name = "Sample Database";
// add a helper for the default shared preferences
String defaultSharedPrefsName = this.getPackageName() + "_preferences";
SharedPreferencesBackupHelper defaultPrefsHelper = new SharedPreferencesBackupHelper(this, defaultSharedPrefsName);
addHelper("default_prefs", defaultPrefsHelper);
// add a helper for the shared preferences
SharedPreferencesBackupHelper prefsHelper = new SharedPreferencesBackupHelper(this, name);
addHelper(name + "_prefs", prefsHelper);
// add a helper for the data file
FileBackupHelper dataHelper = new FileBackupHelper(this, name);
addHelper(name + "_data", dataHelper);
}
@Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) throws IOException {
// hold the lock while the FileBackupHelper performs the backup
synchronized (this.app.database.fileLock) {
Log.d("MyBackupClass", "** onBackup **");
super.onBackup(oldState, data, newState);
}
}
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
// hold the lock while the FileBackupHelper restores the file
synchronized (this.app.database.fileLock) {
Log.d("MyBackupClass", "** onRestore **");
super.onRestore(data, appVersionCode, newState);
}
}
}
I'm also running new BackupManager(this.app).dataChanged()
whenever I save data.
On a device that's logged into a Google Play account and with the backup and restore options enabled in the device settings, I run ./adb -d shell bmgr run
and get this result in the logcat:
D/AndroidRuntime( 3828):
D/AndroidRuntime( 3828): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 3828): CheckJNI is OFF
D/dalvikvm( 3828): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 3828): Added shared lib libjavacore.so 0x0
D/dalvikvm( 3828): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 3828): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 3828): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 3828): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 3828): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 3828): failed to load memtrack module: -2
D/AndroidRuntime( 3828): Calling main entry com.android.commands.bmgr.Bmgr
V/BackupManagerService( 433): Scheduling immediate backup pass
D/AndroidRuntime( 3828): Shutting down VM
D/dalvikvm( 3828): Debugger has detached; object registry had 1 entries
V/BackupManagerService( 433): Running a backup pass
V/BackupManagerService( 433): clearing pending backups
V/PerformBackupTask( 433): Beginning backup of 2 targets
V/BackupServiceBinder( 433): doBackup() invoked
D/PerformBackupTask( 433): invokeAgentForBackup on @pm@
I/PerformBackupTask( 433): no backup data written; not calling transport
D/PerformBackupTask( 433): starting agent for backup of BackupRequest{pkg=android}
D/BackupManagerService( 433): awaiting agent for ApplicationInfo{4196f698 android}
D/BackupManagerService( 433): agentConnected pkg=android agent=android.app.backup.BackupAgent$BackupServiceBinder@4203c550
I/BackupManagerService( 433): got agent android.app.backup.BackupAgent$BackupServiceBinder@4203c550
V/BackupServiceBinder( 433): doBackup() invoked
D/BackupHelperDispatcher( 433): handling existing helper 'wallpaper' android.app.backup.WallpaperBackupHelper@4226bb08
D/PerformBackupTask( 433): invokeAgentForBackup on android
D/PerformBackupTask( 433): starting agent for backup of BackupRequest{pkg=com.arlomedia.myapp}
D/BackupManagerService( 433): awaiting agent for ApplicationInfo{41e916b0 com.arlomedia.myapp}
D/MyBackupClass ( 3779): ** onCreate **
D/MyBackupClass ( 3779): ** addHelpers **
D/BackupManagerService( 433): agentConnected pkg=com.arlomedia.myapp agent=android.os.BinderProxy@41e45118
I/BackupManagerService( 433): got agent android.app.IBackupAgent$Stub$Proxy@421a63e8
V/BackupServiceBinder( 3779): doBackup() invoked
D/MyBackupClass ( 3779): ** onBackup **
D/BackupHelperDispatcher( 3779): handling new helper 'Sample Database_data'
D/PerformBackupTask( 433): invokeAgentForBackup on com.arlomedia.myapp
D/BackupHelperDispatcher( 3779): handling new helper 'Sample Database_prefs'
D/BackupHelperDispatcher( 3779): handling new helper 'default_prefs'
I/PerformBackupTask( 433): Backup pass finished.
The parts about handling the helpers I set up, and the "backup pass finished" seem to indicate that the backup is working. Then, I uninstall the app and reinstall it with ./adb -d install
and get the following result:
D/AndroidRuntime( 3875): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 3875): CheckJNI is OFF
D/dalvikvm( 3875): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 3875): Added shared lib libjavacore.so 0x0
D/dalvikvm( 3875): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 3875): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 3875): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 3875): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 3875): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 3875): failed to load memtrack module: -2
D/AndroidRuntime( 3875): Calling main entry com.android.commands.pm.Pm
D/Finsky (23657): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 142
W/ActivityManager( 433): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
D/Finsky (23657): [1] WorkerTask.onPreExecute: Verification Requested for id = 142, data=file:///data/local/tmp/app-debug.apk flags=112 fromVerificationActivity=false
D/dalvikvm(23657): GC_CONCURRENT freed 1940K, 21% free 8146K/10228K, paused 2ms+1ms, total 34ms
D/dalvikvm(23657): GC_FOR_ALLOC freed 993K, 21% free 8130K/10228K, paused 23ms, total 24ms
D/dalvikvm(23657): GC_FOR_ALLOC freed 980K, 21% free 8136K/10228K, paused 23ms, total 23ms
D/dalvikvm(23657): GC_FOR_ALLOC freed 1051K, 20% free 8208K/10228K, paused 23ms, total 23ms
I/qtaguid (23657): Failed write_ctrl(u 74) res=-1 errno=22
I/qtaguid (23657): Untagging socket 74 failed errno=-22
W/NetworkManagementSocketTagger(23657): untagSocket(74) failed with errno -22
D/Finsky (23657): [1] 2.onResponse: Verification id=142 response=0
D/Finsky (23657): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 142
W/ActivityManager( 433): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
I/PackageManager( 433): Copying native libraries to /data/app-lib/vmdl-2084848498
D/dalvikvm( 433): GC_CONCURRENT freed 2945K, 34% free 14565K/21864K, paused 4ms+6ms, total 62ms
D/dalvikvm( 433): WAIT_FOR_CONCURRENT_GC blocked 14ms
D/dalvikvm( 433): WAIT_FOR_CONCURRENT_GC blocked 14ms
D/dalvikvm( 433): WAIT_FOR_CONCURRENT_GC blocked 46ms
I/PackageManager( 433): Running dexopt on: com.arlomedia.myapp
D/dalvikvm( 3888): DexOpt: load 64ms, verify+opt 570ms, 2417268 bytes
D/Finsky (23657): [1] 5.onFinished: Installation state replication succeeded.
I/ActivityManager( 433): Force stopping com.arlomedia.myapp appid=10140 user=-1: update pkg
V/BackupManagerService( 433): restoreAtInstall pkg=com.arlomedia.myapp token=8f restoreSet=3c51dd81eebd5a3d
D/BackupManagerService( 433): MSG_RUN_RESTORE observer=null
V/BackupServiceBinder( 433): doRestore() invoked
D/BackupManagerService( 433): initiateOneRestore packageName=@pm@
V/BackupManagerService( 433): Package com.arlomedia.myapp restore version [25] is compatible with installed version [25]
I/ActivityManager( 433): Start proc com.arlomedia.myapp for backup com.arlomedia.myapp/.helpers.Backups: pid=3889 uid=10140 gids={50140, 3003, 1028, 1015}
D/dalvikvm( 3889): Late-enabling CheckJNI
D/BackupManagerService( 433): awaiting agent for ApplicationInfo{4226acf0 com.arlomedia.myapp}
D/MyBackupClass ( 3779): ** onCreate **
D/MyBackupClass ( 3779): ** addHelpers **
D/BackupManagerService( 433): agentConnected pkg=com.arlomedia.myapp agent=android.os.BinderProxy@423dd558
I/BackupManagerService( 433): got agent android.app.IBackupAgent$Stub$Proxy@41d66818
D/BackupManagerService( 433): initiateOneRestore packageName=com.arlomedia.myapp
V/BackupServiceBinder( 3889): doRestore() invoked
D/MyBackupClass ( 3779): ** onRestore **
D/backup_data( 3889): SKIP_PADDING FAILED at line 332
V/BackupManagerService( 433): No next package, finishing restore
I/BackupManagerService( 433): Restore complete.
The parts about "restore version is compatible" and "restore complete" look promising, but no data is restored. I see the error "SKIP_PADDING FAILED," but I don't know if that's relevant to what I'm doing or how to fix it if it is.
I also tried this with an emulator using the local transport. Running the backup manager gives this result:
D/AndroidRuntime( 5503):
D/AndroidRuntime( 5503): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
W/linker ( 5503): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/AndroidRuntime( 5503): CheckJNI is ON
D/dalvikvm( 5503): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 5503): Added shared lib libjavacore.so 0x0
D/dalvikvm( 5503): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 5503): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 5503): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 5503): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 5503): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 5503): failed to load memtrack module: -2
D/AndroidRuntime( 5503): Calling main entry com.android.commands.bmgr.Bmgr
V/BackupServiceBinder( 1276): doBackup() invoked
V/BackupManagerService( 1276): Scheduling immediate backup pass
V/BackupManagerService( 1276): Running a backup pass
V/BackupManagerService( 1276): clearing pending backups
V/PerformBackupTask( 1276): Beginning backup of 2 targets
D/PerformBackupTask( 1276): invokeAgentForBackup on @pm@
I/PerformBackupTask( 1276): no backup data written; not calling transport
D/PerformBackupTask( 1276): starting agent for backup of BackupRequest{pkg=android}
D/BackupManagerService( 1276): awaiting agent for ApplicationInfo{b10042c8 android}
V/BackupServiceBinder( 1276): doBackup() invoked
D/BackupHelperDispatcher( 1276): handling existing helper 'wallpaper' android.app.backup.WallpaperBackupHelper@b12f0e70
V/LocalTransport( 1276): performBackup() pkg=android
V/LocalTransport( 1276): Got change set key=wallpaper:/data/system/wallpaper_info.xml size=-1 key64=d2FsbHBhcGVyOi9kYXRhL3N5c3RlbS93YWxscGFwZXJfaW5mby54bWw=
V/LocalTransport( 1276): Got change set key=wallpaper:/data/system/wallpaper_info.xml size=115 key64=d2FsbHBhcGVyOi9kYXRhL3N5c3RlbS93YWxscGFwZXJfaW5mby54bWw=
V/LocalTransport( 1276): data size 115
V/LocalTransport( 1276): finishBackup()
D/MyBackupClass ( 3779): ** onCreate **
D/MyBackupClass ( 3779): ** addHelpers **
V/BackupServiceBinder( 5427): doBackup() invoked
D/MyBackupClass ( 3779): ** onBackup **
D/BackupHelperDispatcher( 5427): handling new helper 'Sample Database_data'
D/BackupHelperDispatcher( 5427): handling new helper 'Sample Database_prefs'
D/BackupHelperDispatcher( 5427): handling new helper 'default_prefs'
V/LocalTransport( 1276): performBackup() pkg=com.arlomedia.myapp
V/LocalTransport( 1276): Got change set key=Sample Database_data:Sample Database size=1755 key64=U2FtcGxlIERhdGFiYXNlX2RhdGE6U2FtcGxlIERhdGFiYXNl
V/LocalTransport( 1276): data size 1755
V/LocalTransport( 1276): Got change set key=Sample Database_prefs:Sample Database size=4186 key64=U2FtcGxlIERhdGFiYXNlX3ByZWZzOlNhbXBsZSBEYXRhYmFzZQ==
V/LocalTransport( 1276): data size 4186
V/LocalTransport( 1276): Got change set key=default_prefs:com.arlomedia.myapp_preferences size=356 key64=ZGVmYXVsdF9wcmVmczpjb20uYXJsb21lZGlhLnNldGxpc3RtYWtlcl9wcmVmZXJlbmNlcw==
V/LocalTransport( 1276): data size 356
V/LocalTransport( 1276): finishBackup()
D/BackupManagerService( 1276): agentConnected pkg=android agent=android.app.backup.BackupAgent$BackupServiceBinder@b1382ba0
I/BackupManagerService( 1276): got agent android.app.backup.BackupAgent$BackupServiceBinder@b1382ba0
D/PerformBackupTask( 1276): invokeAgentForBackup on android
D/PerformBackupTask( 1276): starting agent for backup of BackupRequest{pkg=com.arlomedia.myapp}
D/BackupManagerService( 1276): awaiting agent for ApplicationInfo{b158e9a8 com.arlomedia.myapp}
D/BackupManagerService( 1276): agentConnected pkg=com.arlomedia.myapp agent=android.os.BinderProxy@b13cdbf0
I/BackupManagerService( 1276): got agent android.app.IBackupAgent$Stub$Proxy@b13ad550
D/PerformBackupTask( 1276): invokeAgentForBackup on com.arlomedia.myapp
I/PerformBackupTask( 1276): Backup pass finished.
D/AndroidRuntime( 5503): Shutting down VM
D/dalvikvm( 5503): Debugger has detached; object registry had 1 entries
I/AndroidRuntime( 5503): NOTE: attach of thread 'Binder_1' failed
And reinstalling gives this result:
D/AndroidRuntime( 5530):
D/AndroidRuntime( 5530): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
W/linker ( 5530): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/AndroidRuntime( 5530): CheckJNI is ON
D/dalvikvm( 5530): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 5530): Added shared lib libjavacore.so 0x0
D/dalvikvm( 5530): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 5530): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 5530): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 5530): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 5530): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 5530): failed to load memtrack module: -2
D/AndroidRuntime( 5530): Calling main entry com.android.commands.pm.Pm
W/ActivityManager( 1276): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
W/ActivityManager( 1276): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
I/PackageManager( 1276): Copying native libraries to /data/app-lib/vmdl2051152188
D/dalvikvm( 1276): GC_FOR_ALLOC freed 1352K, 21% free 7636K/9604K, paused 6ms, total 8ms
D/dalvikvm( 1276): GC_FOR_ALLOC freed 1002K, 19% free 7834K/9604K, paused 66ms, total 66ms
D/dalvikvm( 1276): GC_FOR_ALLOC freed 947K, 19% free 7840K/9604K, paused 7ms, total 7ms
D/dalvikvm( 1276): GC_FOR_ALLOC freed 946K, 19% free 7848K/9604K, paused 9ms, total 10ms
I/PackageManager( 1276): Running dexopt on: com.arlomedia.myapp
W/linker ( 5542): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/dalvikvm( 5542): DexOpt: load 15ms, verify+opt 149ms, 2414236 bytes
I/ActivityManager( 1276): Force stopping com.arlomedia.myapp appid=10067 user=-1: update pkg
W/PackageManager( 1276): Unknown permission com.android.vending.CHECK_LICENSE in package com.arlomedia.myapp
W/PackageManager( 1276): Unknown permission com.android.vending.BILLING in package com.arlomedia.myapp
V/LocalTransport( 1276): start restore 1
V/LocalTransport( 1276): nextRestorePackage() = @pm@
V/LocalTransport( 1276): getRestoreData() found 10 key files
V/LocalTransport( 1276): ... key=@meta@ size=0
V/LocalTransport( 1276): ... key=com.android.calendar size=0
V/LocalTransport( 1276): ... key=com.android.browser size=0
V/LocalTransport( 1276): ... key=com.android.providers.userdictionary size=0
V/LocalTransport( 1276): ... key=com.android.sharedstoragebackup size=0
V/LocalTransport( 1276): ... key=android size=0
V/LocalTransport( 1276): ... key=com.android.dialer size=0
V/LocalTransport( 1276): ... key=com.android.providers.settings size=0
V/LocalTransport( 1276): ... key=com.arlomedia.myapp size=635
V/LocalTransport( 1276): ... key=com.arlomedia.myotherapp size=635
V/BackupServiceBinder( 1276): doRestore() invoked
D/BackupServiceBinder( 1276): onRestore (com.android.server.PackageManagerBackupAgent) threw
D/BackupServiceBinder( 1276): java.io.EOFException
D/BackupServiceBinder( 1276): at libcore.io.Streams.readFully(Streams.java:83)
D/BackupServiceBinder( 1276): at java.io.DataInputStream.readInt(DataInputStream.java:103)
D/BackupServiceBinder( 1276): at com.android.server.PackageManagerBackupAgent.onRestore(PackageManagerBackupAgent.java:273)
D/BackupServiceBinder( 1276): at android.app.backup.BackupAgent$BackupServiceBinder.doRestore(BackupAgent.java:599)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.initiateOneRestore(BackupManagerService.java:4842)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.restorePmMetadata(BackupManagerService.java:4595)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.execute(BackupManagerService.java:4453)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$BackupHandler.handleMessage(BackupManagerService.java:573)
D/BackupServiceBinder( 1276): at android.os.Handler.dispatchMessage(Handler.java:102)
D/BackupServiceBinder( 1276): at android.os.Looper.loop(Looper.java:136)
D/BackupServiceBinder( 1276): at android.os.HandlerThread.run(HandlerThread.java:61)
V/LocalTransport( 1276): nextRestorePackage() = com.arlomedia.myapp
V/LocalTransport( 1276): no more packages to restore
V/LocalTransport( 1276): finishRestore()
V/BackupManagerService( 1276): restoreAtInstall pkg=com.arlomedia.myapp token=17 restoreSet=1
D/BackupManagerService( 1276): MSG_RUN_RESTORE observer=null
D/BackupManagerService( 1276): initiateOneRestore packageName=@pm@
E/BackupManagerService( 1276): Unable to call app for restore: @pm@
E/BackupManagerService( 1276): java.lang.RuntimeException: java.io.EOFException
E/BackupManagerService( 1276): at android.app.backup.BackupAgent$BackupServiceBinder.doRestore(BackupAgent.java:602)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.initiateOneRestore(BackupManagerService.java:4842)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.restorePmMetadata(BackupManagerService.java:4595)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.execute(BackupManagerService.java:4453)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$BackupHandler.handleMessage(BackupManagerService.java:573)
E/BackupManagerService( 1276): at android.os.Handler.dispatchMessage(Handler.java:102)
E/BackupManagerService( 1276): at android.os.Looper.loop(Looper.java:136)
E/BackupManagerService( 1276): at android.os.HandlerThread.run(HandlerThread.java:61)
E/BackupManagerService( 1276): Caused by: java.io.EOFException
E/BackupManagerService( 1276): at libcore.io.Streams.readFully(Streams.java:83)
E/BackupManagerService( 1276): at java.io.DataInputStream.readInt(DataInputStream.java:103)
E/BackupManagerService( 1276): at com.android.server.PackageManagerBackupAgent.onRestore(PackageManagerBackupAgent.java:273)
E/BackupManagerService( 1276): at android.app.backup.BackupAgent$BackupServiceBinder.doRestore(BackupAgent.java:599)
E/BackupManagerService( 1276): ... 7 more
W/BackupManagerService( 1276): Tried to clear data for @pm@ but not found
E/BackupManagerService( 1276): No restore metadata available, so not restoring settings
W/PMBA ( 1276): getRestoredMetadata() before metadata read!
E/BackupManagerService( 1276): Missing metadata for com.arlomedia.myapp
V/BackupManagerService( 1276): No next package, finishing restore
I/BackupManagerService( 1276): Restore complete.
In this case, the backup process shows the size of the data backed up, which is even more promising, but then the restore process crashes with an EOFException and I don't know how to fix that. Again, nothing is restored.
Ultimately I only need this to work on real devices, but I'm posting the results from the emulator in case it provides any clues.
Can anyone help me interpret these logs to find out what's wrong?
I'd also appreciate a quick comment saying whether or not you've gotten this system to work, because several SO threads are unanswered or have concluded that the system just doesn't work.
Update
After studying these logs further, it seems there are no relevant errors while backing up from the device or the emulator, but there is a different error thrown at a critical point while restoring each of them -- SKIP_PADDING FAILED on the device and EOFException on the emulator. SKIP_PADDING FAILED is mentioned in these two unanswered questions:
backup_data: SKIP_PADDING FAILED at line X
I tried reading the source code for SKIP_PADDING FAILED, but couldn't understand what it was doing. Next I added this code to my onRestore method to see whether the BackupDataInput object contains my data:
while (data.readNextHeader()) {
String key = data.getKey();
int dataSize = data.getDataSize();
byte[] buffer = new byte[dataSize];
data.readEntityData(buffer, 0, dataSize);
Log.d("Backups", "restoring key " + key);
Log.d("Backups", "restoring data size " + dataSize);
Log.d("Backups", "restoring data " + new String(buffer, "UTF-8"));
}
It does! So now I can see that my data is getting backed up, but something in BackupAgent.performRestore (which is called by BackupAgentHelper.onRestore) is breaking. I think I could work around that by saving the data files myself in the onRestore method. Does anyone have a better solution?
I came back to this after a week, tried again and now the backups are restoring. I haven't been able to identify anything I'm doing differently now, so I can't offer a solution to whatever problem was happening before. But now that it's working, I can clarify a few things about the Android backup service: