Fix race in GetPrimaryOatFile.

GetPrimaryOatFile is broken and racy:
- Broken as it returns the first entry of a set, which isn't guaranteed
  to be the primary oat file.
- Racy as is returns an .oat file and then drops the oat_file_manager lock,
  so the OatFile may be concurrently deleted.

This CL fixes the race by only returning the information needed by the
only user of GetPrimaryOatFile.

Test: test.py
Change-Id: I512cb82a1c8856c06abf9bb243a5eeee33701dd1
3 files changed