seedvault-app/seedvault

Backup doesn't trigger when USB is plugged in

Opened this issue · 8 comments

When first plugging in a USB used for backup, the backup process will only start when the app is opened, not automatically in the background. This goes against what is said in Seedvault under scheduling, "Backups will be made automatically after you connect your USB drive".

Android version: 14, CalyxOS 5.10.3-2
Method of backup: USB Drive

Logs taken right after opening Seedvault and the backup process started: seedvault-14-4.0-1725061029282.txt

grote commented

I extracted the relevant lines from the log:

08-30 20:36:53.527  1868  2387 D UsbHostManager: USB device attached: vidpid 0781:5595 mfg/product/ver/serial  USB/ SanDisk
08-30 20:36:53.537  1868  2387 D UsbHostManager: Added device UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=1921,mProductId=21909,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName= USB,mProductName= SanDisk 3.2Gen1,mVersion=1.00,mSerialNumberReader=com.android.server.usb.UsbSerialReader@36908d1, mHasAudioPlayback=false, mHasAudioCapture=false, mHasMidi=false, mHasVideoCapture=false, mHasVideoPlayback=false, mConfigurations=[
08-30 20:36:53.537  1868  2387 D UsbHostManager: UsbConfiguration[mId=1,mName=null,mAttributes=128,mMaxPower=112,mInterfaces=[
08-30 20:36:53.537  1868  2387 D UsbHostManager: UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=8,mSubclass=6,mProtocol=80,mEndpoints=[
08-30 20:36:53.537  1868  2387 D UsbHostManager: UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
08-30 20:36:53.537  1868  2387 D UsbHostManager: UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=512,mInterval=0]]]]
08-30 20:36:53.560  1868  1962 I ActivityManager: Start proc 12860:android.process.media/u0a94 for broadcast {com.android.mtp/com.android.mtp.UsbIntentReceiver}
08-30 20:36:53.913  1868  1962 I ActivityManager: Start proc 12924:com.stevesoltys.seedvault/u0a163 for broadcast {com.stevesoltys.seedvault/com.stevesoltys.seedvault.UsbIntentReceiver}
08-30 20:36:54.039 12924 12924 D UsbIntentReceiver: Last backup older than it should be, requesting a backup...
08-30 20:36:54.041 12924 12924 D UsbIntentReceiver:   Thu Aug 29 21:06:16 GMT-03:00 2024
08-30 20:36:59.202 12924 12924 I BackupStateManager: appBackupRunning: false, filesBackupRunning: false, workInfoState: SUCCEEDED
08-30 20:37:05.465  1868  2637 I ActivityManager: Background started FGS: Allowed [callingPackage: com.stevesoltys.seedvault; callingUid: 10163; uidState: TOP ; uidBFSL: [BFSL]; intent: Intent { cmp=com.stevesoltys.seedvault/.storage.StorageBackupService (has extras) }; code:PROC_STATE_TOP; tempAllowListReason:<,reasonCode:SYSTEM_ALLOW_LISTED,duration:9223372036854775807,callingUid:-1>; targetSdkVersion:34; callerTargetSdkVersion:34; startForegroundCount:0; bindFromPackage:null: isBindService:false]
08-30 20:37:05.478 12924 12924 I BackupStateManager: appBackupRunning: false, filesBackupRunning: true, workInfoState: SUCCEEDED
08-30 20:37:05.479 12924 12924 D BackupService: onStartCommand Intent { cmp=com.stevesoltys.seedvault/.storage.StorageBackupService (has extras) } 0 1
08-30 20:37:08.116 12924 13248 D SmallFileBackup: Zip Chunks: 2
08-30 20:37:08.117 12924 13248 E Time    : Backing up 8 small files took 304ms

So this looks like Seedvault is notified of the change and starts a file backup. This is still in progress when the log ends, so no way to know if the app backup afterwards gets triggered as well, but I'd assume so.

When first plugging in a USB used for backup, the backup process will only start when the app is opened, not automatically in the background.

Did you open the app for backup to start in this log?

Did you open the app for backup to start in this log?

Yep. I used the log feature inside Seedvault if that's helpful. I can take another log soon if you'd like me to wait a longer interval before opening Seedvault.

I do notice a few times backups erroring out which I find weird, not sure if its related...

grote commented

Flash drive was plugged in at 20:36:53.527.
Seedvault got informed at 20:36:53.913.
It requested the backup at 20:36:54.041.
Files backup was started at 20:37:05.479.

So between plugging in the drive and starting the backup 12 seconds had passed. In those 12 seconds you had opened the app? Hard to know that it would not have started the backup otherwise.

It has been a while... I don't remember unfortunately.. Usually I see the backup notification showing up right away when I open the app, or at worst 2 seconds later

seedvault-14-4.0-1725374138847.txt

Here I noticed I plugged the drive in, had to open the backup app for it to start "automatically", and in the end it failed and restarted the backup.

seedvault-14-4.0-1725374329368.txt

This was right after the backup that was done as a retry automatically by Seedvault finished

Afterwards, I tried opening the backup app in my work profile, and it did not start automatically even when I opened it.

seedvault-14-4.0-1725374499409.txt