[framework] Add check that classpath is up to date to getDexOptNeeded

(cherry picked from commit 576e6c0cbb0231d6650dee70319d7443c601fa1b)

Bug: 62269291
Test: manual, install new apk/splits and force updates.
I used com.android.cts.classloadersplitapp as the test app.
1) install-multiple split apks with dependency: Base -> A -> B
2) push an update for A
3) adb shell cmd package compile
4) check that A & B got recompiled and that B was because a class loader
context mismatch (e.g. "ClassLoaderContext classpath element checksum
mismatch for position 1.").

Merged-In: I4092562966413dc8976c9d41b26a90bbb9e37e1e
Change-Id: I4092562966413dc8976c9d41b26a90bbb9e37e1e
2 files changed