Handle edge cases of shared libs APEX versions.

This CL fixes two bugs.
- When both preinstalled and updated version of a shared libs APEX have
  the same version code, the /data version is preferred. This resolves
  the bootloop issue when the version being rolled back to is the
  /system version (but gets installed in /data because of
  RollbackManager mechanics)
- When the /data version of a shared libs APEX is lower than the /system
  counterpart, we skip the activation of the /data version. The
  underlying assumption is that all the modules depending on a shared
  libs APEX are installed/upgraded together, and if an OTA upgrades all
  the /system APEXs to versions higher than /data there is no need to
  keep the /data version of shared libs APEX active. This solves an OTA
  update problem in which the version in /data has a development
  targetSDK which, upon OTA, is not anymore compatible with the system.

Bug: 193787030
Bug: 193894028
Test: atest
Change-Id: Iaf3710f8228d3eab58bde8d50d0e97600450c244
Merged-In: Iaf3710f8228d3eab58bde8d50d0e97600450c244
3 files changed