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
Ignore-AOSP-First: Will cherry-pick later.
Change-Id: I2841b8b0494e1bc7e0a57f0690d817b67bde64dc
8 files changed