Bugfix: Changes in the automatic uploads algorithm to prevent duplications

The timestamp for automatic uploads is now updated at the beginning of the upload process instead of at the end. Additionally, the filter
used in AutomaticUploadsWorker to select the files to upload has been modified in order to reduce time and charge when evaluating all files.

https://github.com/owncloud/android/issues/3983
https://github.com/owncloud/android/pull/4571
