History log of /frameworks/native/cmds/installd/dexopt.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
31419e7ac873051e9adbd89fe8c3d085997f28a8 25-May-2018 David Sehr <sehr@google.com> Disable dex2oatd for release background compiles

Use dex2oat rather than dex2oatd for release versions of
userdebug builds to get more soak time.

Bug: 73769503
Test: adb shell cmd package bg-dexopt-job
Change-Id: Id66777e8e49885cf4579d41364d10808df49b63e
/frameworks/native/cmds/installd/dexopt.cpp
59f7ab836f023ae68ce87031e55b5608bbe7df4d 28-Apr-2018 Calin Juravle <calin@google.com> Always pass --dex-location to profman

Pass --dex-location when updating profiles and taking snapshots. This
avoids reading the links from /proc/self/fd to infer the locations.

Test: adb shell cmd package snapshot-profile com.android.vending
Bug: 77922323
Change-Id: I392871bd2cfff78eaaee1d0bd7d4862b805019db
/frameworks/native/cmds/installd/dexopt.cpp
ad45a1b89bc3b6ec84ac32c4200be3d3c1d056fa 13-Mar-2018 Mathieu Chartier <mathieuc@google.com> Add flag for controling app image generation

So that package manager service can control this.

Bug: 72696798
Test: manual
Change-Id: I15fa74aff24ef14d22541117408840f80b7d300f
/frameworks/native/cmds/installd/dexopt.cpp
351bc94ede0f9b8d187bf09b3392621432c9a61b 06-Mar-2018 Mathieu Chartier <mathieuc@google.com> Add new dexopt flag to control CompactDex generation

Add a new flag to control CompactDex generation, this allows more
flexibility regarding when compact dex is generated.

The goal is to generate it for cmd package compile.

Bug: 63756964
Bug: 74245837
Test: adb shell /data/nativetest64/installd_dexopt_test/installd_dexopt_test

(cherry picked from commit f69c2f7f64e873049f66cfbed1aaad539bf0e063)

Merged-In: I0674f50bbb7413b67e6fbab3199f5c7e78ec875c
Change-Id: I8ed2e41ab94960ca8ac75008a74d5abd14e9ec97
/frameworks/native/cmds/installd/dexopt.cpp
e87fe0a1c2d48800b70ad33babf5296a5ce589aa 02-Mar-2018 Andreas Gampe <agampe@google.com> Installd: Check for dex2oatd before running it

Only select dex2oatd when it is actually available. Moves
a check to be a conditional.

Test: mmma frameworks/native/cmds/installd
Test: installd_dexopt_test
Change-Id: I4c5a8de68d0b4874632518733aeada22e1e6290c
/frameworks/native/cmds/installd/dexopt.cpp
3008bbefaa4719cbbf5aad6dc3f3934c50668da5 01-Mar-2018 Andreas Gampe <agampe@google.com> Installd: Amend dexopt binder logging

Separate dexoptanalyzer validation errors into different return
codes and add specific error messages. Also fix name style.

Test: mmma frameworks/native/cmds/installd
Test: installd_dexopt_test
Change-Id: Ie795897d112ded630de65c2ac7d7ee1a4b2a20a5
/frameworks/native/cmds/installd/dexopt.cpp
194fe428447c657c78347032040f872756f3283d 01-Mar-2018 Andreas Gampe <agampe@google.com> Installd: Amend dexopt binder logging

Add a bit more specific logging for secondary dexopt. Refactor
constants to enum to aid in adding more cases.

Test: mmma frameworks/native/cmds/installd
Test: installd_dexopt_test
Change-Id: I86e1cfed4b092ffe0a47553309451ad6fa077473
/frameworks/native/cmds/installd/dexopt.cpp
fa2dadd64b42c6c24d1cda007ce59a33696517e2 01-Mar-2018 Andreas Gampe <agampe@google.com> Installd: Amend dexopt binder logging

Add an enum for all exit codes used inside dexopt.cpp. Use the dex2oat
return-codes enum for dex2oat exec results. Add a function to map
these enum cases to small string snippets.

Test: mmma frameworks/native/cmds/installd
Test: installd_dexopt_test
Change-Id: I840ecbcaeb3ec1dcd9bd37dff9bdea35202b4731
/frameworks/native/cmds/installd/dexopt.cpp
023b22415ba9ce046f649817da27e40db8893451 01-Mar-2018 Andreas Gampe <agampe@google.com> Installd: Add error message to dexopt

To give better messages to the binder call, add an out parameter.
This is only the start, threading things further into the calls
dexopt makes, and formatting according to exit codes, will be in
a follow-up CL.

Test: installd_dexopt_test
Change-Id: I0271212c5cddf3a6317d6b597e97537865723fdc
/frameworks/native/cmds/installd/dexopt.cpp
d32eec2d9b37c57bc1b5491a63a04a356a7f8dd7 01-Mar-2018 Andreas Gampe <agampe@google.com> ART: Fix LOG_FATAL

Really use LOG(FATAL), which actually isn't disabled under NDEBUG. Fix up
other uses.

Test: installd_dexopt_test
Change-Id: Ib06f5f7e158a451fd2bf7ddf24b800373e72c570
/frameworks/native/cmds/installd/dexopt.cpp
2efc402a934d4d4d755d91d8bef5fdc3192084c3 14-Feb-2018 Calin Juravle <calin@google.com> [installd] Pass --compilation-reason to dex2oat

Test: installd_dexopt_test, installd_otapreopt_test
Bug: 73102540

Change-Id: I22854f040c08ea3207860f29b374c66fe2f21750
/frameworks/native/cmds/installd/dexopt.cpp
5bd1c7251a6a3a4318d24c1f89edebfecb98836d 01-Feb-2018 Calin Juravle <calin@google.com> Allow public profile compilation for primary apks

It is ok to perform a "public" compilation with
profiles comming from dex metdata files.

The PackageManager is responsible to set the is_public flag for
primary apks; so we no longer check it in installd.

(cherry picked from commit 0b386e03f83d9a308aecaebb6c7c1d6f36b79e27)

Test: installd_dexopt_test
Bug: 30934496
Merged-In: I72519c6a05aa318985396c6f93176624fe76c4be
Change-Id: I72519c6a05aa318985396c6f93176624fe76c4be
/frameworks/native/cmds/installd/dexopt.cpp
62c5a373fccf94cb3c125514aaff033d36fc101e 01-Feb-2018 Calin Juravle <calin@google.com> [installd] Pass .dm files to dexopt

(cherry picked from commit cc3b8aeff19f39afb8d4f2c198ee6cd2ec132d22)

Test: installd_otapreopt_test installd_dexopt_test
Bug: 30934496
Merged-In: I3cb5b3f96205688203a134023492d8ff80524ab6
Change-Id: I3cb5b3f96205688203a134023492d8ff80524ab6
/frameworks/native/cmds/installd/dexopt.cpp
f63d479fe67ea9da8baa755d499e6457221b89d9 30-Jan-2018 Calin Juravle <calin@google.com> Replace profman invocation for prepareAppProfiles

Instead of using the default merging path, use the dedicated
copy_and_update_profile_key path which will also update the
profile key to the actual apk path.

