Ensure dexopt is executed only with consistent package data

The main objects bookkeeping packages (PackageParser.Package and its
corresponding ApplicationInfo) may be updated at different times. This
creates a window where the data stored in the ApplicationInfo is out of
date with respect to the data stored in PackageParser.Package.

During install, the two objects are "synced" during doRename which updates
the package code paths.

This CLs moves the dexopt invocation from the install flow after doRename
to ensure that dexopt logic gets a consistent view of the package.

Bug: 64493351

Test: run cts-dev -t android.appsecurity.cts.ClassloaderSplitsTest -m
CtsAppSecurityHostTestCases
      inspect oat files after
adb install-multiple CtsClassloaderSplitApp/CtsClassloaderSplitApp.apk
    CtsClassloaderSplitAppFeatureA/CtsClassloaderSplitAppFeatureA.apk
    CtsClassloaderSplitAppFeatureB/CtsClassloaderSplitAppFeatureB.apk

Change-Id: I9131bcf49eb473a8fdc5eb0032d94080d4e9e94b
2 files changed