Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

Limit number of file transfer

Vincent Bourgmayer requested to merge 305-o-limitTransferTrial into v1-oreo

Description

Limit number of file transfer until next reboot

Issue(s)

https://gitlab.e.foundation/e/os/backlog/-/issues/305

Test procedures

  • Generate a big file (video is good example)
  • let upload start. check sync is started: adb logcat | grep "SynchronizationService"
logcat example
vincent@Multivac:~/Sources/eDrive$ adb logcat | grep "SynchronizationService"
05-16 17:23:49.910  1877  1877 D FileEventListener: bindToSynchronizationService()
05-16 17:23:50.075  1877  1877 D SynchronizationService: onStartCommand()
05-16 17:23:50.211  1877  1877 I SynchronizationServiceConnection: onServiceConnected: binding to SynchronizationService
05-16 17:42:10.473  1877  1877 I SynchronizationServiceConnection: onServiceConnected: binding to SynchronizationService
05-16 17:43:25.623  1877  1877 D SynchronizationService: startAllThreads
05-16 17:43:25.634  1877  1877 V SynchronizationService:  starts IMG_20220508_213221.jpg UPLOAD on thread 0
05-16 17:43:25.639  1877  1877 V SynchronizationService:  starts IMG_20220508_222458.jpg UPLOAD on thread 1
05-16 17:43:25.645  1877  1877 V SynchronizationService:  starts VID_20220516_171645.mp4 UPLOAD on thread 2
  • turn off network to generate failure
  • check sharedPreferences in eDrive folder (root access required) : adb pull data/user/0/foundation.e.drive/shared_prefs/ data/user/0/foundation.e.drive/shared_prefs/failed_transfer.xml
expected result:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <int name="/storage/emulated/0/DCIM/OpenCamera/IMG_20220508_222458.jpg" value="1" />
    <int name="/storage/emulated/0/DCIM/OpenCamera/VID_20220516_171645.mp4" value="1" />
    <int name="/storage/emulated/0/DCIM/OpenCamera/IMG_20220508_213221.jpg" value="1" />
</map>
  • turn on network (wifi)

  • force sync restart with adb broadcast to make sync try again. adb shell am broadcast -a foundation.e.drive.action.FORCE_SYNC

  • turn off network to increase number.

  • Repeat this until trial reach 3. Then try a last one time, file shouldn't be sync.

examples
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <int name="/storage/emulated/0/DCIM/OpenCamera/IMG_20220508_222458.jpg" value="2" />
    <int name="/storage/emulated/0/DCIM/OpenCamera/VID_20220516_171645.mp4" value="2" />
    <int name="/storage/emulated/0/DCIM/OpenCamera/IMG_20220508_213221.jpg" value="2" />
</map>

then

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <int name="/storage/emulated/0/DCIM/OpenCamera/IMG_20220508_222458.jpg" value="3" />
    <int name="/storage/emulated/0/DCIM/OpenCamera/VID_20220516_171645.mp4" value="3" />
    <int name="/storage/emulated/0/DCIM/OpenCamera/IMG_20220508_213221.jpg" value="3" />
</map>
  • now reboot the device. Check sharedPreferences, it must be empty (the file for failure counter)
  • force sync: it should happen

Check list

  • Self review
  • Self tested
  • code review
Edited by Vincent Bourgmayer

Merge request reports

Loading