(cherry picked from commit b7eecae060ac625c38dd56b064a44391a569dcf6)

Test: installd_dexopt_test
Bug: 30934496

Merged-In: Ib268be534e3832598d55cacf0aad1c723772cc6c
Change-Id: Ib268be534e3832598d55cacf0aad1c723772cc6c
/frameworks/native/cmds/installd/dexopt.cpp
c4f6a0b6333980a069900e2afff2c755f30fe09c 01-Feb-2018 Calin Juravle <calin@google.com> Fix profile guided compilation for secondaries and add more tests

The method signature for opening the reference profile was wrong
and did not account to the fact that the profile name can be
null for secondary dex files.

Also, add infrastructure to test dexopt for primary apks and add
an initial set of tests.

(cherry picked from commit 2372d12577540bd41c74f2d1cd6f604a0390d726)

Test: installd_dexopt_test
Bug: 72666394
Merged-In: I537a3f52a1449a8edb070643500a4d241728cb9a
Change-Id: I537a3f52a1449a8edb070643500a4d241728cb9a
/frameworks/native/cmds/installd/dexopt.cpp
0d0a49205ff08bdf23124455b6b31ace81edd4f6 24-Jan-2018 Calin Juravle <calin@google.com> [installd] Create profile snaphots for boot image

Create the profile snapshot for the boot image by aggregating all primary
profiles. During aggregation data that does not belong to the boot image
is filtered out. The matching is done based on the dex files provided in
the classpath argument.

(cherry picked from commit e61189e0ad2104360a188d36210bd1ee43803a64)

Test: installd_dexopt_test
Bug: 30934496
Merged-In: Ib980ab3feb9f9838dff81a3861693cd08b1df9ab
Change-Id: Ib980ab3feb9f9838dff81a3861693cd08b1df9ab
/frameworks/native/cmds/installd/dexopt.cpp
408cd4ab394ce6640f43665639bc3fb0ac296ca6 21-Jan-2018 Calin Juravle <calin@google.com> [installd] Extend profile operations to take the profile name

Extend the installd profile interface to take the profile name as
argument. This shifts the responsibility for choosing the names of
profiles for primary apks completely to PackageManager. Each of the
application code paths will get an unique profile name.

All the profile operations will now work on a specific profile name rather
than assuming a default global name.

(cherry picked from commit 562de815339bedd29206f5f98be44c824945b627)

Test: installd_dexopt_test
Bug: 30934496
Merged-In: I5847d35fe4d3caa5a2b32293426a24683af42030
Change-Id: I5847d35fe4d3caa5a2b32293426a24683af42030
/frameworks/native/cmds/installd/dexopt.cpp
c3b049e0294a5884b18f0f29f3af14e6de0803c7 19-Jan-2018 Calin Juravle <calin@google.com> [installd] Prepare profiles for app code paths

Implement profile preparation for individual application code paths.

The preparation is:
- create the current profile
- merge the profile from the dex metadata file (if present) into the
reference profile.

Note: currently the current profile is created as part of
InstalldNativeService::createAppData for the entire package. That logic
does not support dex metadata or individual code paths and will be removed
once the PackageManager switches over the new method.

(cherry picked from commit bc5ab878b56bcd3a300cc5fc0facc864421dfcb6)

Test: installd_dexopt_test
Bug: 30934496
Merged-In: I2aeddcda7b78017bd46838985bef5f92a79d4573
Change-Id: I2aeddcda7b78017bd46838985bef5f92a79d4573
/frameworks/native/cmds/installd/dexopt.cpp
824a64db8db2e9bf5c601f2568544ea1c3b4dd3e 19-Jan-2018 Calin Juravle <calin@google.com> Prepare installd to handle profiles per code path

Transform each profile operation to accept the pair
(package_name, profile_name). This will allow installd to get the profile
name from the PackageManager instead of assuming a predefined name. The
PackageManager will compute and assign unique profile names for each code
path.

The end goal is to support installation and extraction of profiles per
code path.

Also, add a few extra tests for merging the profiles.

(cherry picked from commit cfcd6aa28593a227d39868f6f567264fca1360a1)

Test: installd_dexopt_test, installd_utils_test
Bug: 30934496
Merged-In: I580f037d9d3e5537032e815dc803b9ddeff343cb
Change-Id: I580f037d9d3e5537032e815dc803b9ddeff343cb
/frameworks/native/cmds/installd/dexopt.cpp
a25d90ce8da7d6e70d0ea18a50134bb0122c4017 16-Oct-2017 Alan Stokes <alanstokes@google.com> Add Installd IPC to compute the SHA256 of a seconday dex file.

(cherry picked from commit 753dc71734927f86c277991be9326cb9a82202b1)

Bug: 63927552
Test: Exercised manually. Added unit tests in installd_service_test.

Merged-In: If9df7a88f3a3039aab69ed5f200d14cb19794cb3
Change-Id: If9df7a88f3a3039aab69ed5f200d14cb19794cb3
/frameworks/native/cmds/installd/dexopt.cpp
522491627cc6ec4036ed5a5f95b80e04063590aa 13-Feb-2018 David Brazdil <dbrazdil@google.com> Refactor runtime hidden API flag from negative to positive

There are only two situations in which we want to enable hidden API
access flag checks. Turning the flag from DISABLE_ to ENABLE_
simplifies logic in ART and reduces the number places where the flag
had to be passed down to ART.

Bug: 64382372
Test: boot device, install and run apps, check log messages
(cherry picked from commit 22cce5a179a1dd47cf402fbff9170df2e4703264)

Change-Id: I468df458e9dd9e6a9b5ec56c03d1ba56c850c4dc
/frameworks/native/cmds/installd/dexopt.cpp
7fcbb816bcedac25e3e0cbf43e8dd715ff759cee 17-Jan-2018 David Brazdil <dbrazdil@google.com> Add new dexopt flag to control hidden API restrictions

Allow PackageDexOptimizer to select which APKs should be exempt
from hidden API restrictions by creating a new DEXOPT_ flag and
passing a suitable command line argument to dex2oat if it is set.

Bug: 64382372
Test: installd_dexopt_test
Change-Id: I86917c357ced7fa04d8bb500669b76bbd4c08f2c
/frameworks/native/cmds/installd/dexopt.cpp
570d398770a12613461408b767ae97b549393157 16-Jan-2018 David Brazdil <dbrazdil@google.com> Pass targetSdkVersion to dex2oat

Dex2oat now accepts targetSdkVersion as a parameter to determine
whether ART should treat the app as "legacy" and allow or restrict
access to private APIs.

We bump the otapreopt argument version to v4 due to the new value.

Bug: 64382372
Test: manual
Change-Id: I5de64e96043404df39f09d3d16b575ee39951fcb
/frameworks/native/cmds/installd/dexopt.cpp
1fb463eb936b9476f27c6ced41dd150895499e72 10-Jan-2018 Mathieu Chartier <mathieuc@google.com> Disable cdex for non background dexopt

Avoid regressing app install until there are enough benefits to
justify the tradeoff.

