Fix 265 database locked crash (I'm pretty sure)
Previously, all of the various subclasses of FDroidProvider would create
their own database open helper in their respective onCreate()
methods.
This seemed to be the cause of the multiple database locked exceptions.
Various online articles/SO posts/etc helped come to this conclusion:
- http://stackoverflow.com/a/3689883
- http://stackoverflow.com/a/8888606
- https://web.archive.org/web/20150709074733/http://www.dmytrodanylyk.com/pages/blog/concurrent-database.html
This should fix #265 (closed).
In the process, also did away with the two read()
and write()
methods
that returned a "readable" and "writeable" database respectively. It turns
out that it doesn't quite do what I originally thought. There is not much
benefit to specifying to the database helper that you want a readable/writeable
database. In fact, it is often the case that a call to read()
would most
likely have returned the same instance that is returned by write()
. The
semantics of them were therefore broken, and they've been replaced with
db()
.