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