Test: make
Bug: 63756964
Change-Id: I1c5b3c097a456b6c8e18c34a228122b976d62da5
/frameworks/native/cmds/installd/dexopt.cpp
b41ffcc92bb91a68947bf715bca9ddab617795bf 09-Jan-2018 Mathieu Chartier <mathieuc@google.com> Disable compact dex for input fd == output fd

In the case where compact dex is enabled by default, we must
explicitly disable it for the unsupported case where update input
vdex is true.

Test: make
Bug: 63756964
Change-Id: Ie2bed45d6206f557c20c147cb21e4a0adf72176e
/frameworks/native/cmds/installd/dexopt.cpp
969e4f8b21148db61413abaea788d67f126cde58 20-Dec-2017 Elliott Hughes <enh@google.com> StartsWith/EndsWith allow std::string prefixes/suffixes now.

Bug: N/A
Test: builds
Change-Id: I502f7ff687ac164ae9c2c639b4c8eab13291ea62
/frameworks/native/cmds/installd/dexopt.cpp
c3596c32071920e020f016e6fc38b69ba4f1b38a 05-Dec-2017 Calin Juravle <calin@google.com> Rename snapshotProfile to createProfileSnapshot for better consistency

Test: installd_dexopt_test
Bug: 30934496

(cherry picked from commit c41dac27c540971d8877911d6a3908af2046c9eb)

Change-Id: I5ef302ef714d47150790e3a97a9d0c0bbf36adc3
/frameworks/native/cmds/installd/dexopt.cpp
29591736958a7ed45f4b5982ca9a46756baa0f6d 21-Nov-2017 Calin Juravle <calin@google.com> Add snapshotProfile APIs to installd

Add APIs that will snapshot the profile information of packages
in a well known location.

The snapshot ownership is given to AID_SYSTEM. The location is
next to the application reference profile:
/data/misc/profiles/ref/pkg_name/primary.prof.snapshot.

The intended flow for snapshotting profiles is:
mInstaller.snapshotProfile(appId, packageName, codePath);
// open profile snapshot
mInstaller.destroyProfileSnapshot(packageName, codePath);

The reference profile directory is made searchable by others
(in order for the system to be able to open the snapshot profile).

Test: installd_dexopt_test installd_utils_test
Bug: 30934496
Change-Id: Ic4973d5c67243d7724ecd24a238ed0ae8baadcc6
/frameworks/native/cmds/installd/dexopt.cpp
7d7654646abb84bbae6b245de270ac087cdc8a95 05-Sep-2017 Calin Juravle <calin@google.com> Move secondary dex files processing in the app process

Run the validation and processing of secondary dex files with the app
process capabilities. This drops the need to validate/use real paths since
all file tests and accesses is done now with lower privileges.

The oat files and profiles are now created relative to the given path
instead of using realpath. This allows us to always know where the
compiler artifacts are even if the original dex file was deleted. It
enables a straightforward clean up during reconciliation.

The validation will accept /data/user/0 as a valid secondary dex path
since for user 0 this is the location that will be used most of the times.

This CL also adds a test framework for dexopt related functionality.
The current tests only cover the secondary dex files with more to come.

Bug: 64460009
Test: adb shell cmd package reconcile-secondary-dex-files
com.google.android.googlequicksearchbox (after removing some files)
adb shell cmd package compile -m speed --secondary-dex
com.google.android.googlequicksearchbox
adb shell /data/nativetest64/installd_utils_test/installd_utils_test

(cherry picked from commit 46e27bcc773f1c1df3a0ae8df67b49ab20e39b43)

Merged-In: I0d49cd7f3c089bc5156178680bb29b75ab82092c
Change-Id: I1c1feec6bc475ac5fd6e1339737626f5404ca6c9
/frameworks/native/cmds/installd/dexopt.cpp
2a2d7ba87707b3c83e05542657728473eb2ca518 03-Nov-2017 Andreas Gampe <agampe@google.com> Installd: Emit minidebug-info

If globally enabled, pass --generate-mini-debug-info to dex2oat
when dalvik.vm.dex2oat-minidebuginfo is set to annotate compiled code
with unwind information.

Test: m
Test: adb shell setprop dalvik.vm.dex2oat-minidebuginfo false && adb shell cmd package compile -f -a
Test: adb shell setprop dalvik.vm.dex2oat-minidebuginfo true && adb shell cmd package compile -f -a
Change-Id: I0ff0c4f40d2cb8a14816b4a967e5707170845080
/frameworks/native/cmds/installd/dexopt.cpp
a73a0cbcc07640c3656b5648979affd2ff44e4de 03-Nov-2017 Andreas Gampe <agampe@google.com> Installd: Rename try_debug_for_background

Rename to background_job_compile to signal broader future use.

Test: m
Test: manual test - install
Test: adb shell cmd package bg-dexopt-job
Change-Id: I6bdfa2f591733f3340e2a385cb207ab2839772c5
/frameworks/native/cmds/installd/dexopt.cpp
b6bcd220e412b0b304690fdddcd658f5c6392c86 19-Oct-2017 Shubham Ajmera <shubhamajmera@google.com> Use fds for dexoptanalyzer from installd

Test: adb shell cmd package --secondary-dex -m speed-profile <package-name>
(cherry-picked from commit aa6999b366615993f59d813ab43905ef7ac215c8)
Bug: 67111829
Change-Id: Ia6fffb89ccefb073ad79c448287b0c458786292e
/frameworks/native/cmds/installd/dexopt.cpp
a3b5ab625512d9f58eb7a237677be722a7b00d8e 25-Oct-2017 David Sehr <sehr@google.com> Use dex2oatd when available on debug builds

Enable use of dex2oatd for background dexopt service for eng and userdebug builds.
This allows us to have more extensive checking on dogfood devices.

(cherry picked from commit 0ff5f3c694464a3d791b0e435a595965e37767b7)

Bug: 68025088
Test: adb shell cmd package bg-dexopt-job
Merged-In: If346c27594542b1e6a058369170f38b6ae24462f
Change-Id: If346c27594542b1e6a058369170f38b6ae24462f
/frameworks/native/cmds/installd/dexopt.cpp
9150107bacdc19eb99ef92c0adad936972e90f8f 27-Oct-2017 Calin Juravle <calin@google.com> Fix argument passing to dexoptanalyzer

(cherry picked from commit 56891f864c97c6b211cb31f356a175d9e471052f)

Test: adb shell cmd package compile --secondary-dex com.google.android.gms
Bug: 68340214

Merged-In: I7b7372bfb62144a51a9f2fd4c8525f6a53a27410
Change-Id: I7b7372bfb62144a51a9f2fd4c8525f6a53a27410
/frameworks/native/cmds/installd/dexopt.cpp
58cab07761f71deee028bbaf9c402abd8e564bce 12-Sep-2017 Calin Juravle <calin@google.com> [installd] Add check that classpath is up to date to getDexOptNeeded

Pass the class loader context argument to dexoptanalyzer when analyzing
secondary dex files.

(cherry picked from commit ef81ec21e8ea059875295597e3acc9f6af3a96ec)

