aconfigd: fix aconfigd crash

The root cause of the crash is after an OTA, the original package.map
and flag.map on /system/etc/aconfig are gone, replaced with new version
of package.map flag.map which contains more flags. Now aconfigd attemps
to persist the existing server overrides. It then try to list the flags
using the new package.map, flag.map but old flag.val in
/metadata/aconfig/flags. Because package.map and flag.map now contains
more flags, it will read across /metadata/aconfig/flags boundary. Thus
causing the crash.

The fix is to cache a copy of package.map and flag.map in
/metadata/aconfig/flags dir. So that in the case of OTA update. We can
still use the old package.map and flag.map files to retrive existing
server flag overrides.

Added a unit test case in aconfigd_test to mimic this behavior

Bug: b/339514174, b/312444587
Test: atest aconfigd_test
Change-Id: I887b72e631241d5a268ccd4614995804368bce3e
14 files changed