Android tests

This is some of my work from when I was working on this app by myself. I am still working on cleaning up the test suite, but thought that these commits should be merged into the devel branch for the rest of you to have access to. There is no corresponding ticket for this pull request since it includes several loosely related changes to the code.