Bug: 62269291
Test: manual, compile secondary dex files
adb shell cmd package compile -m speed --secondary-dex
com.google.android.googlequicksearchbox

Merged-In: I25ae93cadd12441a13ff54bb3da5a198085c6f3d
Change-Id: I25ae93cadd12441a13ff54bb3da5a198085c6f3d
/frameworks/native/cmds/installd/dexopt.cpp
c1149c9797e42f10c82cdcc8d1e69861e0114c02 21-Sep-2017 Jeff Sharkey <jsharkey@android.com> Enable clang-tidy for sensitive domain.

Since installd has broad access to lots of sensitive data, enable
as many security-related tidy checks as possible to help avoid bugs.

This change provides a default implementation of create_cache_path(),
calculate_odex_file_path(), and calculate_oat_file_path(), along
with tests to verify behavior against old code.

Replace "dir_rec_t" with std::string, since that's really what it's
been all along. Increase paranoia of path checking to reject any
paths containing "..", regardless of where it occurs in path string.
Stricter checking of instruction set values.

Remove now-unused char* manipulation utility methods; people should
be using std::string instead.

(cherry picked from commit 1b9d9a6006f4159e2cc2c41330f316b1fdc53fe1)

Test: adb shell /data/nativetest/installd_cache_test/installd_cache_test
Test: adb shell /data/nativetest/installd_service_test/installd_service_test
Test: adb shell /data/nativetest/installd_utils_test/installd_utils_test
Bug: 36655947
Merged-In: Ib706f0b8c1878be64710c00f56dccdfbe215570f
Change-Id: Ib706f0b8c1878be64710c00f56dccdfbe215570f
/frameworks/native/cmds/installd/dexopt.cpp
dd42e278aa2e5fd504901798aad064e102ee4a61 11-Sep-2017 Calin Juravle <calin@google.com> Adjust the validation code for secondary dex paths

Do not validate the package path when reconciling secondary dex files. If
the file does not exist we cannot resolve the system sym links (e.g.
/data/user/0 -> /data/data) and the validation will fail leaving oat files
behind.

(cherry picked from commit 9cd45602a89b2af5d4b8086cbb806b64ff6b78a4)

Bug: 64460009
Test: adb shell cmd package reconcile-secondary-dex-files
com.google.android.googlequicksearchbox (after removing some files)
adb shell cmd package compile -m speed --secondary-dex
com.google.android.googlequicksearchbox
adb shell /data/nativetest64/installd_utils_test/installd_utils_test

Merged-In: I9734ad18a579d44088180326661d8cf8288e90be
Change-Id: I9734ad18a579d44088180326661d8cf8288e90be
/frameworks/native/cmds/installd/dexopt.cpp
e6d7ad52db6d14019ebb20a7f7491d752ffe7b0b 25-Aug-2017 Shubham Ajmera <shubhamajmera@google.com> Drop capabilities in reconcileSecondaryDexFiles

... while unlinking oat files.

(cherry picked from commit e5afdb57e970f5813691ce9b0b5c7dd23faacfa0)

Test: adb shell cmd package reconcile-secondary-dex-files \
com.android.google.gms

Bug: 64461549
Merged-In: Ib2c59686233faab22088fc40a706736feb9964ee
Change-Id: Ib2c59686233faab22088fc40a706736feb9964ee
/frameworks/native/cmds/installd/dexopt.cpp
3760ad3c254968c16f99356b5c5e2b7bef7da722 28-Jul-2017 Calin Juravle <calin@google.com> Change the location of current profiles for secondary dex files

Update the installd code to handle the new location for secondary dex
profiles.

Tighten up the validation code and add tests.

Counter part for frameworks commit
a07ca21f9727325d76d2ddbfa119513f47f0b45f.

(cherry picked from commit 1c809c7068f610ff22174dbe96b49f1b8ada9c1e)

Bug: 62336157
Test: adb shell cmd package compile -r bg-dexopt --secondary-dex
com.google.android.googlequicksearchbox
adb shell cmd package reconcile-secondary-dex-files
com.google.android.googlequicksearchbox

Merged-In: Ib7af091a35fe53e7f6bb5f30a09911188caff88f
Change-Id: Ib7af091a35fe53e7f6bb5f30a09911188caff88f
/frameworks/native/cmds/installd/dexopt.cpp
52c4582e9c0088cbf43ff60d108df72fcb298885 14-Jul-2017 Calin Juravle <calin@google.com> Replace dexopt shared libraries with class loader context

Pass the class loader context to dex2oat with --class-loader-context
instead of using the runtime -cp argument.

(cherry picked from commit 1d66761379b54ff71094a7c722f131c591f3f897)

Test: adb shell cmd package compile a_split_test_apk
Bug: 38138251
Merged-In: I2e483969af8adf97291aa94f42e6da9ee5f1716b
Change-Id: I2e483969af8adf97291aa94f42e6da9ee5f1716b
/frameworks/native/cmds/installd/dexopt.cpp
54ef8626be7b2351eb8482e21951ddb00a3b39d6 22-Jun-2017 Shubham Ajmera <shubhamajmera@google.com> Check dexopt needed for secondary dex while downgrading

Test: make otapreopt
Test: manual
* Remove the check in the code that allows downgrade only when
the space is low on the device.
* adb root
* Set pm.dexopt_unopt_after_inactive_days to 600
* Make sure the current time of the device is correctly set
* Install 2 non system apps - B, C
* Downgrade B to extract
* Upgrade a system apps to speed-profile - E
* Downgrade a system app to quicken - G
* adb shell cmd package bg-dexopt-job

Expected Results:
* Extract - B
* Verify - C
* There should not be any entries for apps E an G
in dalvik_cache

For secondary dex:
* compile googlequicksearchbox to everything.
* run background dexopt service for secondary dex.
* verify the compiler filter for the corresponding odex files.

(cherry picked from commit 45c8743428e0c9445430995ba395b3b5ebf82b3e)

Bug: 36598475
Merged-In: I6ad40e2c53433326f83c2589646d94ba555400b2
Change-Id: I6ad40e2c53433326f83c2589646d94ba555400b2
/frameworks/native/cmds/installd/dexopt.cpp
85e0c9c30c6a1ae67352ea4c517fd04709c22c96 29-Aug-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Unconditionally unlink image."
am: 74a871ae12

Change-Id: Ib5bf81382687eb418dbbfb7caa864c88822fa1a1
aa17ab41eb13d24f0f17ce07cdda1f141a82f037 15-Aug-2017 Nicolas Geoffray <ngeoffray@google.com> Unconditionally unlink image.

In case there is a stale one. Useful when doing:
adb shell cmd package compile --reset ...

bug: 64708178
Test: adb shell cmd package compile removes the app image

(cherry picked from commit 775cdd9b94ad0094944fa8df64a52a5e43440a68)

Change-Id: Ic85eeecedd7dd762e01e943a74349b7da6063d6d
/frameworks/native/cmds/installd/dexopt.cpp
6a9cf727b187d21737225326c342c63c5cdba942 25-Jul-2017 Andreas Gampe <agampe@google.com> Installd: Run debug tools when using libartd

