Refactor apex activation sequence during boot

Existing code scans each partition and activates the apex immediately.
This causes lots of churns as mounted apex are demounted whenever a
better version is discovered.

This CL optimizes the boot sequence by scanning all the partitions
before activation and selecting the the exact set of apex that needs
to be activated.

Bug: 172911820
Bug: 178750591
Test: atest ApexTestCases StagedInstallTest StagedInstallInternalTest
Test: atest sharedlibs_host_tests

Change-Id: Ia0f75f19fa7f0456c77df3bc2f34974df6da2d41
5 files changed