Relax locking when scanning private volumes.

Private volumes with many large apps can take a long time to scan,
which currently happens on the main thread with several large locks
held, making it likely to trigger the system-wide watchdog.

This change relaxes this locking by scanning on the PackageManager
worker thread, and by only holding locks when required.  In
particular, we release the installer lock between each scan to give
other apps waiting to dexopt a chance to breathe.

Bug: 24172036
Change-Id: Ie28d3ff72d6be28fa2f72c57d5e4146c768df89d
1 file changed