forked from LineageOS/android_art
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
odrefresh: regenerate artifacts after ART APEX update
Replaces compile_bcp.sh to check and compile boot class path extensions and system server jars. Enable ART to load those artifacts when present in the ART APEX data directory. Bug: 160683548 Test: art_libartbase_tests Test: adb root && adb odrefresh {--force-check,--force-compile} Test: adb install com.android.art && adb reboot && adb root && \ adb shell odrefresh {--check,--compile} && adb reboot && \ adb shell cat /proc/<zygote>/maps | grep apexdata Change-Id: I81bf520d38f9dc0109c91f192bc6e728099049fd
- Loading branch information
Showing
19 changed files
with
1,634 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
#include <stdlib.h> | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
#include <android-base/logging.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// | ||
// Copyright (C) 2020 The Android Open Source Project | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
cc_defaults { | ||
name: "odrefresh-defaults", | ||
host_supported: true, | ||
defaults: ["art_defaults"], | ||
srcs: [ | ||
"odrefresh.cc", | ||
], | ||
local_include_dirs: ["include"], | ||
header_libs: ["dexoptanalyzer_headers"], | ||
generated_sources: ["apex-info-list"], | ||
shared_libs: [ | ||
"libartpalette", | ||
"libbase", | ||
"liblog", | ||
], | ||
static_libs: ["libxml2"], | ||
target: { | ||
android: { | ||
// Use the 32-bit version of odrefresh on devices. | ||
compile_multilib: "prefer32", | ||
}, | ||
linux: { | ||
enabled: true, | ||
}, | ||
host: { | ||
shared_libs: [ | ||
// Both these libraries for libxml2 on host for code derived from apex-info-list. | ||
"libicui18n", | ||
"libicuuc", | ||
], | ||
}, | ||
}, | ||
tidy: true, | ||
tidy_flags: [ | ||
"-format-style='file'", | ||
"--header-filter='system/apex/'", | ||
], | ||
} | ||
|
||
cc_library_headers { | ||
name: "odrefresh_headers", | ||
export_include_dirs: ["include"], | ||
host_supported: true, | ||
stl: "none", | ||
system_shared_libs: [], | ||
min_sdk_version: "29", // As part of mainline modules(APEX), it should support at least 29(Q). | ||
sdk_version: "minimum", // The minimum sdk version required by users of this module. | ||
apex_available: [ | ||
"//apex_available:platform", // For odsign. | ||
], | ||
visibility: ["//visibility:public"], | ||
} | ||
|
||
art_cc_binary { | ||
name: "odrefresh", | ||
defaults: ["odrefresh-defaults"], | ||
required: [ | ||
"dexoptanalyzer", | ||
"dex2oat", | ||
], | ||
shared_libs: [ | ||
"libart", | ||
"libartbase", | ||
], | ||
apex_available: [ | ||
"com.android.art", | ||
"com.android.art.debug", | ||
], | ||
} | ||
|
||
art_cc_binary { | ||
name: "odrefreshd", | ||
defaults: [ | ||
"art_debug_defaults", | ||
"odrefresh-defaults", | ||
], | ||
required: [ | ||
"dexoptanalyzerd", | ||
"dex2oatd", | ||
], | ||
shared_libs: [ | ||
"libartd", | ||
"libartbased", | ||
], | ||
apex_available: [ | ||
"com.android.art.debug", | ||
], | ||
} | ||
|
||
art_cc_test { | ||
name: "art_odrefresh_tests", | ||
defaults: [ | ||
"art_gtest_defaults", | ||
], | ||
header_libs: ["odrefresh_headers"], | ||
srcs: [ | ||
"odr_artifacts_test.cc", | ||
"odrefresh_test.cc", | ||
], | ||
shared_libs: [ | ||
"libbase", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# On-Device Refresh (odrefresh) | ||
|
||
This tool is part of the ART APEX and is used to refresh compilation artifacts following an | ||
ART APEX update. It provides two key features: | ||
|
||
* checking the freshness of compilation artifacts for boot class path extensions and system_server. | ||
* regenerating the compilation artifacts for boot class path extensions and system_server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# TODO Work Items | ||
|
||
## TODO (STOPSHIP until done) | ||
|
||
1. Add a log file that tracks status of recent compilation. | ||
2. Implement back off on trying compilation when previous attempt(s) failed. | ||
3. Free space calculation and only attempting compilation if sufficient space. | ||
4. Metrics for tracking issues: | ||
- Successful compilation of all artifacts. | ||
- Time limit exceeded (indicates a pathological issue, e.g. dex2oat bug, device driver bug, etc). | ||
- Insufficient space for compilation. | ||
- Compilation failure (boot extensions) | ||
- Compilation failure (system server) | ||
- Unexpected error (a setup or clean-up action failed). | ||
5. Metrics recording for subprocess timeouts. | ||
6. Decide and implement testing. | ||
|
||
## DONE | ||
|
||
1. <strike>Fix dexoptanalyzer so it can analyze boot extensions.</strike> | ||
2. <strike>Parse apex-info-list.xml into an apex_info (to make version and location available).</strike> | ||
3. <strike>Timeouts for pathological failures.</strike> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (C) 2020 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef ART_ODREFRESH_INCLUDE_ODREFRESH_ODREFRESH_H_ | ||
#define ART_ODREFRESH_INCLUDE_ODREFRESH_ODREFRESH_H_ | ||
|
||
#include <sysexits.h> | ||
|
||
namespace art { | ||
namespace odrefresh { | ||
|
||
static constexpr const char* kOdrefreshArtifactDirectory = | ||
"/data/misc/apexdata/com.android.art/dalvik-cache"; | ||
|
||
// | ||
// Exit codes from the odrefresh process (in addition to standard exit codes in sysexits.h). | ||
// | ||
// NB if odrefresh crashes, then the caller should not sign any artifacts and should remove any | ||
// unsigned artifacts under `kOdrefreshArtifactDirectory`. | ||
// | ||
enum ExitCode { | ||
// No compilation required, all artifacts look good or there is insufficient space to compile. | ||
// For ART APEX in the system image, there may be no artifacts present under | ||
// `kOdrefreshArtifactDirectory`. | ||
kOkay = EX_OK, | ||
|
||
// Compilation required. Re-run program with --compile on the command-line to generate | ||
// new artifacts under `kOdrefreshArtifactDirectory`. | ||
kCompilationRequired = 1, | ||
|
||
// Compilation failed. Artifacts under `kOdrefreshArtifactDirectory` will be valid. This may | ||
// happen, for example, if compilation of boot extensions succeeds, but the compilation of the | ||
// system_server jars fails due to lack of storage space. | ||
kCompilationFailed = 2, | ||
}; | ||
|
||
static_assert(EX_OK == 0); | ||
static_assert(ExitCode::kOkay < EX__BASE); | ||
static_assert(ExitCode::kCompilationFailed < EX__BASE); | ||
|
||
} // namespace odrefresh | ||
} // namespace art | ||
|
||
#endif // ART_ODREFRESH_INCLUDE_ODREFRESH_ODREFRESH_H_ |
Oops, something went wrong.