[art] Add classpath check to DexFile.getDexOptNeeded

Extend DexFile.getDexOptNeeded to factor into the decision the
expected class loader context. If the context does not match oat
file assistant and dexoptanalyzer will advise kDex2OatFromScratch.

(cherry picked from commit baafa55aede7cc43a27d76bd88ccc02152123ecf)

Bug: 62269291
Test: m test-art-host
Merged-In: I3a8e9321fe602712fac3595b790168b271918f10
Change-Id: I3a8e9321fe602712fac3595b790168b271918f10
4 files changed