Move image writing to the runtime.

So we can share the logic between dex2oat and the runtime image writer.

Test: test.py
Bug: 260557058
Change-Id: Ib584df293e37e0feeb0b88ebd53cc25a32ef11f7
4 files changed