apexd: fix bug in getAllPackages in case samegrade of system APEX

In case a same version of a system APEX is present on /data, apexd will
correctly activate it, but in the output of getAllPackages it will mark
system version of an APEX as active.

Since I was here, also simplified logic around figuring out whenever an
APEX is pre-installed.

Test: apexservice_test
Test: adb install system/apex/shim/com.android.apex.cts.shim.v1.apex
Test: adb reboot
Test: adb shell cmd apexservice getAllPackages
Bug: 140229069
Change-Id: I828c87510cfac0ae14ba5c8bf949aa259182fe4a
5 files changed
tree: a4213fd713f8a968b3998ead4b0123c585613679
  1. apexd/
  2. apexer/
  3. docs/
  4. proto/
  5. shim/
  6. tests/
  7. CleanSpec.mk
  8. OWNERS
  9. PREUPLOAD.cfg