When ART is requested to run through libartd, use dex2oatd instead
of dex2oat to compile apps (profmand instead of profman,
dexoptanalyzerd instead of dexoptanalyzer).

Bug: 15735795
Test: m
Test: manual test with libartd
Merged-In: I33a12198566f5d979207e1edd4460b839a0f55f1
Change-Id: I33a12198566f5d979207e1edd4460b839a0f55f1
/frameworks/native/cmds/installd/dexopt.cpp
f2d5d51e236d1683e7820d68eb3d76071fab548a 25-Jul-2017 Andreas Gampe <agampe@google.com> Installd: Run debug tools when using libartd

When ART is requested to run through libartd, use dex2oatd instead
of dex2oat to compile apps (profmand instead of profman,
dexoptanalyzerd instead of dexoptanalyzer).

Bug: 15735795
Test: m
Test: manual test with libartd
Merged-In: I33a12198566f5d979207e1edd4460b839a0f55f1
Change-Id: I33a12198566f5d979207e1edd4460b839a0f55f1
/frameworks/native/cmds/installd/dexopt.cpp
d23dee76234b7eb804f69b110b4fd8cae22fe1ab 07-Jul-2017 Calin Juravle <calin@google.com> Validate the size of all dex paths eagerly

Also, increase the PKG_PATH_MAX which is used as the max path length to
1024. This should accommodate reasonably long dex path (to cover for
longer secondary dex files paths).

If a dex path exceeds 1024 characters the dex file will not be compiled.

Bug: 63285397
Test: manual
1) create an artifical long paths under gmscore:
2) update /data/system/package-dex-usage.list to simulate the use of those
dex file
3) run `adb shell cmd package compile -r bg-dexopt --secondary-dex
com.google.android.gms`
4) observe that a 256+ characters dex path is ok while a 1024+ long one
fails.
5) run `adb shell cmd package reconcile-secondary-dex-files
com.google.android.gms` and check no errors are present.

Change-Id: I23b34013e32c5c64ca9c1381cc4d8d67e7121cc8
/frameworks/native/cmds/installd/dexopt.cpp
78f71fe71d9fcbaed1270b902c9f3a2bf14c37f3 14-Jun-2017 Mathieu Chartier <mathieuc@google.com> Use _exit for profile copy dexopt command

Previously we used exit(0), but this called global destructors and
could cause problems depending on the state when the forking
happened.

Using _exit avoids calling hte global destructors in the child
process.

Test: Delete packages.xml and flash to simulate first boot
Bug: 62597429
Change-Id: I3a6dcd5f05ca85e1488df154ec283c2ec842e59f
/frameworks/native/cmds/installd/dexopt.cpp
cf61460126ff0f945e27171f241b800b21bb160e 06-Jun-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Revert "Disable in-place vdex update"" am: 52ca987db6 am: deb23917a9 am: 3470e3e3f7
am: fd256c977a

Change-Id: I59679c67151f61644662229c0106add720299dd1
fd256c977add88ac4b25c9d9aa09a8205e060321 06-Jun-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Revert "Disable in-place vdex update"" am: 52ca987db6 am: deb23917a9
am: 3470e3e3f7

Change-Id: I9b6b0b3fecb25e01b10d126e9d236658acd1e99c
b03814f39559c824e097bf2d869c7a56d8b41b67 05-Jun-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Disable in-place vdex update"

Reverting to only apply this when doing dexlayout.
PS1 is a pure revert. PS2 contains the fix.

This reverts commit e446fede9258359b61d4c8753d7e96477fa29388.

Change-Id: I04a7dbde142d59e8dcdf4e93ab0456c4aa3d02ab
/frameworks/native/cmds/installd/dexopt.cpp
e2cc7337ccd1afb2fbfc401918648d557be0da3a 01-Jun-2017 David Sehr <sehr@google.com> Merge "Disable in-place vdex update" am: d9917d78a0 am: 2521871a1f am: b8e9326fd8
am: 8425a02d5c

Change-Id: I7ca8d02b2e43ae1a2d69aeb0551f7297f6da83ee
8425a02d5c6653a84f87c437c1ae36f67c51164a 01-Jun-2017 David Sehr <sehr@google.com> Merge "Disable in-place vdex update" am: d9917d78a0 am: 2521871a1f
am: b8e9326fd8

Change-Id: Ia2297f8cc31830e4e3909580f3af45dfb96e5901
e446fede9258359b61d4c8753d7e96477fa29388 27-May-2017 David Sehr <sehr@google.com> Disable in-place vdex update

Vdex files can be corrupted by dexlayout or by previously dexlayout-ed
files being recompiled if they are used as both input and output.
Disable this feature.

Bug: 38113240
Test: OTA and dexopt
Change-Id: Iee2d9a6c1ba8cddda25290f68f50649d5288d588
/frameworks/native/cmds/installd/dexopt.cpp
f44c05f87e8becbff468a4dd59c88b3a2a6bae5c 26-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Delete vdex file in delete_odex." am: 99dedeb690 am: f6b79dd073 am: 6dc664460d
am: 362e56e41a

Change-Id: I7594ff3af6fc72e4d155afab41ef3ae4cb1b60ef
362e56e41a847391c02706c170b21a6d1f6c6d68 26-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Delete vdex file in delete_odex." am: 99dedeb690 am: f6b79dd073
am: 6dc664460d

Change-Id: I0116a003cd1985e15d2beb9a60a4262549647774
192fb9662ce8b2a60da2b280d8000283fb3b6f6b 25-May-2017 Nicolas Geoffray <ngeoffray@google.com> Delete vdex file in delete_odex.

bug: 38513395
Test: unfortunately no unit test here, so after discussing
with agampe@ just relied on build.

Change-Id: I305ddaadc813673fb55473f5e8ca357f39cf98f3
/frameworks/native/cmds/installd/dexopt.cpp
8748ecda68a6f7cb7c1ad4ee4349d2e4fdbe31f6 19-May-2017 Calin Juravle <calin@google.com> Merge "Delete secondary dex profiles during reconciliation" into oc-dev am: 74a812c587
am: 07d92974fa

Change-Id: I2ac3257a90c708406da4220b700cf6bd4ecd5fc6
74a812c587c21e85449a47c098c57d87c1527306 19-May-2017 Calin Juravle <calin@google.com> Merge "Delete secondary dex profiles during reconciliation" into oc-dev
513140941eeec7a5bad56956cce101f3da829d43 19-May-2017 Calin Juravle <calin@google.com> Delete secondary dex profiles during reconciliation

Test: manual inspections after adb shell dumpsys package dexopt
Bug: 38430319
Change-Id: I8401288b753a0c38ee3020d12e8e02c4a25723d2
/frameworks/native/cmds/installd/dexopt.cpp
7ea0738923e429eab47354170564940a376f0662 11-May-2017 Mathieu Chartier <mathieuc@google.com> Merge "Add copy system profile functionality"
89726a1deaca6646e1641e0358186a0a19374dc7 11-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Handle safe mode in PackageManager." into oc-dev
f966f2a5af6cc2022a5af4edeb20cf4b5ede0d40 10-May-2017 Mathieu Chartier <mathieuc@google.com> Add copy system profile functionality

