Avoid crash when ANDROID_DATA is not writeable.

In this situation, the `dalvik_cache` filename is non-empty
but the cache directory cannot be created, so the variable
`dalvik_cache_exists` is false triggering a wrong DCHECK().
We relax the DCHECK() and adjust related code.

The bug was introduced in
    https://android-review.googlesource.com/734702 .

Also prevent running dex2oat if the cache does not exist,
the dex2oat would previously fail anyway due to the empty
--image= parameter.

Test: Extra test in image_space_test.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 112848347
Bug: 112827048
Change-Id: Ib82a3885773e95a7bdb0835499ea564f31e75eea
2 files changed