Fix the legacy version of `GetDexOptNeeded`.

- when `profile_changed` is true but the target compiler filter is worse
  than the current:
  - Before: returns kDex2OatForFilter
  - After: returns kNoDexOptNeeded
- when `downgrade` is true but there is no usable odex/vdex files:
  - Before: returns kDex2OatFromScratch
  - After: return kNoDexOptNeeded
- when `profile_changed` and `downgrade` are both true:
  - Before: kDex2OatForFilter
  - After: the same as `profile_changed` is false and `downgrade` is
    true.
- when the usable vdex file is in the DM file:
  - Before: returns kDex2OatForFilter with an arbitrary sign
  - After: returns kDex2OatFromScratch

Bug: 229268202
Test: m test-art-host-gtest-art_dex2oat_tests

Change-Id: I752d860adb8c026c762e8878ac060211df22670d
Merged-In: I752d860adb8c026c762e8878ac060211df22670d
(cherry picked from commit d0b1aed2dd4067dcdba7c449ff0b08da2109af09)
2 files changed