Test: Flash preopted speed-profile maps.
Test: Confirm ref profile exists.
Test: Close maps, recompile with speed-profile, test the profile was used.
Test: Launch maps, do some stuff until cur profile exists.
Test: Re-compile with speed-profile and confirm cur merged over ref correctly.

Bug: 38032017

Change-Id: I19c8009ad61213bdcb52f010329eb459ca82f92b
/frameworks/native/cmds/installd/dexopt.cpp
a0af34de9ef2449000343b468f4a056a91dcdbb6 03-May-2017 Nicolas Geoffray <ngeoffray@google.com> Handle safe mode in PackageManager.

installd side of the change.

bug:37929796
Test: manual OTA with a safemode app.

(cherry picked from commit be6ecd6f6141de1ecd4ec6eb5885bdd0f655fafa)

Change-Id: I43dcdd3fea3f62398f16f89348c1a2f1b4b1bb6d
/frameworks/native/cmds/installd/dexopt.cpp
0bc052e9bcd721607eb8b25e220edce2ce1bcb28 10-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Always unlink the out_vdex_file." am: fbb09a7192 am: e5a1bc620b
am: 2087818222

Change-Id: Iab9661cb66924b200263acaac4ce4f2876481a52
105e98780cfcf3145d6c53c57a41e924eb73bb05 09-May-2017 Nicolas Geoffray <ngeoffray@google.com> Always unlink the out_vdex_file.

Even if we pass the same vdex file as input and output to
dex2oat, make sure we unlink it if dex2oat failed.

bug:38113240
Test: manual, killing dex2oat invocation

(cherry picked from commit 7bb165779f59bfa1324ca991f64ab98331a410b5)

Change-Id: I157b3d33179b5bff1ca38750bee24aab01c5a19b
/frameworks/native/cmds/installd/dexopt.cpp
7bb165779f59bfa1324ca991f64ab98331a410b5 09-May-2017 Nicolas Geoffray <ngeoffray@google.com> Always unlink the out_vdex_file.

Even if we pass the same vdex file as input and output to
dex2oat, make sure we unlink it if dex2oat failed.

bug:38113240
Test: manual, killing dex2oat invocation
Change-Id: I406014f97a2c3b2bd646e13b5d86dfa0eaa2692f
/frameworks/native/cmds/installd/dexopt.cpp
9175ac3b242057d306b04a6f2f37fedace748b9b 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> resolve merge conflicts of 7827bcc3e to oc-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ib00772a1460f0d066366edec8df35831f1039ac3
be6ecd6f6141de1ecd4ec6eb5885bdd0f655fafa 03-May-2017 Nicolas Geoffray <ngeoffray@google.com> Handle safe mode in PackageManager.

installd side of the change.

bug:37929796
Test: manual OTA with a safemode app.
Change-Id: I1cdb034b9e27b72ad606a4935172d0040364c380
/frameworks/native/cmds/installd/dexopt.cpp
9014ca88a9412cb1a1168ae842f30f8783ea1e3d 03-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Disable input-vdex when doing speed-profile."" into oc-dev
a4a4811a21941e2b8f008d4052256c4f3aaa08ef 02-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Revert "Disable input-vdex when doing speed-profile."" am: eebbf2e371 am: b8d5b100d1
am: 87de761742

Change-Id: I7cbceeec5137a31ba65055c7db5fa21a91333e4d
575fc2c3c8f67be2a258cf28f915c7c902f332d1 24-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Disable input-vdex when doing speed-profile."

https://android-review.googlesource.com/#/c/377754/ is fixing vdex and delayout.

bug: 37558732
Test: device boots, vdex works on OTA, input-vdex is passed
for speed-profile

This reverts commit a2dbefc7a51482acb8d5d139c9e2f01306ef9ceb.

(cherry picked from commit 3c95f2da655567d9fcc28d7a35dcc79d75cb61f6)

Change-Id: I4d36ec79ca681e20ffb181ec099ce5b229e38aed
/frameworks/native/cmds/installd/dexopt.cpp
eebbf2e371e04be0fcd33cf31a4f5ab0e9bd5048 02-May-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Revert "Disable input-vdex when doing speed-profile.""
63d8e566f7396884de830a0af358f0ad2c11f302 25-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Update installd to new compiler filters.

bug:34715556
Test: build and boot aosp bullhead

(cherry picked from commit 4b64ed991b23dc1215ce10fce69c3e2595dd34b7)

Change-Id: Ib94bda97ed131878c3be092d58920500d2d8d556
/frameworks/native/cmds/installd/dexopt.cpp
91582cd2a5f19cdba19886717bf75a36e6ca6b2a 27-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Update installd to new compiler filters." am: f41404045a am: d9cfce8e4d
am: 685d22015a

Change-Id: I6679c0a2c8ad13ce22d9ac877f394153b6fae433
3c95f2da655567d9fcc28d7a35dcc79d75cb61f6 24-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Disable input-vdex when doing speed-profile."

https://android-review.googlesource.com/#/c/377754/ is fixing vdex and delayout.

bug: 37558732
Test: device boots, vdex works on OTA, input-vdex is passed
for speed-profile

This reverts commit a2dbefc7a51482acb8d5d139c9e2f01306ef9ceb.

Change-Id: I8fcab30ec617b39769fbf7e5818e5d503d647fb4
/frameworks/native/cmds/installd/dexopt.cpp
4b64ed991b23dc1215ce10fce69c3e2595dd34b7 25-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Update installd to new compiler filters.

bug:34715556
Test: build and boot aosp bullhead
Change-Id: If10fb8cdfe34f109d4caa1df56a49304025da553
/frameworks/native/cmds/installd/dexopt.cpp
89aeee442b539f60b5b6611657ac379c65aa7a96 19-Apr-2017 Jeff Hao <jeffhao@google.com> Fix passing --classpath-dir to dex2oat for split apks.

Merged wrong version of CL in by mistake. CL should have been
cherry-picked from cc5c4e32637601432bc6359fb7ff34e4cadb6502.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Change-Id: Ibebcdce1c9ab0de3254727c8dfc3d0de18932f1c
/frameworks/native/cmds/installd/dexopt.cpp
10b8a6e72c5b1c2eef4e5657dd0927f0c1623fff 06-Apr-2017 Jeff Hao <jeffhao@google.com> Run dex2oat from the staged apk directory.

The frameworks/base change makes the PackageManager pass relative paths
of previous code paths as shared library paths. This change passes the
base directory for these relative paths to dex2oat using the new switch
--classpath-dir.

Part of a multi-project change.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

(cherry-picked from commit cc5c4e32637601432bc6359fb7ff34e4cadb6502)

Change-Id: I8f941eb9982a051c1f49256d5489f2575af1d80f
/frameworks/native/cmds/installd/dexopt.cpp
4887469691aec31d7e01893cdc989d1fe33e9591 06-Apr-2017 Jeff Hao <jeffhao@google.com> Run dex2oat from the staged apk directory.

The frameworks/base change makes the PackageManager pass relative paths
of previous code paths as shared library paths. This change passes the
base directory for these relative paths to dex2oat using the new switch
--base-dir.

