Add a new version of `GetDexOptNeeded`.

The new version has two improvements:
- It takes a bit field `DexOptTrigger` as an input instead of
  `profile_changed` and `downgrade`. The bit field gives the caller more
  flexibility to customize the conditions to trigger dexopt.
- It returns the result in a more structured way: a boolean representing
  whether dexopt should be performed and an object containing whether
  the vdex file is usable and the location of the usable files.

The old version is refactored so that it shares the same underlying
logic with the new version. The behavior of the old version remains
unchanged.

Bug: 229268202
Test: m test-art-host-gtest-art_runtime_tests
Change-Id: I2841b8b0494e1bc7e0a57f0690d817b67bde64dc
Merged-In: I2841b8b0494e1bc7e0a57f0690d817b67bde64dc
(cherry picked from commit af72f6cf8762bbebe472b8562df116efe4327a9c)
8 files changed