Do not execute OAT files that require app images that cannot be loaded

This change creates a new requires-image flag in the OAT header, which
is set when the file was created with an image (app image, etc.). If
this flag is set, we will not load the OAT file as executable if the
image could not be loaded.

Going forward, this allows the compiler to assume there will be an app
image when an app image is generated and in some cases generate better
code.

Note that we still must load the OAT file, because there will not always
be another way to access the underlying DEX files.

Revert submission 1298633-revert-155218105

Reason for revert: Fixing tests and relanding
Reverted Changes:
I701c91d5b:Revert "Disable ART run-test 2231-oat-require-app-...
Ic5cda4c75:Revert "Reject OAT file in speed-profile if app im...

Bug: 38313278
Test: m test-art-host-gtest-oat_file_assistant_test64
Test: atest android.server.wm.MultiDisplaySecurityTests#testDisplayHasAccess_UIDCanPresentOnPrivateDisplay android.classloaders.cts.UsesLibraryHostTest#testUsesLibrary_full
Change-Id: I52cca033fa8e2e6de86514c833798c3d99b99477
10 files changed