Part of a multi-project change.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Merged-In: Ic20aa0b6a80104d0759ac84df3eb89570604e53f
(cherry-picked from commit cc5c4e32637601432bc6359fb7ff34e4cadb6502)

Change-Id: I29e6e7365654cc1a538272591356e2253d6ec0e4
/frameworks/native/cmds/installd/dexopt.cpp
c4ced4f015ef5ba66cc89440c89369190448a4e0 15-Apr-2017 Andreas Gampe <agampe@google.com> OtaPreopt: Add version support

Add versioning to otapreopt:

Give up on having otapreopt being a mostly-ignorant frontend to a
blackbox dexopt function. Remove the dexopt helper taking a char*[], and
replace with a direct call to the typed signature.

Add support for a versioned dexopt command. The current version is
"2." An unversioned command string is either version "1" (N) or
version "2" (O pre-versioning).

Translate version 1 to version 2 by
* filter DEXOPT_OTA
* override dexopt_needed to DEX2OAT_FROM_SCRATCH
* add null se_info

Bug: 37256688
Test: m
Test: Manual OTA N (v1) -> O (v2)
Test: Manual OTA O (pre-versioning) -> O (v2)
Test: Manual OTA O (v2) -> O (v2)
Change-Id: I9fff673f3ba99833e88cf1c5c9625f42436ec150
/frameworks/native/cmds/installd/dexopt.cpp
cb556e340b50d16e8fac41b0c69d8d35bd7915f9 05-Apr-2017 Calin Juravle <calin@google.com> Restore selinux labels for secondary dex oat directory

Bug: 36896515
Test: adb shell cmd package compile -r bg-dexopt --secondary-dex com.google.android.gms
adb shell ls
/data/user_de/0/com.google.android.gms/app_chimera/m/0000000c/oat/arm64/
-Z
youtube loads gms modules without extracting from apk

Change-Id: I4e12a6f532a1442a840e3ed8d01b98dd9a328eb6
/frameworks/native/cmds/installd/dexopt.cpp
ebc8a79bbc00759307bed9142b60cff1e35d79e0 05-Apr-2017 Calin Juravle <calin@google.com> Fix permission for public secondary dex files

- make the oat directory accessible by others
- if the dex files is readable by others and we are not doing a speed-
profile compilation make the oat file readable by others.

Bug: 36896515
Test: adb shell cmd package compile -r bg-dexopt --secondary-dex com.google.android.gms
check that the oat directory and files have the right permissions

Change-Id: I1829217004353fb8c86e5a6b7eb570555e36a495
/frameworks/native/cmds/installd/dexopt.cpp
013f02e58b0b17b5b9fb4b4a2b3dc482eecfc434 21-Mar-2017 Andreas Gampe <agampe@google.com> Installd: Clean up installd

Remove unnecessary includes.

Bug: 36336122
Test: m
Test: Device boots
Test: Can install apps
Change-Id: Iebbe049221d650667385efeac972956269bd53c2
/frameworks/native/cmds/installd/dexopt.cpp
114f08107be384a3f9cc954bdec2b6b7619354ae 09-Mar-2017 Calin Juravle <calin@google.com> Support profile guided compilation for secondary dex files

Test: adb shell cmd package bg-dexopt-job works for sercondary dex files
Bug: 26719109
Change-Id: I4011a780f65378c23a4631c07c37cdb4f5fee41e
/frameworks/native/cmds/installd/dexopt.cpp
4eba6d702e7ca40875d7e2d30129672a43d9a28b 15-Mar-2017 Calin Juravle <calin@google.com> Use assignment instead of reset for profile unique_fd

Using reset with a unique_fd will just convert the unique_fd to int
without releasing it.

Test: adb shell cmd package compile -m speed-profile com.google.android.googlequicksearchbox
Bug: 36234017
Change-Id: I577197ac4a147765191777a5ebc6ef150dea1027
/frameworks/native/cmds/installd/dexopt.cpp
1a0af3b982b851519b06233addaa9c3bcb61f627 09-Mar-2017 Calin Juravle <calin@google.com> Use unique_fd instead of fd_t when managing profiles

Long due code improvement...

This will make things cleaner when adding support for secondary dex
profiles.

Test: adb shell cmd package bg-dexopt-job
Bug: 26719109
Change-Id: I232759d76c285c9eed9885f8ee4b84431fd65d15
/frameworks/native/cmds/installd/dexopt.cpp
76268c56febde9a77183387fbd4baabe6694e6b5 09-Mar-2017 Calin Juravle <calin@google.com> Use std::string for profile operations instead of const char

Will make things cleaner when adding secondary dex profile support.

Also, add tests to verify profile path creation.

Bug: 26719109
Test: /data/nativetest64/installd_utils_test/installd_utils_test
Change-Id: I8cb1a11cefee21f5001d2b729110696d52fc8323
/frameworks/native/cmds/installd/dexopt.cpp
a2dbefc7a51482acb8d5d139c9e2f01306ef9ceb 09-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Disable input-vdex when doing speed-profile.

input-vdex and dexlayout are incompatible with each other.

bug: 36084905
bug: 36076104
bug: 36059948
bug: 35872504

Test: device boots, vdex works on OTA, input-vdex is not passed
for speed-profile.

Change-Id: I194311041899399db422867670f5e788d6b9ceeb
/frameworks/native/cmds/installd/dexopt.cpp
2289c0ac89acce109b3e93c434d86b20c5ecc1ad 15-Feb-2017 Calin Juravle <calin@google.com> Fix the ownership of compiler artifacts for secondary dex files

odex, vdex and art files should be owned by the app and not by system.

Test: verify odex and vdex owner:
adb shell cmd package compile -m speed --secondary-dex -f
com.google.android.gms
adb shell ls
/data/user/0/com.google.android.gms/app_chimera/m/00000004/oat/arm64/
-al
-rw-r--r-- 1 u0_a17 u0_a17 5640832 2017-02-02 18:00
DynamiteModulesA_GmsCore_prodmnc_alldpi_release.odex
-rw-r--r-- 1 u0_a17 u0_a17 3016818 2017-02-15 12:42
DynamiteModulesA_GmsCore_prodmnc_alldpi_release.vdex

Bug: 35389574
Bug: 32871170

(cherry picked from commit 944d0def1a628bcbd76056683085efd2b999fe5b)

Change-Id: I1f0d09d04807b6284d42f0cf89956322a4214d5f

Merged-In: I0650265cedcc572d43bb1fc0d0758ae43ea890b2
/frameworks/native/cmds/installd/dexopt.cpp
2ab108c5be96768ef094591720596fbc4b7f91f7 31-Jan-2017 Calin Juravle <calin@google.com> DEXOPT_FORCE may be passed for primary apk as well.

Remove the check that DEXOPT_FORCE is not set for primary apks. PM will
set it when forcing compilation.

Bug: 32871170
Test: adb shell cmd package compile -f m speed pkgname

(cherry picked from commit 259702336f5826d2a205a2b038cb5a3263fb10e9)

Change-Id: Id34cd1ec929a1e196caf61651a18eb9c275b2590

