Pull in code from android-ocr and fix numerous build errors

- Still unused.
- A bit bloaty at the moment. Fix later.