Refactor uploader so that is more easily testable. Add uploader tests.

Use joda time instead of manual calculations. Add misc tests.

Tested:
  (When ADB emulator or devices connected)
  ./gradlew connectedAndroidTest