Populate active apexes cache in a background thread
* Split populateActivePackagesCacheIfNeeded into populateApexFilesCache
and parseApexFiles.
* populateApexFilesCache does an IPC to apexd , while parseApexFiles
does the heavy lifting of parsing apex files and extracting signature;
* Split is required because during PackageManagerService boot-sequence
we need to know list of apex packages, and in order to get that
information we don't need to parse apex files.
* Both populateApexFilesCache and parseApexFiles are enquened to run in
ApexManagers own HandlerThread so that they don't block other tasks in
system servers boot sequence.
* Changed ApexManager to use CountDownLatches instead of locks to
synchronize between thread, as they are more modern and easier to use.
Also did some perf testing on blueline by running
atest google/perf/boottime/boottime-test:
Without https://googleplex-android-review.git.corp.google.com/q/Ic7e5e14ed2d02d3685fd39bb70bc9423ae78f18e:
SystemServerTiming_StartPackageManagerService_avg: 2767.2
With what is currently in qt-dev:
SystemServerTiming_StartPackageManagerService_avg: 3728.4444444444443
Without splitting into populateApexFilesCache and parseApexFiles:
SystemServerTiming_StartPackageManagerService_avg: 3247.5
This change:
SystemServerTiming_StartPackageManagerService_avg: 2894.7
Test: device boots
Test: atest CtsStagedInstallHostTestCases
Bug: 131611765
Change-Id: I980700cd785c22d7f1ace294bb5456056d68baaa
3 files changed