Merged-In: I690608c48a2c486230ca7d2328ac5c6181427328
/frameworks/native/cmds/installd/dexopt.cpp
c9eab382fa4d71ade0077e0547969a47f39ecf05 25-Jan-2017 Calin Juravle <calin@google.com> [Installd] Clean up logic for secondary dex oat files

Add a new method to installd, reconcileSecondaryOdex, which checks if
the given dex files still exist and if not, deletes the oat files that
were generated for it.

Test: devices bots
adb shell cmd package reconcile-secondary-dex
com.android.google.gms (after artificially/temporarily renaming some
dex files)

Bug: 32871170

(cherry picked from commit bd9683607d391a29b1422a50f8972267e9bddc47)

Change-Id: Icb5c71b43a0e531d5be5d900149e707d0fe0a8de

Merged-In: I8465a7be9fd4e44e191ad40f7bd0f41c8b2d6f73
/frameworks/native/cmds/installd/dexopt.cpp
80a2125b85eaa0916daea7e90b016fe4f1b59924 17-Jan-2017 Calin Juravle <calin@google.com> Add installd logic for compiling secondary dex files

Secondary dex compilation takes almost the same path as primary apk
compilation.

The main difference is in the fact that for secondary dex files we
create the oat dir on the fly and execute dexoptanalyzer (the equivalent
of GetDexOptNeeded) to check if we really need to perform the
compilation.

Test: adb shell cmd package compile -f -m speed --secondary-dex com.google.android.gms
Bug: 32871170

(cherry picked from commit 42451c029b0e87990e5833daea2286bb12c21df5)

Change-Id: Ie5efe6eccc6b8c91ca7bd7c9e680aa7288d79ae8

Merged-In: I2c56d57322899968a338ccabffca575d66f8ee08
/frameworks/native/cmds/installd/dexopt.cpp
3ef54f28c2143170e172fc12f0e9e6bde15ea4d3 25-Jan-2017 George Burgess IV <gbiv@google.com> Add permission bits to open calls with O_CREAT

Open needs a third argument if you pass it O_CREAT:
https://linux.die.net/man/3/open

This turns into a compile-time error with FORITFY, so we need this fixed
before our unbroken FORTIFY can go in.

(The TEMP_FAILURE_RETRY open isn't detected by clang FORTIFY, but I
noticed that open_reference_profile potentially passes in O_CREAT as an
open_flag.)

Bug: 32073964
Test: Now builds with clang FORTIFY; CtsCompilationTestCases passes;
manually verified that /data/misc/profiles/ref/*/primary.prof has rw
permissions after a successful `cmd package compile -m speed-profile`.
Change-Id: Ie707d5ad403d2f86c769277b3e0f147c45000a6b
/frameworks/native/cmds/installd/dexopt.cpp
36cebe7778a89fa1302a8828ade93db2d014c522 25-Jan-2017 George Burgess IV <gbiv@google.com> Replace strlen with arraysize in array bounds.

clang-FORTIFY doesn't let us evaluate strlen("foo") as a constant
expression that can be used in static array bounds. Instead, we'd need
to either do __builtin_strlen("foo") or arraysize("foo") - 1. Just use
arraysize here, since the extra 1 byte per array isn't likely to be a
terrible thing.

Happy to swap to __builtin_strlen if anyone cares deeply enough.

Bug: 32073964
Test: Now builds with clang FORTIFY.
Change-Id: I4c9b3eb74775901554b939246722bd3a22326d10
/frameworks/native/cmds/installd/dexopt.cpp
7a570e8a0091a93be7dfd98acbb693bbb6ace75a 15-Jan-2017 Calin Juravle <calin@google.com> Clean up and simplify the logic in dexopt

Make some order in dexopt logic by extracting independent parts in their
own helpers.

It will make further updates of dexopt simpler and easier to reason
about (e.g. for secondary dex files).

Test: device boots
adb shell cmd package compile -m speed|speed-profile packageName
install new packages

Bug: 32871170

(cherry picked from commit 4a391f80601d7f65d7e63353363e6d32868161d5)

Change-Id: If0c96174e904519a4332e54553690b691ff63149
/frameworks/native/cmds/installd/dexopt.cpp
7823e124e00576e20e47ec717cbe8bc89f0f2bf2 29-Sep-2016 Mark Salyzyn <salyzyn@google.com> Replace cutils/log.h and rationalize log/log.h and android/log.h

- cutils/log.h treat as deprecated and lead by example
- android/log.h to be used instead of log/log.h if possible
- add system includes that are assumed as side effects
- define LOG_TAG first

Test: compile
Bug: 31289077
Bug: 30465923
Change-Id: I8d99b24c333578c9b5aa9f2a01324bd0bba268dd
/frameworks/native/cmds/installd/dexopt.cpp
76cc027ca6ebfd2f870c1cbb8f1d1fd19e0ac8e9 08-Dec-2016 Richard Uhler <ruhler@google.com> Cleanup code given PATCHOAT_FOR_RELOCATION has been removed.

Test: make, device boots.
Bug: 33192586
Change-Id: Ic3937708a7dfcd16f02cf68fc20674ec457d60b7
/frameworks/native/cmds/installd/dexopt.cpp
4f8c1fd2ea233a343f05302221cb87d29fe06224 05-Jan-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Pass the same fd when compiling due to boot image update."
ca12228bc2a27b1cd01b820d01b2ef17622cc730 20-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Pass the same fd when compiling due to boot image update.

Test: device boots, apps get installed, OTA uses same vdex.
Change-Id: I913062630640f31a18d23b2f62afd74986322e6a
/frameworks/native/cmds/installd/dexopt.cpp
a5e161b1207ef447a51e99856097d69d4a6111e1 29-Sep-2016 Mark Salyzyn <salyzyn@google.com> Replace cutils/log.h and rationalize log/log.h and android/log.h

- cutils/log.h treat as deprecated and lead by example
- android/log.h to be used instead of log/log.h if required
- add system includes that are assumed as side effects of log.h
- modules that use SLOG should use SLOG for all logging (installd)
- define LOG_TAG first
- remove logging infrastructure if not used

Test: build
Bug: 31289077
Change-Id: Iea147a0104c7ab7f12451304131d6500f42141e7
/frameworks/native/cmds/installd/dexopt.cpp
90aff26f0135379db19432ae90c40c0831ba5954 12-Dec-2016 Jeff Sharkey <jsharkey@android.com> Split all dexopt-related code into dexopt.cpp.

Only a few minor changes to return bool instead of binder::Status.

Test: builds, boots, apps install/uninstall fine
Change-Id: I538024c0e9da8ca2c0983a6e779c34bd40752053
/frameworks/native/cmds/installd/dexopt.cpp
6c2c056193010cf93b4264810d462c120ce801c8 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Final push of installd to Binder; goodbye socket!

Move last two straggling installd commands to Binder and destroy the
socket-based communication channel forever.

Test: builds, boots, apps install fine, pre-OTA dexopt works
Bug: 13758960, 30944031
Change-Id: I2ecd604fb6627b9028a7e32f87d0367e4a4afde3
/frameworks/native/cmds/installd/dexopt.cpp