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
Merged-In: I828c87510cfac0ae14ba5c8bf949aa259182fe4a
(cherry picked from commit f00fc65eb9993f6f8dc9964126cde4e05aa47b1f)
5 files changed
tree: 7ab353c03d9b0b7b1c2457d95638b3a07b12c716
  1. apexd/
  2. apexer/
  3. docs/
  4. proto/
  5. shim/
  6. tests/
  7. CleanSpec.mk
  8. OWNERS
  9. PREUPLOAD.cfg