OSDN Git Service

Ensure dexopt is executed only with consistent package data
authorCalin Juravle <calin@google.com>
Fri, 11 Aug 2017 00:23:00 +0000 (17:23 -0700)
committerCalin Juravle <calin@google.com>
Fri, 11 Aug 2017 18:42:59 +0000 (11:42 -0700)
commit4c2b9555b7b52359ea14e201d7ec61b8edaf6232
treecf73c7d4c8c0da8fd20af95f7c37d2d932e824f8
parent0c62487d4b849f3b279a42ce451c6471a099233f
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
services/core/java/com/android/server/pm/PackageDexOptimizer.java
services/core/java/com/android/server/pm/PackageManagerService.java