Refactor madvise startup logic
Consolidate the foreground process + primary dex checks for
madvise artifacts into a common runtime method. This does the following:
* Streamlines related logic for skipping madvise
* Allows short-circuiting madvise-related logic that might live above
the lower-level `MadviseFileForRange` call. Otherwise we end up
making `MadviseFileForRange` to no purpose when looping over dex
files when the process is not in the foreground.
* Has no impact for other callsites as 1) .art madvise has effectively
been disabled, and 2) boot image advise always qualifies.
Test: atest art_runtime_tests
Bug: 358590127
Flag: EXEMPT PURE_REFACTOR
Change-Id: I651b09304f9c92c0ce5061e3d9c1a95c7bd8f43e
4 files changed