Fix buildbots hidden_api_test
Target buildbots set /system to be the runtime module root because they
are running without an apex. The test assumes that /system dex files are assigned
to the application domain but here they get assigned to the core-platform domain.
Adjust the domain setting logic to check if the runtime module root is
distict from the android root (as a proxy for 'is running with apex').
If not (as is the case with the buildbots), skip checks against apex
locations.
Test: m test-art-target-gtest-hidden_api_test
Change-Id: Iff3890ec69cb04a1e4ed5bc2a3b5c652ada05f36
diff --git a/runtime/hidden_api.cc b/runtime/hidden_api.cc
index 23e2e1f..4ef3842 100644
--- a/runtime/hidden_api.cc
+++ b/runtime/hidden_api.cc
@@ -76,20 +76,23 @@
static Domain DetermineDomainFromPath_Impl(const std::string& path,
const std::string& dex_location,
ObjPtr<mirror::ClassLoader> class_loader) {
- // We check /system/framework before the runtime module location, because the
- // runtime module location in a testing environment could be /system.
+ // If running with APEX, check `path` against known APEX locations.
+ // These checks will be skipped on target buildbots where ANDROID_RUNTIME_ROOT
+ // is set to "/system".
+ if (RuntimeModuleRootDistinctFromAndroidRoot()) {
+ if (LocationIsOnRuntimeModule(path.c_str()) || LocationIsOnConscryptModule(path.c_str())) {
+ return Domain::kCorePlatform;
+ }
+
+ if (LocationIsOnApex(path.c_str())) {
+ return Domain::kPlatform;
+ }
+ }
+
if (LocationIsOnSystemFramework(path.c_str())) {
return Domain::kPlatform;
}
- if (LocationIsOnRuntimeModule(path.c_str()) || LocationIsOnConscryptModule(path.c_str())) {
- return Domain::kCorePlatform;
- }
-
- if (LocationIsOnApex(path.c_str())) {
- return Domain::kPlatform;
- }
-
if (class_loader.IsNull()) {
LOG(WARNING) << "DexFile " << dex_location
<< " is in boot class path but its path " << path << " is not in a known location";