我正在尝试测试Android自动备份。我的设备是7.1版本,并且应用清单包含:android:fullBackupOnly="true"
。当我发出adb shell bmgr backupnow <package>
命令(为了SO帖子,我用占位符替换了我的包名),我看到了一个看起来像是失败的结果:
Running backup for 1 requested packages.
Package @pm@ with result: Success
Package <package> with result: Transport rejected package
Backup finished with result: Success
如果我将清单文件更改为
android:fullBackupOnly="false"
(即使用旧的K/V备份),然后重新发布backupnow
命令,我看到了成功的结果:Running backup for 1 requested packages.
Package @pm@ with result: Success
Package <package> with result: Success
Backup finished with result: Success
在被拒绝的情况下查看Logcat,我看到以下内容:
11-10 09:27:59.660 1683-1683/? D/AndroidRuntime: Calling main entry com.android.commands.bmgr.Bmgr
11-10 09:27:59.669 1035-2498/? V/PerformBackupTask: Beginning backup of 0 targets
11-10 09:27:59.677 1035-2498/? D/PerformBackupTask: invokeAgentForBackup on @pm@
11-10 09:27:59.685 1035-2498/? I/BackupRestoreController: Getting widget state for user: 0
11-10 09:27:59.691 1035-2498/? D/PerformBackupTask: Starting full backups for: [<package>]
11-10 09:27:59.692 1035-2498/? I/BackupManagerService: K/V backup pass finished.
11-10 09:27:59.693 1035-1699/? I/PFTBT: Initiating full-data transport backup of <package>
11-10 09:27:59.695 12554-12566/? I/Backup: [GmsBackupTransport] Attempt to do full backup on <package>
11-10 09:27:59.697 1035-1699/? I/PFTBT: Transport rejected backup of <package>, skipping
11-10 09:27:59.697 1035-1699/? I/PFTBT: Unbinding agent in <package>
11-10 09:27:59.697 1035-1699/? W/ActivityManager: Unbinding backup agent with no active backup
11-10 09:27:59.697 1035-1699/? I/PFTBT: Full backup completed with status: 0
11-10 09:27:59.697 1035-1699/? I/BackupManagerService: Full data backup pass finished.
以下内容为涉及相关行:
11-10 09:27:59.695 12554-12566/? I/Backup: [GmsBackupTransport] Attempt to do full backup on <package>
11-10 09:27:59.697 1035-1699/? I/PFTBT: Transport rejected backup of <package>, skipping
为什么完整/自动备份失败?
以下是成功(K/V)情况下的完整Logcat:
11-10 09:31:21.750 2200-2200/? D/AndroidRuntime: Calling main entry com.android.commands.bmgr.Bmgr
11-10 09:31:21.762 1035-2498/? V/PerformBackupTask: Beginning backup of 1 targets
11-10 09:31:21.768 1035-2498/? D/PerformBackupTask: invokeAgentForBackup on @pm@
11-10 09:31:21.775 1035-2498/? I/BackupRestoreController: Getting widget state for user: 0
11-10 09:31:21.780 1035-2498/? D/PerformBackupTask: starting key/value backup of BackupRequest{pkg= <package>}
11-10 09:31:21.783 1035-2498/? D/BackupManagerService: awaiting agent for ApplicationInfo{b68136a <package>}
11-10 09:31:21.793 1035-1815/? D/BackupManagerService: agentConnected pkg= <package> agent=android.os.BinderProxy@6750684
11-10 09:31:21.793 1035-2498/? I/BackupManagerService: got agent android.app.IBackupAgent$Stub$Proxy@5e82e6d
11-10 09:31:21.793 1035-2498/? D/PerformBackupTask: invokeAgentForBackup on <package>
11-10 09:31:21.796 1908-1920/ <package> D/BackupAgent: onBackup
11-10 09:31:21.796 1908-1920/ <package> D/BackupHelperDispatcher: handling existing helper 'data' <package>.io.DbBackupHelper@35d5ebe
11-10 09:31:21.798 1908-1920/ <package> D/BackupHelperDispatcher: handling existing helper 'prefs' android.app.backup.SharedPreferencesBackupHelper@6936b1f
11-10 09:31:21.800 1035-2498/? I/BackupRestoreController: Getting widget state for user: 0
11-10 09:31:21.805 2200-2200/? D/AndroidRuntime: Shutting down VM
11-10 09:31:21.807 1035-2498/? I/BackupManagerService: K/V backup pass finished.