adb restore pauses indefinitely when source phone has SD card and target phone has none



  • I ran an adb backup like:

    adb backup -apk -shared -all -nosystem -f /tmp/android-backup.ab
    

    The backup progress screen stopped showing any progress, as did my adb logcat | grep BackupManager. A few minutes later, I ran an unfiltered logcat and found:

    10-27 13:57:59.716  1546 30369 D BackupManagerService: Invoking agent to restore file 1/Download/some.pdf
    10-27 13:57:59.733 16987 16998 W Binder  : Binder call failed.
    10-27 13:57:59.733 16987 16998 W Binder  : java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
    10-27 13:57:59.733 16987 16998 W Binder  :      at com.android.sharedstoragebackup.SharedStorageAgent.onRestoreFile(SharedStorageAgent.java:80)
    10-27 13:57:59.733 16987 16998 W Binder  :      at android.app.backup.BackupAgent$BackupServiceBinder.doRestoreFile(BackupAgent.java:1112)
    10-27 13:57:59.733 16987 16998 W Binder  :      at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:179)
    10-27 13:57:59.733 16987 16998 W Binder  :      at android.os.Binder.execTransact(Binder.java:682)
    10-27 13:57:59.733 16987 16998 D SharedStorageAgent: Shared restore: [ shared : 1/Download/some.pdf]
    10-27 13:57:59.734  1546  8971 V BackupManagerService: opComplete: f86aebb result=0
    

    How can I change my approach so that the restore will work the next time?



  • I have confirmed that some.pdf can be found in the Downloads/ of the SD card of the source phone when connecting over MTP. I believe the ArrayIndexOutOfBoundsException traceback is a very unclear way of saying that there is no SD card on the target phone, where adb restore is trying to push the file.

    I want to save the shared files, but not the ones in the SD card. I don't see any flags in adb shell bu help to do that.

    So it looks like the best solution is to remove the SD card from the source phone, if the target phone does not have an SD card installed.




Suggested Topics