Merge "libbinder: hide Debug.h header"
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index ef052bd..cefcf64 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -175,8 +175,10 @@
private:
bool ReadSystemProperties() {
+ // TODO This file does not have a stable format. It should be read by
+ // code shared by init and otapreopt. See b/181182967#comment80
static constexpr const char* kPropertyFiles[] = {
- "/default.prop", "/system/build.prop"
+ "/system/build.prop"
};
for (size_t i = 0; i < arraysize(kPropertyFiles); ++i) {
@@ -193,28 +195,38 @@
// export NAME VALUE
// For simplicity, don't respect string quotation. The values we are interested in can be
// encoded without them.
+ // init.environ.rc and etc/classpath have the same format for
+ // environment variable exports and can be matched by the same regex.
+ // TODO Just like with the system-properties above we really should have
+ // common code between init and otapreopt to deal with reading these
+ // things. See b/181182967
+ static constexpr const char* kEnvironmentVariableSources[] = {
+ "/init.environ.rc", "/etc/classpath"
+ };
+
std::regex export_regex("\\s*export\\s+(\\S+)\\s+(\\S+)");
- bool parse_result = ParseFile("/init.environ.rc", [&](const std::string& line) {
- std::smatch export_match;
- if (!std::regex_match(line, export_match, export_regex)) {
+ for (const char* env_vars_file : kEnvironmentVariableSources) {
+ bool parse_result = ParseFile(env_vars_file, [&](const std::string& line) {
+ std::smatch export_match;
+ if (!std::regex_match(line, export_match, export_regex)) {
+ return true;
+ }
+
+ if (export_match.size() != 3) {
+ return true;
+ }
+
+ std::string name = export_match[1].str();
+ std::string value = export_match[2].str();
+
+ system_properties_.SetProperty(name, value);
+
return true;
+ });
+ if (!parse_result) {
+ return false;
}
-
- if (export_match.size() != 3) {
- return true;
- }
-
- std::string name = export_match[1].str();
- std::string value = export_match[2].str();
-
- system_properties_.SetProperty(name, value);
-
- return true;
- });
- if (!parse_result) {
- return false;
}
-
if (system_properties_.GetProperty(kAndroidDataPathPropertyName) == nullptr) {
return false;
}
diff --git a/cmds/installd/otapreopt_chroot.cpp b/cmds/installd/otapreopt_chroot.cpp
index 72c03bf..fb07840 100644
--- a/cmds/installd/otapreopt_chroot.cpp
+++ b/cmds/installd/otapreopt_chroot.cpp
@@ -28,6 +28,7 @@
#include <libdm/dm.h>
#include <selinux/android.h>
+#include <apex_file_repository.h>
#include <apexd.h>
#include "installd_constants.h"
@@ -64,11 +65,14 @@
// system/apex/apexd/apexd.cpp.
//
// Only scan the APEX directory under /system, /system_ext and /vendor (within the chroot dir).
- std::vector<const char*> apex_dirs{apex::kApexPackageSystemDir, apex::kApexPackageSystemExtDir,
+ std::vector<std::string> apex_dirs{apex::kApexPackageSystemDir, apex::kApexPackageSystemExtDir,
apex::kApexPackageVendorDir};
+ // Initialize ApexFileRepository used internally in ScanPackagesDirAndActivate.
+ // This is a quick fix to fix apex activation in otapreopt_chroot.
+ apex::ApexFileRepository::GetInstance().AddPreInstalledApex(apex_dirs);
for (const auto& dir : apex_dirs) {
// Cast call to void to suppress warn_unused_result.
- static_cast<void>(apex::ScanPackagesDirAndActivate(dir));
+ static_cast<void>(apex::ScanPackagesDirAndActivate(dir.c_str()));
}
return apex::GetActivePackages();
}
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index 44fda79..776d594 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -218,6 +218,11 @@
"performance*",
"portability*",
],
+
+ pgo: {
+ sampling: true,
+ profile_file: "libbinder/libbinder.profdata",
+ },
}
// AIDL interface between libbinder and framework.jar
diff --git a/opengl/libs/EGL/egl_angle_platform.cpp b/opengl/libs/EGL/egl_angle_platform.cpp
index 6c07ad4..4f85eff 100644
--- a/opengl/libs/EGL/egl_angle_platform.cpp
+++ b/opengl/libs/EGL/egl_angle_platform.cpp
@@ -24,16 +24,16 @@
#include <EGL/Platform.h>
#pragma GCC diagnostic pop
+#include <android-base/properties.h>
#include <android/dlext.h>
#include <dlfcn.h>
#include <graphicsenv/GraphicsEnv.h>
-#include <time.h>
#include <log/log.h>
+#include <time.h>
#include <vndksupport/linker.h>
namespace angle {
-constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
constexpr int kAngleDlFlags = RTLD_LOCAL | RTLD_NOW;
static GetDisplayPlatformFunc angleGetDisplayPlatform = nullptr;
@@ -107,18 +107,36 @@
android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
void* so = nullptr;
if (ns) {
+ // Loading from an APK, so hard-code the suffix to "_angle".
+ constexpr char kAngleEs2Lib[] = "libGLESv2_angle.so";
const android_dlextinfo dlextinfo = {
.flags = ANDROID_DLEXT_USE_NAMESPACE,
.library_namespace = ns,
};
so = android_dlopen_ext(kAngleEs2Lib, kAngleDlFlags, &dlextinfo);
+ if (so) {
+ ALOGD("dlopen_ext from APK (%s) success at %p", kAngleEs2Lib, so);
+ } else {
+ ALOGE("dlopen_ext(\"%s\") failed: %s", kAngleEs2Lib, dlerror());
+ return false;
+ }
} else {
// If we are here, ANGLE is loaded as built-in gl driver in the sphal.
- so = android_load_sphal_library(kAngleEs2Lib, kAngleDlFlags);
- }
- if (!so) {
- ALOGE("%s failed to dlopen %s!", __FUNCTION__, kAngleEs2Lib);
- return false;
+ // Get the specified ANGLE library filename suffix.
+ std::string angleEs2LibSuffix = android::base::GetProperty("ro.hardware.egl", "");
+ if (angleEs2LibSuffix.empty()) {
+ ALOGE("%s failed to get valid ANGLE library filename suffix!", __FUNCTION__);
+ return false;
+ }
+
+ std::string angleEs2LibName = "libGLESv2_" + angleEs2LibSuffix + ".so";
+ so = android_load_sphal_library(angleEs2LibName.c_str(), kAngleDlFlags);
+ if (so) {
+ ALOGD("dlopen (%s) success at %p", angleEs2LibName.c_str(), so);
+ } else {
+ ALOGE("%s failed to dlopen %s!", __FUNCTION__, angleEs2LibName.c_str());
+ return false;
+ }
}
angleGetDisplayPlatform =