Merge "Exclude libvndksupport from APEXes."
diff --git a/TEST_MAPPING b/TEST_MAPPING
index bc5685b..cc85408 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -19,6 +19,9 @@
"name": "libprocinfo_test"
},
{
+ "name": "libutils_test"
+ },
+ {
"name": "memunreachable_test"
},
{
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 8528752..ed955ea 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -114,25 +114,6 @@
return cmd;
}
-// Convenience wrapper over the property API that returns an
-// std::string.
-std::string GetProperty(const char* key) {
- std::vector<char> temp(PROPERTY_VALUE_MAX);
- const int len = property_get(key, &temp[0], nullptr);
- if (len < 0) {
- return "";
- }
- return std::string(&temp[0], len);
-}
-
-bool SetProperty(const char* key, const std::string& val) {
- return property_set(key, val.c_str()) == 0;
-}
-
-bool SetProperty(const char* key, const char* val) {
- return property_set(key, val) == 0;
-}
-
constexpr int32_t kEmptyBootReason = 0;
constexpr int32_t kUnknownBootReason = 1;
@@ -746,11 +727,13 @@
void BootReasonAddToHistory(const std::string& system_boot_reason) {
if (system_boot_reason.empty()) return;
LOG(INFO) << "Canonical boot reason: " << system_boot_reason;
- auto old_system_boot_reason = GetProperty(system_reboot_reason_property);
- if (!SetProperty(system_reboot_reason_property, system_boot_reason)) {
- SetProperty(system_reboot_reason_property, system_boot_reason.substr(0, PROPERTY_VALUE_MAX - 1));
+ auto old_system_boot_reason = android::base::GetProperty(system_reboot_reason_property, "");
+ if (!android::base::SetProperty(system_reboot_reason_property, system_boot_reason)) {
+ android::base::SetProperty(system_reboot_reason_property,
+ system_boot_reason.substr(0, PROPERTY_VALUE_MAX - 1));
}
- auto reason_history = android::base::Split(GetProperty(history_reboot_reason_property), "\n");
+ auto reason_history =
+ android::base::Split(android::base::GetProperty(history_reboot_reason_property, ""), "\n");
static auto mark = time(nullptr);
auto mark_str = std::string(",") + std::to_string(mark);
auto marked_system_boot_reason = system_boot_reason + mark_str;
@@ -773,7 +756,8 @@
reason_history.insert(reason_history.begin(), marked_system_boot_reason);
// If the property string is too long ( > PROPERTY_VALUE_MAX)
// we get an error, so trim out last entry and try again.
- while (!(SetProperty(history_reboot_reason_property, android::base::Join(reason_history, '\n')))) {
+ while (!android::base::SetProperty(history_reboot_reason_property,
+ android::base::Join(reason_history, '\n'))) {
auto it = std::prev(reason_history.end());
if (it == reason_history.end()) break;
reason_history.erase(it);
@@ -782,7 +766,7 @@
// Scrub, Sanitize, Standardize and Enhance the boot reason string supplied.
std::string BootReasonStrToReason(const std::string& boot_reason) {
- std::string ret(GetProperty(system_reboot_reason_property));
+ auto ret = android::base::GetProperty(system_reboot_reason_property, "");
std::string reason(boot_reason);
// If sys.boot.reason == ro.boot.bootreason, let's re-evaluate
if (reason == ret) ret = "";
@@ -922,7 +906,7 @@
if (isBluntRebootReason(ret)) {
// Content buffer no longer will have console data. Beware if more
// checks added below, that depend on parsing console content.
- content = GetProperty(last_reboot_reason_property);
+ content = android::base::GetProperty(last_reboot_reason_property, "");
transformReason(content);
// Anything in last is better than 'super-blunt' reboot or shutdown.
@@ -966,7 +950,7 @@
static const std::string kBuildDateKey = "build_date";
std::string boot_complete_prefix = "boot_complete";
- std::string build_date_str = GetProperty("ro.build.date.utc");
+ auto build_date_str = android::base::GetProperty("ro.build.date.utc", "");
int32_t build_date;
if (!android::base::ParseInt(build_date_str, &build_date)) {
return std::string();
@@ -989,7 +973,7 @@
// Records the value of a given ro.boottime.init property in milliseconds.
void RecordInitBootTimeProp(BootEventRecordStore* boot_event_store, const char* property) {
- std::string value = GetProperty(property);
+ auto value = android::base::GetProperty(property, "");
int32_t time_in_ms;
if (android::base::ParseInt(value, &time_in_ms)) {
@@ -1007,7 +991,7 @@
// |ro.boot.boottime| is of the form 'stage1:time1,...,stageN:timeN',
// where timeN is in milliseconds.
- std::string value = GetProperty("ro.boot.boottime");
+ auto value = android::base::GetProperty("ro.boot.boottime", "");
if (value.empty()) {
// ro.boot.boottime is not reported on all devices.
return BootloaderTimingMap();
@@ -1081,7 +1065,7 @@
void LogBootInfoToStatsd(std::chrono::milliseconds end_time,
std::chrono::milliseconds total_duration, int32_t bootloader_duration_ms,
double time_since_last_boot_sec) {
- const std::string reason(GetProperty(bootloader_reboot_reason_property));
+ const auto reason = android::base::GetProperty(bootloader_reboot_reason_property, "");
if (reason.empty()) {
android::util::stats_write(android::util::BOOT_SEQUENCE_REPORTED, "<EMPTY>", "<EMPTY>",
@@ -1091,7 +1075,7 @@
return;
}
- const std::string system_reason(GetProperty(system_reboot_reason_property));
+ const auto system_reason = android::base::GetProperty(system_reboot_reason_property, "");
android::util::stats_write(android::util::BOOT_SEQUENCE_REPORTED, reason.c_str(),
system_reason.c_str(), end_time.count(), total_duration.count(),
(int64_t)bootloader_duration_ms,
@@ -1099,19 +1083,20 @@
}
void SetSystemBootReason() {
- const std::string bootloader_boot_reason(GetProperty(bootloader_reboot_reason_property));
+ const auto bootloader_boot_reason =
+ android::base::GetProperty(bootloader_reboot_reason_property, "");
const std::string system_boot_reason(BootReasonStrToReason(bootloader_boot_reason));
// Record the scrubbed system_boot_reason to the property
BootReasonAddToHistory(system_boot_reason);
// Shift last_reboot_reason_property to last_last_reboot_reason_property
- std::string last_boot_reason(GetProperty(last_reboot_reason_property));
+ auto last_boot_reason = android::base::GetProperty(last_reboot_reason_property, "");
if (last_boot_reason.empty() || isKernelRebootReason(system_boot_reason)) {
last_boot_reason = system_boot_reason;
} else {
transformReason(last_boot_reason);
}
- SetProperty(last_last_reboot_reason_property, last_boot_reason);
- SetProperty(last_reboot_reason_property, "");
+ android::base::SetProperty(last_last_reboot_reason_property, last_boot_reason);
+ android::base::SetProperty(last_reboot_reason_property, "");
}
// Gets the boot time offset. This is useful when Android is running in a
@@ -1198,7 +1183,7 @@
// Records the boot_reason metric by querying the ro.boot.bootreason system
// property.
void RecordBootReason() {
- const std::string reason(GetProperty(bootloader_reboot_reason_property));
+ const auto reason = android::base::GetProperty(bootloader_reboot_reason_property, "");
if (reason.empty()) {
// Log an empty boot reason value as '<EMPTY>' to ensure the value is intentional
@@ -1216,12 +1201,12 @@
boot_event_store.AddBootEventWithValue("boot_reason", boot_reason);
// Log the scrubbed system_boot_reason.
- const std::string system_reason(GetProperty(system_reboot_reason_property));
+ const auto system_reason = android::base::GetProperty(system_reboot_reason_property, "");
int32_t system_boot_reason = BootReasonStrToEnum(system_reason);
boot_event_store.AddBootEventWithValue("system_boot_reason", system_boot_reason);
if (reason == "") {
- SetProperty(bootloader_reboot_reason_property, system_reason);
+ android::base::SetProperty(bootloader_reboot_reason_property, system_reason);
}
}
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index e684293..b69e773 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -85,6 +85,7 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
+using android::base::Basename;
using android::base::Realpath;
using android::base::StartsWith;
using android::base::unique_fd;
@@ -1576,65 +1577,41 @@
return true;
}
-bool fs_mgr_update_verity_state(
- std::function<void(const std::string& mount_point, int mode)> callback) {
- if (!callback) {
- return false;
- }
-
- int mode;
- if (!fs_mgr_load_verity_state(&mode)) {
- return false;
- }
-
- Fstab fstab;
- if (!ReadDefaultFstab(&fstab)) {
- LERROR << "Failed to read default fstab";
+bool fs_mgr_is_verity_enabled(const FstabEntry& entry) {
+ if (!entry.fs_mgr_flags.verify && !entry.fs_mgr_flags.avb) {
return false;
}
DeviceMapper& dm = DeviceMapper::Instance();
- for (const auto& entry : fstab) {
- if (!entry.fs_mgr_flags.verify && !entry.fs_mgr_flags.avb) {
- continue;
- }
-
- std::string mount_point;
- if (entry.mount_point == "/") {
- // In AVB, the dm device name is vroot instead of system.
- mount_point = entry.fs_mgr_flags.avb ? "vroot" : "system";
- } else {
- mount_point = basename(entry.mount_point.c_str());
- }
-
- if (dm.GetState(mount_point) == DmDeviceState::INVALID) {
- PERROR << "Could not find verity device for mount point: " << mount_point;
- continue;
- }
-
- const char* status;
- std::vector<DeviceMapper::TargetInfo> table;
- if (!dm.GetTableStatus(mount_point, &table) || table.empty() || table[0].data.empty()) {
- if (!entry.fs_mgr_flags.verify_at_boot) {
- PERROR << "Failed to query DM_TABLE_STATUS for " << mount_point;
- continue;
- }
- status = "V";
- } else {
- status = table[0].data.c_str();
- }
-
- // To be consistent in vboot 1.0 and vboot 2.0 (AVB), change the mount_point
- // back to 'system' for the callback. So it has property [partition.system.verified]
- // instead of [partition.vroot.verified].
- if (mount_point == "vroot") mount_point = "system";
- if (*status == 'C' || *status == 'V') {
- callback(mount_point, mode);
- }
+ std::string mount_point;
+ if (entry.mount_point == "/") {
+ // In AVB, the dm device name is vroot instead of system.
+ mount_point = entry.fs_mgr_flags.avb ? "vroot" : "system";
+ } else {
+ mount_point = Basename(entry.mount_point);
}
- return true;
+ if (dm.GetState(mount_point) == DmDeviceState::INVALID) {
+ return false;
+ }
+
+ const char* status;
+ std::vector<DeviceMapper::TargetInfo> table;
+ if (!dm.GetTableStatus(mount_point, &table) || table.empty() || table[0].data.empty()) {
+ if (!entry.fs_mgr_flags.verify_at_boot) {
+ return false;
+ }
+ status = "V";
+ } else {
+ status = table[0].data.c_str();
+ }
+
+ if (*status == 'C' || *status == 'V') {
+ return true;
+ }
+
+ return false;
}
std::string fs_mgr_get_super_partition_name(int slot) {
diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp
index b508b56..87729cd 100644
--- a/fs_mgr/fs_mgr_overlayfs.cpp
+++ b/fs_mgr/fs_mgr_overlayfs.cpp
@@ -272,15 +272,6 @@
return false;
}
-std::vector<std::string> fs_mgr_overlayfs_verity_enabled_list() {
- std::vector<std::string> ret;
- auto save_errno = errno;
- fs_mgr_update_verity_state(
- [&ret](const std::string& mount_point, int) { ret.emplace_back(mount_point); });
- if ((errno == ENOENT) || (errno == ENXIO)) errno = save_errno;
- return ret;
-}
-
bool fs_mgr_wants_overlayfs(FstabEntry* entry) {
// Don't check entries that are managed by vold.
if (entry->fs_mgr_flags.vold_managed || entry->fs_mgr_flags.recovery_only) return false;
@@ -537,7 +528,6 @@
std::vector<std::string> fs_mgr_candidate_list(Fstab* fstab, const char* mount_point = nullptr) {
std::vector<std::string> mounts;
- auto verity = fs_mgr_overlayfs_verity_enabled_list();
for (auto& entry : *fstab) {
if (!fs_mgr_overlayfs_already_mounted(entry.mount_point) &&
!fs_mgr_wants_overlayfs(&entry)) {
@@ -545,10 +535,12 @@
}
std::string new_mount_point(fs_mgr_mount_point(entry.mount_point.c_str()));
if (mount_point && (new_mount_point != mount_point)) continue;
- if (std::find(verity.begin(), verity.end(), android::base::Basename(new_mount_point)) !=
- verity.end()) {
- continue;
- }
+
+ auto saved_errno = errno;
+ auto verity_enabled = fs_mgr_is_verity_enabled(entry);
+ if (errno == ENOENT || errno == ENXIO) errno = saved_errno;
+ if (verity_enabled) continue;
+
auto duplicate_or_more_specific = false;
for (auto it = mounts.begin(); it != mounts.end();) {
if ((*it == new_mount_point) ||
@@ -565,26 +557,6 @@
if (!duplicate_or_more_specific) mounts.emplace_back(new_mount_point);
}
- // if not itemized /system or /, system as root, fake one up?
-
- // do we want or need to?
- if (mount_point && ("/system"s != mount_point)) return mounts;
- if (std::find(mounts.begin(), mounts.end(), "/system") != mounts.end()) return mounts;
-
- // fs_mgr_overlayfs_verity_enabled_list says not to?
- if (std::find(verity.begin(), verity.end(), "system") != verity.end()) return mounts;
-
- // confirm that fstab is missing system
- if (GetEntryForMountPoint(fstab, "/") != nullptr ||
- GetEntryForMountPoint(fstab, "/system") != nullptr) {
- return mounts;
- }
-
- // We have a stunted fstab (w/o system or / ) passed in by the caller,
- // verity claims are assumed accurate because they are collected internally
- // from fs_mgr_fstab_default() from within fs_mgr_update_verity_state(),
- // Can (re)evaluate /system with impunity since we know it is ever-present.
- mounts.emplace_back("/system");
return mounts;
}
diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h
index 8af80a7..a3bb852 100644
--- a/fs_mgr/include/fs_mgr.h
+++ b/fs_mgr/include/fs_mgr.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef __CORE_FS_MGR_H
-#define __CORE_FS_MGR_H
+#pragma once
#include <stdio.h>
#include <stdint.h>
@@ -73,8 +72,8 @@
const std::string& mount_point = "");
int fs_mgr_do_tmpfs_mount(const char *n_name);
bool fs_mgr_load_verity_state(int* mode);
-bool fs_mgr_update_verity_state(
- std::function<void(const std::string& mount_point, int mode)> callback);
+// Returns true if verity is enabled on this particular FstabEntry.
+bool fs_mgr_is_verity_enabled(const android::fs_mgr::FstabEntry& entry);
bool fs_mgr_swapon_all(const android::fs_mgr::Fstab& fstab);
bool fs_mgr_update_logical_partition(android::fs_mgr::FstabEntry* entry);
@@ -90,5 +89,3 @@
// specified, the super partition for the corresponding metadata slot will be
// returned. Otherwise, it will use the current slot.
std::string fs_mgr_get_super_partition_name(int slot = -1);
-
-#endif /* __CORE_FS_MGR_H */
diff --git a/init/builtins.cpp b/init/builtins.cpp
index c8ceb0c..538ed00 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -75,6 +75,7 @@
using namespace std::literals::string_literals;
+using android::base::Basename;
using android::base::unique_fd;
using android::fs_mgr::Fstab;
using android::fs_mgr::ReadFstabFromFile;
@@ -749,11 +750,27 @@
}
static Result<Success> do_verity_update_state(const BuiltinArguments& args) {
- if (!fs_mgr_update_verity_state([](const std::string& mount_point, int mode) {
- property_set("partition." + mount_point + ".verified", std::to_string(mode));
- })) {
- return Error() << "fs_mgr_update_verity_state() failed";
+ int mode;
+ if (!fs_mgr_load_verity_state(&mode)) {
+ return Error() << "fs_mgr_load_verity_state() failed";
}
+
+ Fstab fstab;
+ if (!ReadDefaultFstab(&fstab)) {
+ return Error() << "Failed to read default fstab";
+ }
+
+ for (const auto& entry : fstab) {
+ if (!fs_mgr_is_verity_enabled(entry)) {
+ continue;
+ }
+
+ // To be consistent in vboot 1.0 and vboot 2.0 (AVB), use "system" for the partition even
+ // for system as root, so it has property [partition.system.verified].
+ std::string partition = entry.mount_point == "/" ? "system" : Basename(entry.mount_point);
+ property_set("partition." + partition + ".verified", std::to_string(mode));
+ }
+
return Success();
}
diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp
index 7d5bf57..1b077bc 100644
--- a/init/first_stage_mount.cpp
+++ b/init/first_stage_mount.cpp
@@ -157,6 +157,37 @@
return fstab;
}
+static bool GetRootEntry(FstabEntry* root_entry) {
+ Fstab proc_mounts;
+ if (!ReadFstabFromFile("/proc/mounts", &proc_mounts)) {
+ LOG(ERROR) << "Could not read /proc/mounts and /system not in fstab, /system will not be "
+ "available for overlayfs";
+ return false;
+ }
+
+ auto entry = std::find_if(proc_mounts.begin(), proc_mounts.end(), [](const auto& entry) {
+ return entry.mount_point == "/" && entry.fs_type != "rootfs";
+ });
+
+ if (entry == proc_mounts.end()) {
+ LOG(ERROR) << "Could not get mount point for '/' in /proc/mounts, /system will not be "
+ "available for overlayfs";
+ return false;
+ }
+
+ *root_entry = std::move(*entry);
+
+ // We don't know if we're avb or not, so we query device mapper as if we are avb. If we get a
+ // success, then mark as avb, otherwise default to verify.
+ auto& dm = android::dm::DeviceMapper::Instance();
+ if (dm.GetState("vroot") != android::dm::DmDeviceState::INVALID) {
+ root_entry->fs_mgr_flags.avb = true;
+ } else {
+ root_entry->fs_mgr_flags.verify = true;
+ }
+ return true;
+}
+
// Class Definitions
// -----------------
FirstStageMount::FirstStageMount(Fstab fstab)
@@ -443,7 +474,7 @@
if (system_partition == fstab_.end()) return true;
- if (MountPartition(system_partition, true /* erase_used_fstab_entry */)) {
+ if (MountPartition(system_partition, false)) {
SwitchRoot("/system");
} else {
PLOG(ERROR) << "Failed to mount /system";
@@ -487,6 +518,12 @@
if (!TrySkipMountingPartitions()) return false;
for (auto current = fstab_.begin(); current != fstab_.end();) {
+ // We've already mounted /system above.
+ if (current->mount_point == "/system") {
+ ++current;
+ continue;
+ }
+
Fstab::iterator end;
if (!MountPartition(current, false, &end)) {
if (current->fs_mgr_flags.no_fail) {
@@ -503,6 +540,15 @@
current = end;
}
+ // If we don't see /system or / in the fstab, then we need to create an root entry for
+ // overlayfs.
+ if (!GetEntryForMountPoint(&fstab_, "/system") && !GetEntryForMountPoint(&fstab_, "/")) {
+ FstabEntry root_entry;
+ if (GetRootEntry(&root_entry)) {
+ fstab_.emplace_back(std::move(root_entry));
+ }
+ }
+
// heads up for instantiating required device(s) for overlayfs logic
const auto devices = fs_mgr_overlayfs_required_devices(&fstab_);
for (auto const& device : devices) {
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 91b7ddd..46e5e12 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -65,6 +65,7 @@
using namespace std::literals;
+using android::base::GetProperty;
using android::base::ReadFileToString;
using android::base::Split;
using android::base::StartsWith;
@@ -728,6 +729,110 @@
property_set("ro.persistent_properties.ready", "true");
}
+// If the ro.product.[brand|device|manufacturer|model|name] properties have not been explicitly
+// set, derive them from ro.product.${partition}.* properties
+static void property_initialize_ro_product_props() {
+ const char* RO_PRODUCT_PROPS_PREFIX = "ro.product.";
+ const char* RO_PRODUCT_PROPS[] = {
+ "brand", "device", "manufacturer", "model", "name",
+ };
+ const char* RO_PRODUCT_PROPS_ALLOWED_SOURCES[] = {
+ "odm", "product", "product_services", "system", "vendor",
+ };
+ const char* RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER =
+ "product,product_services,odm,vendor,system";
+ const std::string EMPTY = "";
+
+ std::string ro_product_props_source_order =
+ GetProperty("ro.product.property_source_order", EMPTY);
+
+ if (!ro_product_props_source_order.empty()) {
+ // Verify that all specified sources are valid
+ for (const auto& source : Split(ro_product_props_source_order, ",")) {
+ // Verify that the specified source is valid
+ bool is_allowed_source = false;
+ for (const auto& allowed_source : RO_PRODUCT_PROPS_ALLOWED_SOURCES) {
+ if (source == allowed_source) {
+ is_allowed_source = true;
+ break;
+ }
+ }
+ if (!is_allowed_source) {
+ LOG(ERROR) << "Found unexpected source in ro.product.property_source_order; "
+ "using the default property source order";
+ ro_product_props_source_order = RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER;
+ break;
+ }
+ }
+ } else {
+ ro_product_props_source_order = RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER;
+ }
+
+ for (const auto& ro_product_prop : RO_PRODUCT_PROPS) {
+ std::string base_prop(RO_PRODUCT_PROPS_PREFIX);
+ base_prop += ro_product_prop;
+
+ std::string base_prop_val = GetProperty(base_prop, EMPTY);
+ if (!base_prop_val.empty()) {
+ continue;
+ }
+
+ for (const auto& source : Split(ro_product_props_source_order, ",")) {
+ std::string target_prop(RO_PRODUCT_PROPS_PREFIX);
+ target_prop += source;
+ target_prop += '.';
+ target_prop += ro_product_prop;
+
+ std::string target_prop_val = GetProperty(target_prop, EMPTY);
+ if (!target_prop_val.empty()) {
+ LOG(INFO) << "Setting product property " << base_prop << " to '" << target_prop_val
+ << "' (from " << target_prop << ")";
+ std::string error;
+ uint32_t res = PropertySet(base_prop, target_prop_val, &error);
+ if (res != PROP_SUCCESS) {
+ LOG(ERROR) << "Error setting product property " << base_prop << ": err=" << res
+ << " (" << error << ")";
+ }
+ break;
+ }
+ }
+ }
+}
+
+// If the ro.build.fingerprint property has not been set, derive it from constituent pieces
+static void property_derive_build_fingerprint() {
+ std::string build_fingerprint = GetProperty("ro.build.fingerprint", "");
+ if (!build_fingerprint.empty()) {
+ return;
+ }
+
+ const std::string UNKNOWN = "unknown";
+ build_fingerprint = GetProperty("ro.product.brand", UNKNOWN);
+ build_fingerprint += '/';
+ build_fingerprint += GetProperty("ro.product.name", UNKNOWN);
+ build_fingerprint += '/';
+ build_fingerprint += GetProperty("ro.product.device", UNKNOWN);
+ build_fingerprint += ':';
+ build_fingerprint += GetProperty("ro.build.version.release", UNKNOWN);
+ build_fingerprint += '/';
+ build_fingerprint += GetProperty("ro.build.id", UNKNOWN);
+ build_fingerprint += '/';
+ build_fingerprint += GetProperty("ro.build.version.incremental", UNKNOWN);
+ build_fingerprint += ':';
+ build_fingerprint += GetProperty("ro.build.type", UNKNOWN);
+ build_fingerprint += '/';
+ build_fingerprint += GetProperty("ro.build.tags", UNKNOWN);
+
+ LOG(INFO) << "Setting property 'ro.build.fingerprint' to '" << build_fingerprint << "'";
+
+ std::string error;
+ uint32_t res = PropertySet("ro.build.fingerprint", build_fingerprint, &error);
+ if (res != PROP_SUCCESS) {
+ LOG(ERROR) << "Error setting property 'ro.build.fingerprint': err=" << res << " (" << error
+ << ")";
+ }
+}
+
void property_load_boot_defaults() {
// TODO(b/117892318): merge prop.default and build.prop files into one
// TODO(b/122864654): read the prop files from all partitions and then
@@ -749,6 +854,9 @@
load_properties_from_file("/vendor/build.prop", NULL);
load_properties_from_file("/factory/factory.prop", "ro.*");
+ property_initialize_ro_product_props();
+ property_derive_build_fingerprint();
+
update_sys_usb_config();
}
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index 17c8a13..b4b8cd1 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -196,4 +196,71 @@
],
}
-subdirs = ["tests"]
+cc_defaults {
+ name: "libcutils_test_default",
+ srcs: ["sockets_test.cpp"],
+
+ target: {
+ android: {
+ srcs: [
+ "android_get_control_file_test.cpp",
+ "android_get_control_socket_test.cpp",
+ "ashmem_test.cpp",
+ "fs_config_test.cpp",
+ "memset_test.cpp",
+ "multiuser_test.cpp",
+ "properties_test.cpp",
+ "sched_policy_test.cpp",
+ "str_parms_test.cpp",
+ "trace-dev_test.cpp",
+ ],
+ },
+
+ not_windows: {
+ srcs: [
+ "str_parms_test.cpp",
+ ],
+ },
+ },
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+}
+
+test_libraries = [
+ "libcutils",
+ "liblog",
+ "libbase",
+ "libjsoncpp",
+ "libprocessgroup",
+]
+
+cc_test {
+ name: "libcutils_test",
+ test_suites: ["device-tests"],
+ defaults: ["libcutils_test_default"],
+ host_supported: true,
+ shared_libs: test_libraries,
+}
+
+cc_test {
+ name: "libcutils_test_static",
+ test_suites: ["device-tests"],
+ defaults: ["libcutils_test_default"],
+ static_libs: ["libc"] + test_libraries,
+ stl: "libc++_static",
+
+ target: {
+ android: {
+ static_executable: true,
+ },
+ windows: {
+ host_ldlibs: ["-lws2_32"],
+
+ enabled: true,
+ },
+ },
+}
diff --git a/libcutils/tests/android_get_control_file_test.cpp b/libcutils/android_get_control_file_test.cpp
similarity index 100%
rename from libcutils/tests/android_get_control_file_test.cpp
rename to libcutils/android_get_control_file_test.cpp
diff --git a/libcutils/tests/android_get_control_socket_test.cpp b/libcutils/android_get_control_socket_test.cpp
similarity index 100%
rename from libcutils/tests/android_get_control_socket_test.cpp
rename to libcutils/android_get_control_socket_test.cpp
diff --git a/libcutils/tests/AshmemTest.cpp b/libcutils/ashmem_test.cpp
similarity index 100%
rename from libcutils/tests/AshmemTest.cpp
rename to libcutils/ashmem_test.cpp
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 6184813..f1dcd50 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -95,9 +95,7 @@
{ 00755, AID_ROOT, AID_ROOT, 0, "system/etc/ppp" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/vendor" },
{ 00751, AID_ROOT, AID_SHELL, 0, "system/xbin" },
- // TODO(b/123743953): eliminate the APEX name with better pattern matching
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.debug/bin" },
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.release/bin" },
+ { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/*/bin" },
{ 00751, AID_ROOT, AID_SHELL, 0, "vendor/bin" },
{ 00755, AID_ROOT, AID_SHELL, 0, "vendor" },
{ 00755, AID_ROOT, AID_ROOT, 0, 0 },
@@ -224,9 +222,7 @@
{ 00755, AID_ROOT, AID_ROOT, 0, "system/lib/valgrind/*" },
{ 00755, AID_ROOT, AID_ROOT, 0, "system/lib64/valgrind/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" },
- // TODO(b/123743953): eliminate the APEX name with better pattern matching
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.debug/bin/*" },
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.release/bin/*" },
+ { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/*/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "vendor/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "vendor/xbin/*" },
{ 00644, AID_ROOT, AID_ROOT, 0, 0 },
diff --git a/libcutils/tests/fs_config.cpp b/libcutils/fs_config_test.cpp
similarity index 100%
rename from libcutils/tests/fs_config.cpp
rename to libcutils/fs_config_test.cpp
diff --git a/libcutils/tests/MemsetTest.cpp b/libcutils/memset_test.cpp
similarity index 100%
rename from libcutils/tests/MemsetTest.cpp
rename to libcutils/memset_test.cpp
diff --git a/libcutils/tests/multiuser_test.cpp b/libcutils/multiuser_test.cpp
similarity index 100%
rename from libcutils/tests/multiuser_test.cpp
rename to libcutils/multiuser_test.cpp
diff --git a/libcutils/tests/PropertiesTest.cpp b/libcutils/properties_test.cpp
similarity index 100%
rename from libcutils/tests/PropertiesTest.cpp
rename to libcutils/properties_test.cpp
diff --git a/libcutils/tests/sched_policy_test.cpp b/libcutils/sched_policy_test.cpp
similarity index 96%
rename from libcutils/tests/sched_policy_test.cpp
rename to libcutils/sched_policy_test.cpp
index 1f657e2..a321c90 100644
--- a/libcutils/tests/sched_policy_test.cpp
+++ b/libcutils/sched_policy_test.cpp
@@ -90,17 +90,18 @@
// A measureable effect of scheduling policy is that the kernel has 800x
// greater slack time in waking up a sleeping background thread.
//
- // Look for 100x difference in how long FB and BG threads actually sleep
+ // Look for 10x difference in how long FB and BG threads actually sleep
// when trying to sleep for 1 ns. This difference is large enough not
// to happen by chance, but small enough (compared to 800x) to keep inherent
// fuzziness in scheduler behavior from causing false negatives.
- const unsigned int BG_FG_SLACK_FACTOR = 100;
+ const unsigned int BG_FG_SLACK_FACTOR = 10;
ASSERT_EQ(0, set_sched_policy(0, SP_BACKGROUND));
auto bgSleepTime = medianSleepTime();
ASSERT_EQ(0, set_sched_policy(0, SP_FOREGROUND));
auto fgSleepTime = medianSleepTime();
+
ASSERT_GT(bgSleepTime, fgSleepTime * BG_FG_SLACK_FACTOR);
}
diff --git a/libcutils/tests/sockets_test.cpp b/libcutils/sockets_test.cpp
similarity index 100%
rename from libcutils/tests/sockets_test.cpp
rename to libcutils/sockets_test.cpp
diff --git a/libcutils/tests/test_str_parms.cpp b/libcutils/str_parms_test.cpp
similarity index 100%
rename from libcutils/tests/test_str_parms.cpp
rename to libcutils/str_parms_test.cpp
diff --git a/libcutils/tests/Android.bp b/libcutils/tests/Android.bp
deleted file mode 100644
index 3892ce0..0000000
--- a/libcutils/tests/Android.bp
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2014 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: "libcutils_test_default",
- srcs: ["sockets_test.cpp"],
-
- target: {
- android: {
- srcs: [
- "AshmemTest.cpp",
- "fs_config.cpp",
- "MemsetTest.cpp",
- "PropertiesTest.cpp",
- "sched_policy_test.cpp",
- "trace-dev_test.cpp",
- "test_str_parms.cpp",
- "android_get_control_socket_test.cpp",
- "android_get_control_file_test.cpp",
- "multiuser_test.cpp",
- ],
- },
-
- not_windows: {
- srcs: [
- "test_str_parms.cpp",
- "fs_config.cpp",
- ],
- },
- },
-
- multilib: {
- lib32: {
- suffix: "32",
- },
- lib64: {
- suffix: "64",
- },
- },
-
- cflags: [
- "-Wall",
- "-Wextra",
- "-Werror",
- ],
-}
-
-test_libraries = [
- "libcutils",
- "liblog",
- "libbase",
- "libjsoncpp",
- "libprocessgroup",
-]
-
-cc_test {
- name: "libcutils_test",
- test_suites: ["device-tests"],
- defaults: ["libcutils_test_default"],
- host_supported: true,
- shared_libs: test_libraries,
-}
-
-cc_test {
- name: "libcutils_test_static",
- test_suites: ["device-tests"],
- defaults: ["libcutils_test_default"],
- static_libs: ["libc"] + test_libraries,
- stl: "libc++_static",
-
- target: {
- android: {
- static_executable: true,
- },
- windows: {
- host_ldlibs: ["-lws2_32"],
-
- enabled: true,
- },
- },
-}
diff --git a/libcutils/tests/AndroidTest.xml b/libcutils/tests/AndroidTest.xml
deleted file mode 100644
index dd7aca2..0000000
--- a/libcutils/tests/AndroidTest.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<configuration description="Config for libcutils_test">
- <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
- <option name="cleanup" value="true" />
- <option name="push" value="libcutils_test->/data/local/tmp/libcutils_test" />
- </target_preparer>
- <option name="test-suite-tag" value="apct" />
- <test class="com.android.tradefed.testtype.GTest" >
- <option name="native-test-device-path" value="/data/local/tmp" />
- <option name="module-name" value="libcutils_test" />
- </test>
-</configuration>
\ No newline at end of file
diff --git a/libcutils/tests/trace-dev_test.cpp b/libcutils/trace-dev_test.cpp
similarity index 100%
rename from libcutils/tests/trace-dev_test.cpp
rename to libcutils/trace-dev_test.cpp
diff --git a/liblog/Android.bp b/liblog/Android.bp
index bd7a551..1d4a0a0 100644
--- a/liblog/Android.bp
+++ b/liblog/Android.bp
@@ -101,7 +101,6 @@
cflags: [
"-Werror",
- "-fvisibility=hidden",
// This is what we want to do:
// liblog_cflags := $(shell \
// sed -n \
diff --git a/liblog/config_read.cpp b/liblog/config_read.cpp
index 80177a4..3139f78 100644
--- a/liblog/config_read.cpp
+++ b/liblog/config_read.cpp
@@ -19,10 +19,10 @@
#include "config_read.h"
#include "logger.h"
-LIBLOG_HIDDEN struct listnode __android_log_transport_read = {&__android_log_transport_read,
- &__android_log_transport_read};
-LIBLOG_HIDDEN struct listnode __android_log_persist_read = {&__android_log_persist_read,
- &__android_log_persist_read};
+struct listnode __android_log_transport_read = {&__android_log_transport_read,
+ &__android_log_transport_read};
+struct listnode __android_log_persist_read = {&__android_log_persist_read,
+ &__android_log_persist_read};
static void __android_log_add_transport(struct listnode* list,
struct android_log_transport_read* transport) {
@@ -52,7 +52,7 @@
}
}
-LIBLOG_HIDDEN void __android_log_config_read() {
+void __android_log_config_read() {
#if (FAKE_LOG_DEVICE == 0)
if ((__android_log_transport == LOGGER_DEFAULT) || (__android_log_transport & LOGGER_LOGD)) {
extern struct android_log_transport_read logdLoggerRead;
@@ -64,7 +64,7 @@
#endif
}
-LIBLOG_HIDDEN void __android_log_config_read_close() {
+void __android_log_config_read_close() {
struct android_log_transport_read* transport;
struct listnode* n;
diff --git a/liblog/config_read.h b/liblog/config_read.h
index 00ea453..212b8a0 100644
--- a/liblog/config_read.h
+++ b/liblog/config_read.h
@@ -22,8 +22,8 @@
__BEGIN_DECLS
-extern LIBLOG_HIDDEN struct listnode __android_log_transport_read;
-extern LIBLOG_HIDDEN struct listnode __android_log_persist_read;
+extern struct listnode __android_log_transport_read;
+extern struct listnode __android_log_persist_read;
#define read_transport_for_each(transp, transports) \
for ((transp) = node_to_item((transports)->next, \
@@ -46,7 +46,7 @@
(transp) = node_to_item((n), struct android_log_transport_read, node), \
(n) = (transp)->node.next)
-LIBLOG_HIDDEN void __android_log_config_read();
-LIBLOG_HIDDEN void __android_log_config_read_close();
+void __android_log_config_read();
+void __android_log_config_read_close();
__END_DECLS
diff --git a/liblog/config_write.cpp b/liblog/config_write.cpp
index e65c238..d454379 100644
--- a/liblog/config_write.cpp
+++ b/liblog/config_write.cpp
@@ -19,10 +19,10 @@
#include "config_write.h"
#include "logger.h"
-LIBLOG_HIDDEN struct listnode __android_log_transport_write = {&__android_log_transport_write,
- &__android_log_transport_write};
-LIBLOG_HIDDEN struct listnode __android_log_persist_write = {&__android_log_persist_write,
- &__android_log_persist_write};
+struct listnode __android_log_transport_write = {&__android_log_transport_write,
+ &__android_log_transport_write};
+struct listnode __android_log_persist_write = {&__android_log_persist_write,
+ &__android_log_persist_write};
static void __android_log_add_transport(struct listnode* list,
struct android_log_transport_write* transport) {
@@ -52,7 +52,7 @@
}
}
-LIBLOG_HIDDEN void __android_log_config_write() {
+void __android_log_config_write() {
if ((__android_log_transport == LOGGER_DEFAULT) || (__android_log_transport & LOGGER_LOGD)) {
#if (FAKE_LOG_DEVICE == 0)
extern struct android_log_transport_write logdLoggerWrite;
@@ -89,7 +89,7 @@
}
}
-LIBLOG_HIDDEN void __android_log_config_write_close() {
+void __android_log_config_write_close() {
struct android_log_transport_write* transport;
struct listnode* n;
diff --git a/liblog/config_write.h b/liblog/config_write.h
index e3be445..a901f13 100644
--- a/liblog/config_write.h
+++ b/liblog/config_write.h
@@ -22,8 +22,8 @@
__BEGIN_DECLS
-extern LIBLOG_HIDDEN struct listnode __android_log_transport_write;
-extern LIBLOG_HIDDEN struct listnode __android_log_persist_write;
+extern struct listnode __android_log_transport_write;
+extern struct listnode __android_log_persist_write;
#define write_transport_for_each(transp, transports) \
for ((transp) = node_to_item((transports)->next, \
@@ -46,7 +46,7 @@
(transp) = node_to_item((n), struct android_log_transport_write, node), \
(n) = (transp)->node.next)
-LIBLOG_HIDDEN void __android_log_config_write();
-LIBLOG_HIDDEN void __android_log_config_write_close();
+void __android_log_config_write();
+void __android_log_config_write_close();
__END_DECLS
diff --git a/liblog/event_tag_map.cpp b/liblog/event_tag_map.cpp
index 574a386..22cf43b 100644
--- a/liblog/event_tag_map.cpp
+++ b/liblog/event_tag_map.cpp
@@ -407,7 +407,7 @@
//
// We create a private mapping because we want to terminate the log tag
// strings with '\0'.
-LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) {
+EventTagMap* android_openEventTagMap(const char* fileName) {
EventTagMap* newTagMap;
off_t end[NUM_MAPS];
int save_errno, fd[NUM_MAPS];
@@ -488,7 +488,7 @@
}
// Close the map.
-LIBLOG_ABI_PUBLIC void android_closeEventTagMap(EventTagMap* map) {
+void android_closeEventTagMap(EventTagMap* map) {
if (map) delete map;
}
@@ -535,9 +535,7 @@
}
// Look up an entry in the map.
-LIBLOG_ABI_PUBLIC const char* android_lookupEventTag_len(const EventTagMap* map,
- size_t* len,
- unsigned int tag) {
+const char* android_lookupEventTag_len(const EventTagMap* map, size_t* len, unsigned int tag) {
if (len) *len = 0;
const TagFmt* str = map->find(tag);
if (!str) {
@@ -549,8 +547,7 @@
}
// Look up an entry in the map.
-LIBLOG_ABI_PUBLIC const char* android_lookupEventFormat_len(
- const EventTagMap* map, size_t* len, unsigned int tag) {
+const char* android_lookupEventFormat_len(const EventTagMap* map, size_t* len, unsigned int tag) {
if (len) *len = 0;
const TagFmt* str = map->find(tag);
if (!str) {
@@ -565,8 +562,7 @@
// since it will cause the map to change from Shared and backed by a file,
// to Private Dirty and backed up by swap, albeit highly compressible. By
// deprecating this function everywhere, we save 100s of MB of memory space.
-LIBLOG_ABI_PUBLIC const char* android_lookupEventTag(const EventTagMap* map,
- unsigned int tag) {
+const char* android_lookupEventTag(const EventTagMap* map, unsigned int tag) {
size_t len;
const char* tagStr = android_lookupEventTag_len(map, &len, tag);
@@ -578,9 +574,7 @@
}
// Look up tagname, generate one if necessary, and return a tag
-LIBLOG_ABI_PUBLIC int android_lookupEventTagNum(EventTagMap* map,
- const char* tagname,
- const char* format, int prio) {
+int android_lookupEventTagNum(EventTagMap* map, const char* tagname, const char* format, int prio) {
const char* ep = endOfTag(tagname);
size_t len = ep - tagname;
if (!len || *ep) {
diff --git a/liblog/fake_log_device.cpp b/liblog/fake_log_device.cpp
index 5daae41..428a482 100644
--- a/liblog/fake_log_device.cpp
+++ b/liblog/fake_log_device.cpp
@@ -548,7 +548,7 @@
* tag (N bytes -- null-terminated ASCII string)
* message (N bytes -- null-terminated ASCII string)
*/
-LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) {
+ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) {
LogState* state;
/* Make sure that no-one frees the LogState while we're using it.
@@ -623,7 +623,7 @@
* call is in the exit handler. Logging can continue in the exit handler to
* help debug HOST tools ...
*/
-LIBLOG_HIDDEN int fakeLogClose(int fd) {
+int fakeLogClose(int fd) {
deleteFakeFd(fd);
return 0;
}
@@ -631,7 +631,7 @@
/*
* Open a log output device and return a fake fd.
*/
-LIBLOG_HIDDEN int fakeLogOpen(const char* pathName) {
+int fakeLogOpen(const char* pathName) {
LogState* logState;
int fd = -1;
@@ -650,20 +650,20 @@
return fd;
}
-LIBLOG_HIDDEN ssize_t __send_log_msg(char*, size_t) {
+ssize_t __send_log_msg(char*, size_t) {
return -ENODEV;
}
-LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char*, int def) {
+int __android_log_is_loggable(int prio, const char*, int def) {
int logLevel = def;
return logLevel >= 0 && prio >= logLevel;
}
-LIBLOG_ABI_PUBLIC int __android_log_is_loggable_len(int prio, const char*, size_t, int def) {
+int __android_log_is_loggable_len(int prio, const char*, size_t, int def) {
int logLevel = def;
return logLevel >= 0 && prio >= logLevel;
}
-LIBLOG_ABI_PRIVATE int __android_log_is_debuggable() {
+int __android_log_is_debuggable() {
return 1;
}
diff --git a/liblog/fake_log_device.h b/liblog/fake_log_device.h
index ef0beb6..ce54db2 100644
--- a/liblog/fake_log_device.h
+++ b/liblog/fake_log_device.h
@@ -25,14 +25,13 @@
__BEGIN_DECLS
-LIBLOG_HIDDEN int fakeLogOpen(const char* pathName);
-LIBLOG_HIDDEN int fakeLogClose(int fd);
-LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector,
- int count);
+int fakeLogOpen(const char* pathName);
+int fakeLogClose(int fd);
+ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count);
-LIBLOG_HIDDEN ssize_t __send_log_msg(char*, size_t);
-LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char*, int def);
-LIBLOG_ABI_PUBLIC int __android_log_is_loggable_len(int prio, const char*, size_t, int def);
-LIBLOG_ABI_PRIVATE int __android_log_is_debuggable();
+ssize_t __send_log_msg(char*, size_t);
+int __android_log_is_loggable(int prio, const char*, int def);
+int __android_log_is_loggable_len(int prio, const char*, size_t, int def);
+int __android_log_is_debuggable();
__END_DECLS
diff --git a/liblog/fake_writer.cpp b/liblog/fake_writer.cpp
index 46d171b..c0b0e69 100644
--- a/liblog/fake_writer.cpp
+++ b/liblog/fake_writer.cpp
@@ -31,7 +31,7 @@
static int logFds[(int)LOG_ID_MAX] = {-1, -1, -1, -1, -1, -1};
-LIBLOG_HIDDEN struct android_log_transport_write fakeLoggerWrite = {
+struct android_log_transport_write fakeLoggerWrite = {
.node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node},
.context.priv = &logFds,
.name = "fake",
diff --git a/liblog/log_event_list.cpp b/liblog/log_event_list.cpp
index 088ea94..b1b527c 100644
--- a/liblog/log_event_list.cpp
+++ b/liblog/log_event_list.cpp
@@ -73,7 +73,7 @@
context->read_write_flag = kAndroidLoggerRead;
}
-LIBLOG_ABI_PUBLIC android_log_context create_android_logger(uint32_t tag) {
+android_log_context create_android_logger(uint32_t tag) {
android_log_context_internal* context;
context =
@@ -86,7 +86,7 @@
return (android_log_context)context;
}
-LIBLOG_ABI_PUBLIC android_log_context create_android_log_parser(const char* msg, size_t len) {
+android_log_context create_android_log_parser(const char* msg, size_t len) {
android_log_context_internal* context;
size_t i;
@@ -100,7 +100,7 @@
return (android_log_context)context;
}
-LIBLOG_ABI_PUBLIC int android_log_destroy(android_log_context* ctx) {
+int android_log_destroy(android_log_context* ctx) {
android_log_context_internal* context;
context = (android_log_context_internal*)*ctx;
@@ -113,7 +113,7 @@
return 0;
}
-LIBLOG_ABI_PUBLIC int android_log_reset(android_log_context ctx) {
+int android_log_reset(android_log_context ctx) {
android_log_context_internal* context;
uint32_t tag;
@@ -129,8 +129,7 @@
return 0;
}
-LIBLOG_ABI_PUBLIC int android_log_parser_reset(android_log_context ctx, const char* msg,
- size_t len) {
+int android_log_parser_reset(android_log_context ctx, const char* msg, size_t len) {
android_log_context_internal* context;
context = (android_log_context_internal*)ctx;
@@ -144,7 +143,7 @@
return 0;
}
-LIBLOG_ABI_PUBLIC int android_log_write_list_begin(android_log_context ctx) {
+int android_log_write_list_begin(android_log_context ctx) {
size_t needed;
android_log_context_internal* context;
@@ -185,7 +184,7 @@
buf[3] = (val >> 24) & 0xFF;
}
-LIBLOG_ABI_PUBLIC int android_log_write_int32(android_log_context ctx, int32_t value) {
+int android_log_write_int32(android_log_context ctx, int32_t value) {
size_t needed;
android_log_context_internal* context;
@@ -219,7 +218,7 @@
buf[7] = (val >> 56) & 0xFF;
}
-LIBLOG_ABI_PUBLIC int android_log_write_int64(android_log_context ctx, int64_t value) {
+int android_log_write_int64(android_log_context ctx, int64_t value) {
size_t needed;
android_log_context_internal* context;
@@ -242,8 +241,7 @@
return 0;
}
-LIBLOG_ABI_PUBLIC int android_log_write_string8_len(android_log_context ctx, const char* value,
- size_t maxlen) {
+int android_log_write_string8_len(android_log_context ctx, const char* value, size_t maxlen) {
size_t needed;
ssize_t len;
android_log_context_internal* context;
@@ -278,11 +276,11 @@
return len;
}
-LIBLOG_ABI_PUBLIC int android_log_write_string8(android_log_context ctx, const char* value) {
+int android_log_write_string8(android_log_context ctx, const char* value) {
return android_log_write_string8_len(ctx, value, MAX_EVENT_PAYLOAD);
}
-LIBLOG_ABI_PUBLIC int android_log_write_float32(android_log_context ctx, float value) {
+int android_log_write_float32(android_log_context ctx, float value) {
size_t needed;
uint32_t ivalue;
android_log_context_internal* context;
@@ -307,7 +305,7 @@
return 0;
}
-LIBLOG_ABI_PUBLIC int android_log_write_list_end(android_log_context ctx) {
+int android_log_write_list_end(android_log_context ctx) {
android_log_context_internal* context;
context = (android_log_context_internal*)ctx;
@@ -337,7 +335,7 @@
/*
* Logs the list of elements to the event log.
*/
-LIBLOG_ABI_PUBLIC int android_log_write_list(android_log_context ctx, log_id_t id) {
+int android_log_write_list(android_log_context ctx, log_id_t id) {
android_log_context_internal* context;
const char* msg;
ssize_t len;
@@ -371,7 +369,7 @@
: __android_log_security_bwrite(context->tag, msg, len));
}
-LIBLOG_ABI_PRIVATE int android_log_write_list_buffer(android_log_context ctx, const char** buffer) {
+int android_log_write_list_buffer(android_log_context ctx, const char** buffer) {
android_log_context_internal* context;
const char* msg;
ssize_t len;
@@ -593,10 +591,10 @@
}
}
-LIBLOG_ABI_PUBLIC android_log_list_element android_log_read_next(android_log_context ctx) {
+android_log_list_element android_log_read_next(android_log_context ctx) {
return android_log_read_next_internal(ctx, 0);
}
-LIBLOG_ABI_PUBLIC android_log_list_element android_log_peek_next(android_log_context ctx) {
+android_log_list_element android_log_peek_next(android_log_context ctx) {
return android_log_read_next_internal(ctx, 1);
}
diff --git a/liblog/log_event_write.cpp b/liblog/log_event_write.cpp
index e644a3b..d04ba90 100644
--- a/liblog/log_event_write.cpp
+++ b/liblog/log_event_write.cpp
@@ -24,8 +24,8 @@
#define MAX_SUBTAG_LEN 32
-LIBLOG_ABI_PUBLIC int __android_log_error_write(int tag, const char* subTag, int32_t uid,
- const char* data, uint32_t dataLen) {
+int __android_log_error_write(int tag, const char* subTag, int32_t uid, const char* data,
+ uint32_t dataLen) {
int ret = -EINVAL;
if (subTag && (data || !dataLen)) {
diff --git a/liblog/log_portability.h b/liblog/log_portability.h
index b9fb1d2..468a498 100644
--- a/liblog/log_portability.h
+++ b/liblog/log_portability.h
@@ -19,25 +19,6 @@
#include <sys/cdefs.h>
#include <unistd.h>
-/* Helpful private sys/cdefs.h like definitions */
-
-/* Declare this library function hidden and internal */
-#if defined(_WIN32)
-#define LIBLOG_HIDDEN
-#else
-#define LIBLOG_HIDDEN __attribute__((visibility("hidden")))
-#endif
-
-/* Declare this library function visible and external */
-#if defined(_WIN32)
-#define LIBLOG_ABI_PUBLIC
-#else
-#define LIBLOG_ABI_PUBLIC __attribute__((visibility("default")))
-#endif
-
-/* Declare this library function visible but private */
-#define LIBLOG_ABI_PRIVATE LIBLOG_ABI_PUBLIC
-
/*
* Declare this library function as reimplementation.
* Prevent circular dependencies, but allow _real_ library to hijack
diff --git a/liblog/log_time.cpp b/liblog/log_time.cpp
index 77bb94f..3ae250f 100644
--- a/liblog/log_time.cpp
+++ b/liblog/log_time.cpp
@@ -23,12 +23,12 @@
#include "log_portability.h"
-LIBLOG_ABI_PRIVATE const char log_time::default_format[] = "%m-%d %H:%M:%S.%q";
-LIBLOG_ABI_PRIVATE const timespec log_time::EPOCH = { 0, 0 };
+const char log_time::default_format[] = "%m-%d %H:%M:%S.%q";
+const timespec log_time::EPOCH = {0, 0};
// Add %#q for fractional seconds to standard strptime function
-LIBLOG_ABI_PRIVATE char* log_time::strptime(const char* s, const char* format) {
+char* log_time::strptime(const char* s, const char* format) {
time_t now;
#ifdef __linux__
*this = log_time(CLOCK_REALTIME);
@@ -134,7 +134,7 @@
return ret;
}
-LIBLOG_ABI_PRIVATE log_time log_time::operator-=(const timespec& T) {
+log_time log_time::operator-=(const timespec& T) {
// No concept of negative time, clamp to EPOCH
if (*this <= T) {
return *this = log_time(EPOCH);
@@ -151,7 +151,7 @@
return *this;
}
-LIBLOG_ABI_PRIVATE log_time log_time::operator+=(const timespec& T) {
+log_time log_time::operator+=(const timespec& T) {
this->tv_nsec += (unsigned long int)T.tv_nsec;
if (this->tv_nsec >= NS_PER_SEC) {
this->tv_nsec -= NS_PER_SEC;
@@ -162,7 +162,7 @@
return *this;
}
-LIBLOG_ABI_PRIVATE log_time log_time::operator-=(const log_time& T) {
+log_time log_time::operator-=(const log_time& T) {
// No concept of negative time, clamp to EPOCH
if (*this <= T) {
return *this = log_time(EPOCH);
@@ -179,7 +179,7 @@
return *this;
}
-LIBLOG_ABI_PRIVATE log_time log_time::operator+=(const log_time& T) {
+log_time log_time::operator+=(const log_time& T) {
this->tv_nsec += T.tv_nsec;
if (this->tv_nsec >= NS_PER_SEC) {
this->tv_nsec -= NS_PER_SEC;
diff --git a/liblog/logd_reader.cpp b/liblog/logd_reader.cpp
index 05bbcbc..2f0af4a 100644
--- a/liblog/logd_reader.cpp
+++ b/liblog/logd_reader.cpp
@@ -67,7 +67,7 @@
static ssize_t logdGetStats(struct android_log_logger_list* logger,
struct android_log_transport_context* transp, char* buf, size_t len);
-LIBLOG_HIDDEN struct android_log_transport_read logdLoggerRead = {
+struct android_log_transport_read logdLoggerRead = {
.node = {&logdLoggerRead.node, &logdLoggerRead.node},
.name = "logd",
.available = logdAvailable,
@@ -309,7 +309,7 @@
return ret;
}
-LIBLOG_HIDDEN ssize_t __send_log_msg(char* buf, size_t buf_size) {
+ssize_t __send_log_msg(char* buf, size_t buf_size) {
return send_log_msg(NULL, NULL, buf, buf_size);
}
diff --git a/liblog/logd_reader.h b/liblog/logd_reader.h
index 0bba7cf..7c53cbb 100644
--- a/liblog/logd_reader.h
+++ b/liblog/logd_reader.h
@@ -22,6 +22,6 @@
__BEGIN_DECLS
-LIBLOG_HIDDEN ssize_t __send_log_msg(char* buf, size_t buf_size);
+ssize_t __send_log_msg(char* buf, size_t buf_size);
__END_DECLS
diff --git a/liblog/logd_writer.cpp b/liblog/logd_writer.cpp
index ed906b3..c3f72f4 100644
--- a/liblog/logd_writer.cpp
+++ b/liblog/logd_writer.cpp
@@ -48,7 +48,7 @@
static void logdClose();
static int logdWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
-LIBLOG_HIDDEN struct android_log_transport_write logdLoggerWrite = {
+struct android_log_transport_write logdLoggerWrite = {
.node = {&logdLoggerWrite.node, &logdLoggerWrite.node},
.context.sock = -EBADF,
.name = "logd",
diff --git a/liblog/logger.h b/liblog/logger.h
index b2479d2..1f632c0 100644
--- a/liblog/logger.h
+++ b/liblog/logger.h
@@ -156,10 +156,10 @@
}
#endif
-LIBLOG_HIDDEN void __android_log_lock();
-LIBLOG_HIDDEN int __android_log_trylock();
-LIBLOG_HIDDEN void __android_log_unlock();
+void __android_log_lock();
+int __android_log_trylock();
+void __android_log_unlock();
-extern LIBLOG_HIDDEN int __android_log_transport;
+extern int __android_log_transport;
__END_DECLS
diff --git a/liblog/logger_lock.cpp b/liblog/logger_lock.cpp
index d4e3a75..4636b00 100644
--- a/liblog/logger_lock.cpp
+++ b/liblog/logger_lock.cpp
@@ -28,7 +28,7 @@
static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER;
#endif
-LIBLOG_HIDDEN void __android_log_lock() {
+void __android_log_lock() {
#if !defined(_WIN32)
/*
* If we trigger a signal handler in the middle of locked activity and the
@@ -38,7 +38,7 @@
#endif
}
-LIBLOG_HIDDEN int __android_log_trylock() {
+int __android_log_trylock() {
#if !defined(_WIN32)
return pthread_mutex_trylock(&log_init_lock);
#else
@@ -46,7 +46,7 @@
#endif
}
-LIBLOG_HIDDEN void __android_log_unlock() {
+void __android_log_unlock() {
#if !defined(_WIN32)
pthread_mutex_unlock(&log_init_lock);
#endif
diff --git a/liblog/logger_name.cpp b/liblog/logger_name.cpp
index c6f3cb7..3aa6841 100644
--- a/liblog/logger_name.cpp
+++ b/liblog/logger_name.cpp
@@ -35,7 +35,7 @@
/* clang-format on */
};
-LIBLOG_ABI_PUBLIC const char* android_log_id_to_name(log_id_t log_id) {
+const char* android_log_id_to_name(log_id_t log_id) {
if (log_id >= LOG_ID_MAX) {
log_id = LOG_ID_MAIN;
}
@@ -45,7 +45,7 @@
static_assert(std::is_same<std::underlying_type<log_id_t>::type, uint32_t>::value,
"log_id_t must be an unsigned int");
-LIBLOG_ABI_PUBLIC log_id_t android_name_to_log_id(const char* logName) {
+log_id_t android_name_to_log_id(const char* logName) {
const char* b;
unsigned int ret;
diff --git a/liblog/logger_read.cpp b/liblog/logger_read.cpp
index e429c36..4cf0846 100644
--- a/liblog/logger_read.cpp
+++ b/liblog/logger_read.cpp
@@ -50,7 +50,7 @@
/* android_logger_alloc unimplemented, no use case */
/* method for getting the associated sublog id */
-LIBLOG_ABI_PUBLIC log_id_t android_logger_get_id(struct logger* logger) {
+log_id_t android_logger_get_id(struct logger* logger) {
return ((struct android_log_logger*)logger)->logId;
}
@@ -139,16 +139,16 @@
} \
return ret
-LIBLOG_ABI_PUBLIC int android_logger_clear(struct logger* logger) {
+int android_logger_clear(struct logger* logger) {
LOGGER_FUNCTION(logger, -ENODEV, clear);
}
/* returns the total size of the log's ring buffer */
-LIBLOG_ABI_PUBLIC long android_logger_get_log_size(struct logger* logger) {
+long android_logger_get_log_size(struct logger* logger) {
LOGGER_FUNCTION(logger, -ENODEV, getSize);
}
-LIBLOG_ABI_PUBLIC int android_logger_set_log_size(struct logger* logger, unsigned long size) {
+int android_logger_set_log_size(struct logger* logger, unsigned long size) {
LOGGER_FUNCTION(logger, -ENODEV, setSize, size);
}
@@ -156,14 +156,14 @@
* returns the readable size of the log's ring buffer (that is, amount of the
* log consumed)
*/
-LIBLOG_ABI_PUBLIC long android_logger_get_log_readable_size(struct logger* logger) {
+long android_logger_get_log_readable_size(struct logger* logger) {
LOGGER_FUNCTION(logger, -ENODEV, getReadableSize);
}
/*
* returns the logger version
*/
-LIBLOG_ABI_PUBLIC int android_logger_get_log_version(struct logger* logger) {
+int android_logger_get_log_version(struct logger* logger) {
LOGGER_FUNCTION(logger, 4, version);
}
@@ -191,23 +191,19 @@
/*
* returns statistics
*/
-LIBLOG_ABI_PUBLIC ssize_t android_logger_get_statistics(struct logger_list* logger_list, char* buf,
- size_t len) {
+ssize_t android_logger_get_statistics(struct logger_list* logger_list, char* buf, size_t len) {
LOGGER_LIST_FUNCTION(logger_list, -ENODEV, getStats, buf, len);
}
-LIBLOG_ABI_PUBLIC ssize_t android_logger_get_prune_list(struct logger_list* logger_list, char* buf,
- size_t len) {
+ssize_t android_logger_get_prune_list(struct logger_list* logger_list, char* buf, size_t len) {
LOGGER_LIST_FUNCTION(logger_list, -ENODEV, getPrune, buf, len);
}
-LIBLOG_ABI_PUBLIC int android_logger_set_prune_list(struct logger_list* logger_list, char* buf,
- size_t len) {
+int android_logger_set_prune_list(struct logger_list* logger_list, char* buf, size_t len) {
LOGGER_LIST_FUNCTION(logger_list, -ENODEV, setPrune, buf, len);
}
-LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_alloc(int mode, unsigned int tail,
- pid_t pid) {
+struct logger_list* android_logger_list_alloc(int mode, unsigned int tail, pid_t pid) {
struct android_log_logger_list* logger_list;
logger_list = static_cast<android_log_logger_list*>(calloc(1, sizeof(*logger_list)));
@@ -224,8 +220,7 @@
return (struct logger_list*)logger_list;
}
-LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_alloc_time(int mode, log_time start,
- pid_t pid) {
+struct logger_list* android_logger_list_alloc_time(int mode, log_time start, pid_t pid) {
struct android_log_logger_list* logger_list;
logger_list = static_cast<android_log_logger_list*>(calloc(1, sizeof(*logger_list)));
@@ -246,8 +241,7 @@
/* android_logger_list_unregister unimplemented, no use case */
/* Open the named log and add it to the logger list */
-LIBLOG_ABI_PUBLIC struct logger* android_logger_open(struct logger_list* logger_list,
- log_id_t logId) {
+struct logger* android_logger_open(struct logger_list* logger_list, log_id_t logId) {
struct android_log_logger_list* logger_list_internal =
(struct android_log_logger_list*)logger_list;
struct android_log_logger* logger;
@@ -289,8 +283,8 @@
}
/* Open the single named log and make it part of a new logger list */
-LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_open(log_id_t logId, int mode,
- unsigned int tail, pid_t pid) {
+struct logger_list* android_logger_list_open(log_id_t logId, int mode, unsigned int tail,
+ pid_t pid) {
struct logger_list* logger_list = android_logger_list_alloc(mode, tail, pid);
if (!logger_list) {
@@ -345,8 +339,7 @@
}
/* Read from the selected logs */
-LIBLOG_ABI_PUBLIC int android_logger_list_read(struct logger_list* logger_list,
- struct log_msg* log_msg) {
+int android_logger_list_read(struct logger_list* logger_list, struct log_msg* log_msg) {
struct android_log_transport_context* transp;
struct android_log_logger_list* logger_list_internal =
(struct android_log_logger_list*)logger_list;
@@ -437,7 +430,7 @@
}
/* Close all the logs */
-LIBLOG_ABI_PUBLIC void android_logger_list_free(struct logger_list* logger_list) {
+void android_logger_list_free(struct logger_list* logger_list) {
struct android_log_logger_list* logger_list_internal =
(struct android_log_logger_list*)logger_list;
diff --git a/liblog/logger_write.cpp b/liblog/logger_write.cpp
index af8cb2d..908fe7f 100644
--- a/liblog/logger_write.cpp
+++ b/liblog/logger_write.cpp
@@ -105,7 +105,7 @@
}
}
-LIBLOG_ABI_PUBLIC extern "C" int __android_log_dev_available() {
+extern "C" int __android_log_dev_available() {
struct android_log_transport_write* node;
if (list_empty(&__android_log_transport_write)) {
@@ -128,7 +128,7 @@
/*
* Release any logger resources. A new log write will immediately re-acquire.
*/
-LIBLOG_ABI_PUBLIC void __android_log_close() {
+void __android_log_close() {
struct android_log_transport_write* transport;
#if defined(__ANDROID__)
EventTagMap* m;
@@ -402,12 +402,11 @@
return ret;
}
-LIBLOG_ABI_PUBLIC int __android_log_write(int prio, const char* tag, const char* msg) {
+int __android_log_write(int prio, const char* tag, const char* msg) {
return __android_log_buf_write(LOG_ID_MAIN, prio, tag, msg);
}
-LIBLOG_ABI_PUBLIC int __android_log_buf_write(int bufID, int prio, const char* tag,
- const char* msg) {
+int __android_log_buf_write(int bufID, int prio, const char* tag, const char* msg) {
struct iovec vec[3];
char tmp_tag[32];
@@ -472,7 +471,7 @@
return write_to_log(static_cast<log_id_t>(bufID), vec, 3);
}
-LIBLOG_ABI_PUBLIC int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) {
+int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) {
char buf[LOG_BUF_SIZE];
vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
@@ -480,7 +479,7 @@
return __android_log_write(prio, tag, buf);
}
-LIBLOG_ABI_PUBLIC int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
+int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
va_list ap;
char buf[LOG_BUF_SIZE];
@@ -491,8 +490,7 @@
return __android_log_write(prio, tag, buf);
}
-LIBLOG_ABI_PUBLIC int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt,
- ...) {
+int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt, ...) {
va_list ap;
char buf[LOG_BUF_SIZE];
@@ -503,8 +501,7 @@
return __android_log_buf_write(bufID, prio, tag, buf);
}
-LIBLOG_ABI_PUBLIC void __android_log_assert(const char* cond, const char* tag, const char* fmt,
- ...) {
+void __android_log_assert(const char* cond, const char* tag, const char* fmt, ...) {
char buf[LOG_BUF_SIZE];
if (fmt) {
@@ -533,7 +530,7 @@
/* NOTREACHED */
}
-LIBLOG_ABI_PUBLIC int __android_log_bwrite(int32_t tag, const void* payload, size_t len) {
+int __android_log_bwrite(int32_t tag, const void* payload, size_t len) {
struct iovec vec[2];
vec[0].iov_base = &tag;
@@ -544,7 +541,7 @@
return write_to_log(LOG_ID_EVENTS, vec, 2);
}
-LIBLOG_ABI_PUBLIC int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len) {
+int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len) {
struct iovec vec[2];
vec[0].iov_base = &tag;
@@ -555,7 +552,7 @@
return write_to_log(LOG_ID_STATS, vec, 2);
}
-LIBLOG_ABI_PUBLIC int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len) {
+int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len) {
struct iovec vec[2];
vec[0].iov_base = &tag;
@@ -571,8 +568,7 @@
* for the general case where we're generating lists of stuff, but very
* handy if we just want to dump an integer into the log.
*/
-LIBLOG_ABI_PUBLIC int __android_log_btwrite(int32_t tag, char type, const void* payload,
- size_t len) {
+int __android_log_btwrite(int32_t tag, char type, const void* payload, size_t len) {
struct iovec vec[3];
vec[0].iov_base = &tag;
@@ -589,7 +585,7 @@
* Like __android_log_bwrite, but used for writing strings to the
* event log.
*/
-LIBLOG_ABI_PUBLIC int __android_log_bswrite(int32_t tag, const char* payload) {
+int __android_log_bswrite(int32_t tag, const char* payload) {
struct iovec vec[4];
char type = EVENT_TYPE_STRING;
uint32_t len = strlen(payload);
@@ -610,7 +606,7 @@
* Like __android_log_security_bwrite, but used for writing strings to the
* security log.
*/
-LIBLOG_ABI_PUBLIC int __android_log_security_bswrite(int32_t tag, const char* payload) {
+int __android_log_security_bswrite(int32_t tag, const char* payload) {
struct iovec vec[4];
char type = EVENT_TYPE_STRING;
uint32_t len = strlen(payload);
@@ -645,9 +641,9 @@
/* Following functions need access to our internal write_to_log status */
-LIBLOG_HIDDEN int __android_log_transport;
+int __android_log_transport;
-LIBLOG_ABI_PUBLIC int android_set_log_transport(int transport_flag) {
+int android_set_log_transport(int transport_flag) {
int retval;
if (transport_flag < 0) {
@@ -688,7 +684,7 @@
return retval;
}
-LIBLOG_ABI_PUBLIC int android_get_log_transport() {
+int android_get_log_transport() {
int ret = LOGGER_DEFAULT;
__android_log_lock();
diff --git a/liblog/logprint.cpp b/liblog/logprint.cpp
index 798b089..bc056cb 100644
--- a/liblog/logprint.cpp
+++ b/liblog/logprint.cpp
@@ -195,12 +195,12 @@
* returns 1 if this log line should be printed based on its priority
* and tag, and 0 if it should not
*/
-LIBLOG_ABI_PUBLIC int android_log_shouldPrintLine(AndroidLogFormat* p_format, const char* tag,
- android_LogPriority pri) {
+int android_log_shouldPrintLine(AndroidLogFormat* p_format, const char* tag,
+ android_LogPriority pri) {
return pri >= filterPriForTag(p_format, tag);
}
-LIBLOG_ABI_PUBLIC AndroidLogFormat* android_log_format_new() {
+AndroidLogFormat* android_log_format_new() {
AndroidLogFormat* p_ret;
p_ret = static_cast<AndroidLogFormat*>(calloc(1, sizeof(AndroidLogFormat)));
@@ -228,7 +228,7 @@
static list_declare(convertHead);
-LIBLOG_ABI_PUBLIC void android_log_format_free(AndroidLogFormat* p_format) {
+void android_log_format_free(AndroidLogFormat* p_format) {
FilterInfo *p_info, *p_info_old;
p_info = p_format->filters;
@@ -251,8 +251,7 @@
}
}
-LIBLOG_ABI_PUBLIC int android_log_setPrintFormat(AndroidLogFormat* p_format,
- AndroidLogPrintFormat format) {
+int android_log_setPrintFormat(AndroidLogFormat* p_format, AndroidLogPrintFormat format) {
switch (format) {
case FORMAT_MODIFIER_COLOR:
p_format->colored_output = true;
@@ -298,7 +297,7 @@
/**
* Returns FORMAT_OFF on invalid string
*/
-LIBLOG_ABI_PUBLIC AndroidLogPrintFormat android_log_formatFromString(const char* formatString) {
+AndroidLogPrintFormat android_log_formatFromString(const char* formatString) {
static AndroidLogPrintFormat format;
/* clang-format off */
@@ -367,8 +366,7 @@
* Assumes single threaded execution
*/
-LIBLOG_ABI_PUBLIC int android_log_addFilterRule(AndroidLogFormat* p_format,
- const char* filterExpression) {
+int android_log_addFilterRule(AndroidLogFormat* p_format, const char* filterExpression) {
size_t tagNameLength;
android_LogPriority pri = ANDROID_LOG_DEFAULT;
@@ -463,8 +461,7 @@
* Assumes single threaded execution
*
*/
-LIBLOG_ABI_PUBLIC int android_log_addFilterString(AndroidLogFormat* p_format,
- const char* filterString) {
+int android_log_addFilterString(AndroidLogFormat* p_format, const char* filterString) {
char* filterStringCopy = strdup(filterString);
char* p_cur = filterStringCopy;
char* p_ret;
@@ -496,8 +493,7 @@
* Returns 0 on success and -1 on invalid wire format (entry will be
* in unspecified state)
*/
-LIBLOG_ABI_PUBLIC int android_log_processLogBuffer(struct logger_entry* buf,
- AndroidLogEntry* entry) {
+int android_log_processLogBuffer(struct logger_entry* buf, AndroidLogEntry* entry) {
entry->message = NULL;
entry->messageLen = 0;
@@ -997,7 +993,7 @@
* it however we choose, which means we can't really use a fixed-size buffer
* here.
*/
-LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer(
+int android_log_processBinaryLogBuffer(
struct logger_entry* buf, AndroidLogEntry* entry,
[[maybe_unused]] const EventTagMap* map, /* only on !__ANDROID__ */
char* messageBuf, int messageBufLen) {
@@ -1525,10 +1521,9 @@
* Returns NULL on malloc error
*/
-LIBLOG_ABI_PUBLIC char* android_log_formatLogLine(AndroidLogFormat* p_format, char* defaultBuffer,
- size_t defaultBufferSize,
- const AndroidLogEntry* entry,
- size_t* p_outLength) {
+char* android_log_formatLogLine(AndroidLogFormat* p_format, char* defaultBuffer,
+ size_t defaultBufferSize, const AndroidLogEntry* entry,
+ size_t* p_outLength) {
#if !defined(_WIN32)
struct tm tmBuf;
#endif
@@ -1819,8 +1814,7 @@
* Returns count bytes written
*/
-LIBLOG_ABI_PUBLIC int android_log_printLogLine(AndroidLogFormat* p_format, int fd,
- const AndroidLogEntry* entry) {
+int android_log_printLogLine(AndroidLogFormat* p_format, int fd, const AndroidLogEntry* entry) {
int ret;
char defaultBuffer[512];
char* outBuffer = NULL;
diff --git a/liblog/pmsg_reader.cpp b/liblog/pmsg_reader.cpp
index 7bc6e4a..ba27fd7 100644
--- a/liblog/pmsg_reader.cpp
+++ b/liblog/pmsg_reader.cpp
@@ -38,7 +38,7 @@
static int pmsgClear(struct android_log_logger* logger,
struct android_log_transport_context* transp);
-LIBLOG_HIDDEN struct android_log_transport_read pmsgLoggerRead = {
+struct android_log_transport_read pmsgLoggerRead = {
.node = {&pmsgLoggerRead.node, &pmsgLoggerRead.node},
.name = "pmsg",
.available = pmsgAvailable,
@@ -270,10 +270,8 @@
return result;
}
-LIBLOG_ABI_PRIVATE ssize_t __android_log_pmsg_file_read(log_id_t logId, char prio,
- const char* prefix,
- __android_log_pmsg_file_read_fn fn,
- void* arg) {
+ssize_t __android_log_pmsg_file_read(log_id_t logId, char prio, const char* prefix,
+ __android_log_pmsg_file_read_fn fn, void* arg) {
ssize_t ret;
struct android_log_logger_list logger_list;
struct android_log_transport_context transp;
diff --git a/liblog/pmsg_writer.cpp b/liblog/pmsg_writer.cpp
index b2fc6d0..e851100 100644
--- a/liblog/pmsg_writer.cpp
+++ b/liblog/pmsg_writer.cpp
@@ -40,7 +40,7 @@
static int pmsgAvailable(log_id_t logId);
static int pmsgWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
-LIBLOG_HIDDEN struct android_log_transport_write pmsgLoggerWrite = {
+struct android_log_transport_write pmsgLoggerWrite = {
.node = {&pmsgLoggerWrite.node, &pmsgLoggerWrite.node},
.context.fd = -1,
.name = "pmsg",
@@ -200,9 +200,8 @@
}
/* Write a buffer as filename references (tag = <basedir>:<basename>) */
-LIBLOG_ABI_PRIVATE ssize_t __android_log_pmsg_file_write(log_id_t logId, char prio,
- const char* filename, const char* buf,
- size_t len) {
+ssize_t __android_log_pmsg_file_write(log_id_t logId, char prio, const char* filename,
+ const char* buf, size_t len) {
bool weOpened;
size_t length, packet_len;
const char* tag;
diff --git a/liblog/properties.cpp b/liblog/properties.cpp
index 764877e..2e0a8c9 100644
--- a/liblog/properties.cpp
+++ b/liblog/properties.cpp
@@ -264,18 +264,17 @@
return default_prio;
}
-LIBLOG_ABI_PUBLIC int __android_log_is_loggable_len(int prio, const char* tag, size_t len,
- int default_prio) {
+int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio) {
int logLevel = __android_log_level(tag, len, default_prio);
return logLevel >= 0 && prio >= logLevel;
}
-LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char* tag, int default_prio) {
+int __android_log_is_loggable(int prio, const char* tag, int default_prio) {
int logLevel = __android_log_level(tag, (tag && *tag) ? strlen(tag) : 0, default_prio);
return logLevel >= 0 && prio >= logLevel;
}
-LIBLOG_ABI_PUBLIC int __android_log_is_debuggable() {
+int __android_log_is_debuggable() {
static uint32_t serial;
static struct cache_char tag_cache;
static const char key[] = "ro.debuggable";
@@ -361,7 +360,7 @@
* Timestamp state generally remains constant, but can change at any time
* to handle developer requirements.
*/
-LIBLOG_ABI_PUBLIC clockid_t android_log_clockid() {
+clockid_t android_log_clockid() {
static struct cache2_char clockid = {PTHREAD_MUTEX_INITIALIZER, 0,
"persist.logd.timestamp", {{NULL, 0xFFFFFFFF}, '\0'},
"ro.logd.timestamp", {{NULL, 0xFFFFFFFF}, '\0'},
@@ -380,7 +379,7 @@
return (c != BOOLEAN_FALSE) && c && (self->cache_persist.c == BOOLEAN_TRUE);
}
-LIBLOG_ABI_PUBLIC int __android_log_security() {
+int __android_log_security() {
static struct cache2_char security = {
PTHREAD_MUTEX_INITIALIZER, 0,
"persist.logd.security", {{NULL, 0xFFFFFFFF}, BOOLEAN_FALSE},
@@ -428,7 +427,7 @@
}
/* get boolean with the logger twist that supports eng adjustments */
-LIBLOG_ABI_PRIVATE bool __android_logger_property_get_bool(const char* key, int flag) {
+bool __android_logger_property_get_bool(const char* key, int flag) {
struct cache_property property = {{NULL, 0xFFFFFFFF}, {0}};
if (flag & BOOL_DEFAULT_FLAG_PERSIST) {
char newkey[strlen("persist.") + strlen(key) + 1];
@@ -478,7 +477,7 @@
return (flag & BOOL_DEFAULT_FLAG_TRUE_FALSE) != BOOL_DEFAULT_FALSE;
}
-LIBLOG_ABI_PRIVATE bool __android_logger_valid_buffer_size(unsigned long value) {
+bool __android_logger_valid_buffer_size(unsigned long value) {
static long pages, pagesize;
unsigned long maximum;
@@ -583,7 +582,7 @@
return property_get_size_from_cache(&self->cache_ro);
}
-LIBLOG_ABI_PRIVATE unsigned long __android_logger_get_buffer_size(log_id_t logId) {
+unsigned long __android_logger_get_buffer_size(log_id_t logId) {
static const char global_tunable[] = "persist.logd.size"; /* Settings App */
static const char global_default[] = "ro.logd.size"; /* BoardConfig.mk */
static struct cache2_property_size global = {
diff --git a/liblog/stderr_write.cpp b/liblog/stderr_write.cpp
index 28195aa..e324a7c 100644
--- a/liblog/stderr_write.cpp
+++ b/liblog/stderr_write.cpp
@@ -54,7 +54,7 @@
#endif
};
-LIBLOG_HIDDEN struct android_log_transport_write stderrLoggerWrite = {
+struct android_log_transport_write stderrLoggerWrite = {
.node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node},
.context.priv = NULL,
.name = "stderr",
diff --git a/libmeminfo/libdmabufinfo/Android.bp b/libmeminfo/libdmabufinfo/Android.bp
index 3d5f2e7..4aed45c 100644
--- a/libmeminfo/libdmabufinfo/Android.bp
+++ b/libmeminfo/libdmabufinfo/Android.bp
@@ -17,9 +17,11 @@
name: "dmabufinfo_defaults",
static_libs: [
"libbase",
- "liblog",
"libprocinfo",
],
+ shared_libs: [
+ "liblog",
+ ],
cflags: [
"-Wall",
@@ -30,10 +32,9 @@
cc_library_static {
name: "libdmabufinfo",
+ vendor_available: true,
defaults: ["dmabufinfo_defaults"],
export_include_dirs: ["include"],
- static_libs: ["libc++fs"],
-
srcs: [
"dmabufinfo.cpp",
],
diff --git a/libmeminfo/libdmabufinfo/dmabufinfo.cpp b/libmeminfo/libdmabufinfo/dmabufinfo.cpp
index 0212cd2..439cf68 100644
--- a/libmeminfo/libdmabufinfo/dmabufinfo.cpp
+++ b/libmeminfo/libdmabufinfo/dmabufinfo.cpp
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#include <dmabufinfo/dmabufinfo.h>
-
+#include <dirent.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,6 +34,8 @@
#include <android-base/strings.h>
#include <procinfo/process_map.h>
+#include <dmabufinfo/dmabufinfo.h>
+
namespace android {
namespace dmabufinfo {
@@ -80,16 +81,42 @@
return true;
}
+// TODO: std::filesystem::is_symlink fails to link on vendor code,
+// forcing this workaround.
+// Move back to libc++fs once it is vendor-available. See b/124012728
+static bool is_symlink(const char *filename)
+{
+ struct stat p_statbuf;
+ if (lstat(filename, &p_statbuf) < 0) {
+ return false;
+ }
+ if (S_ISLNK(p_statbuf.st_mode) == 1) {
+ return true;
+ }
+ return false;
+}
+
static bool ReadDmaBufFdRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs) {
std::string fdpath = ::android::base::StringPrintf("/proc/%d/fd", pid);
- for (auto& de : std::filesystem::directory_iterator(fdpath)) {
- if (!std::filesystem::is_symlink(de.path())) {
+
+ std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir(fdpath.c_str()), closedir);
+ if (!dir) {
+ LOG(ERROR) << "Failed to open " << fdpath << " directory" << std::endl;
+ return false;
+ }
+ struct dirent* dent;
+ while ((dent = readdir(dir.get()))) {
+ std::string path =
+ ::android::base::StringPrintf("%s/%s", fdpath.c_str(), dent->d_name);
+
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") ||
+ !is_symlink(path.c_str())) {
continue;
}
std::string target;
- if (!::android::base::Readlink(de.path().string(), &target)) {
- LOG(ERROR) << "Failed to find target for symlink: " << de.path().string();
+ if (!::android::base::Readlink(path, &target)) {
+ LOG(ERROR) << "Failed to find target for symlink: " << path;
return false;
}
@@ -98,8 +125,8 @@
}
int fd;
- if (!::android::base::ParseInt(de.path().filename().string(), &fd)) {
- LOG(ERROR) << "Dmabuf fd: " << de.path().string() << " is invalid";
+ if (!::android::base::ParseInt(dent->d_name, &fd)) {
+ LOG(ERROR) << "Dmabuf fd: " << path << " is invalid";
return false;
}
@@ -109,13 +136,13 @@
std::string exporter = "<unknown>";
uint64_t count = 0;
if (!ReadDmaBufFdInfo(pid, fd, &name, &exporter, &count)) {
- LOG(ERROR) << "Failed to read fdinfo for: " << de.path().string();
+ LOG(ERROR) << "Failed to read fdinfo for: " << path;
return false;
}
struct stat sb;
- if (stat(de.path().c_str(), &sb) < 0) {
- PLOG(ERROR) << "Failed to stat: " << de.path().string();
+ if (stat(path.c_str(), &sb) < 0) {
+ PLOG(ERROR) << "Failed to stat: " << path;
return false;
}
diff --git a/libmeminfo/libdmabufinfo/tools/Android.bp b/libmeminfo/libdmabufinfo/tools/Android.bp
index 339583e..0af3c48 100644
--- a/libmeminfo/libdmabufinfo/tools/Android.bp
+++ b/libmeminfo/libdmabufinfo/tools/Android.bp
@@ -22,10 +22,9 @@
srcs: ["dmabuf_dump.cpp"],
shared_libs: [
"libbase",
- "libmeminfo",
],
static_libs: [
"libdmabufinfo",
- "libc++fs",
],
+ soc_specific: true,
}
\ No newline at end of file
diff --git a/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp b/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
index 5ee9c3d..0851fb3 100644
--- a/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
+++ b/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
@@ -150,8 +150,8 @@
if (show_all) {
if (!ReadDmaBufInfo(&bufs)) {
- std::cerr << "Unable to read DEBUGFS dmabuf info" << std::endl;
- exit(EXIT_FAILURE);
+ std::cerr << "debugfs entry for dmabuf not available, skipping" << std::endl;
+ bufs.clear();
}
std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir("/proc"), closedir);
if (!dir) {
diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp
index 2802d36..1ec21e9 100644
--- a/libnativeloader/Android.bp
+++ b/libnativeloader/Android.bp
@@ -23,6 +23,10 @@
"llndk.libraries.txt",
"vndksp.libraries.txt",
],
+ stubs: {
+ symbol_file: "libnativeloader.map.txt",
+ versions: ["1"],
+ },
}
cc_library_headers {
diff --git a/libnetutils/OWNERS b/libnetutils/OWNERS
index e3ec950..8321de6 100644
--- a/libnetutils/OWNERS
+++ b/libnetutils/OWNERS
@@ -1,3 +1,2 @@
-# TODO: should this be in system/netd?
-ek@google.com
-lorenzo@google.com
+include platform/system/netd:/OWNERS
+
diff --git a/libutils/Android.bp b/libutils/Android.bp
index fb7ca32..93aa1e6 100644
--- a/libutils/Android.bp
+++ b/libutils/Android.bp
@@ -195,17 +195,83 @@
},
}
-// Include subdirectory makefiles
-// ============================================================
-
cc_test {
- name: "SharedBufferTest",
+ name: "libutils_test",
host_supported: true,
- static_libs: ["libutils"],
- shared_libs: ["liblog"],
- srcs: ["SharedBufferTest.cpp"],
+
+ srcs: [
+ "BitSet_test.cpp",
+ "FileMap_test.cpp",
+ "LruCache_test.cpp",
+ "Mutex_test.cpp",
+ "SharedBuffer_test.cpp",
+ "Singleton_test.cpp",
+ "String8_test.cpp",
+ "StrongPointer_test.cpp",
+ "Unicode_test.cpp",
+ "Vector_test.cpp",
+ ],
+
+ target: {
+ android: {
+ srcs: [
+ "SystemClock_test.cpp",
+ ],
+ shared_libs: [
+ "libz",
+ "liblog",
+ "libcutils",
+ "libutils",
+ "libbase",
+ ],
+ },
+ linux: {
+ srcs: [
+ "Looper_test.cpp",
+ "RefBase_test.cpp",
+ ],
+ },
+ host: {
+ static_libs: [
+ "libutils",
+ "liblog",
+ "libbase",
+ ],
+ },
+ },
+
+ required: [
+ "libutils_test_singleton1",
+ "libutils_test_singleton2",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-Wthread-safety",
+ ],
+}
+
+cc_test_library {
+ name: "libutils_test_singleton1",
+ host_supported: true,
+ relative_install_path: "libutils_test",
+ srcs: ["Singleton_test1.cpp"],
cflags: [
"-Wall",
"-Werror",
],
}
+
+cc_test_library {
+ name: "libutils_test_singleton2",
+ host_supported: true,
+ relative_install_path: "libutils_test",
+ srcs: ["Singleton_test2.cpp"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ shared_libs: ["libutils_test_singleton1"],
+}
diff --git a/libutils/tests/BitSet_test.cpp b/libutils/BitSet_test.cpp
similarity index 100%
rename from libutils/tests/BitSet_test.cpp
rename to libutils/BitSet_test.cpp
diff --git a/libutils/tests/FileMap_test.cpp b/libutils/FileMap_test.cpp
similarity index 100%
rename from libutils/tests/FileMap_test.cpp
rename to libutils/FileMap_test.cpp
diff --git a/libutils/tests/Looper_test.cpp b/libutils/Looper_test.cpp
similarity index 96%
rename from libutils/tests/Looper_test.cpp
rename to libutils/Looper_test.cpp
index 2282ced..6fdc0ed 100644
--- a/libutils/tests/Looper_test.cpp
+++ b/libutils/Looper_test.cpp
@@ -9,7 +9,7 @@
#include <unistd.h>
#include <time.h>
-#include "TestHelpers.h"
+#include <utils/threads.h>
// # of milliseconds to fudge stopwatch measurements
#define TIMING_TOLERANCE_MS 25
@@ -23,6 +23,59 @@
MSG_TEST4 = 4,
};
+class Pipe {
+public:
+ int sendFd;
+ int receiveFd;
+
+ Pipe() {
+ int fds[2];
+ ::pipe(fds);
+
+ receiveFd = fds[0];
+ sendFd = fds[1];
+ }
+
+ ~Pipe() {
+ if (sendFd != -1) {
+ ::close(sendFd);
+ }
+
+ if (receiveFd != -1) {
+ ::close(receiveFd);
+ }
+ }
+
+ status_t writeSignal() {
+ ssize_t nWritten = ::write(sendFd, "*", 1);
+ return nWritten == 1 ? 0 : -errno;
+ }
+
+ status_t readSignal() {
+ char buf[1];
+ ssize_t nRead = ::read(receiveFd, buf, 1);
+ return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno;
+ }
+};
+
+class DelayedTask : public Thread {
+ int mDelayMillis;
+
+public:
+ explicit DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { }
+
+protected:
+ virtual ~DelayedTask() { }
+
+ virtual void doTask() = 0;
+
+ virtual bool threadLoop() {
+ usleep(mDelayMillis * 1000);
+ doTask();
+ return false;
+ }
+};
+
class DelayedWake : public DelayedTask {
sp<Looper> mLooper;
diff --git a/libutils/tests/LruCache_test.cpp b/libutils/LruCache_test.cpp
similarity index 100%
rename from libutils/tests/LruCache_test.cpp
rename to libutils/LruCache_test.cpp
diff --git a/libutils/tests/Mutex_test.cpp b/libutils/Mutex_test.cpp
similarity index 100%
rename from libutils/tests/Mutex_test.cpp
rename to libutils/Mutex_test.cpp
diff --git a/libutils/tests/RefBase_test.cpp b/libutils/RefBase_test.cpp
similarity index 100%
rename from libutils/tests/RefBase_test.cpp
rename to libutils/RefBase_test.cpp
diff --git a/libutils/SharedBufferTest.cpp b/libutils/SharedBuffer_test.cpp
similarity index 100%
rename from libutils/SharedBufferTest.cpp
rename to libutils/SharedBuffer_test.cpp
diff --git a/libutils/tests/Singleton_test.cpp b/libutils/Singleton_test.cpp
similarity index 88%
rename from libutils/tests/Singleton_test.cpp
rename to libutils/Singleton_test.cpp
index 9acd3c3..61084b0 100644
--- a/libutils/tests/Singleton_test.cpp
+++ b/libutils/Singleton_test.cpp
@@ -30,15 +30,15 @@
TEST(SingletonTest, bug35674422) {
std::string path = android::base::GetExecutableDirectory();
- // libutils_tests_singleton1.so contains the ANDROID_SINGLETON_STATIC_INSTANCE
+ // libutils_test_singleton1.so contains the ANDROID_SINGLETON_STATIC_INSTANCE
// definition of SingletonTestData, load it first.
- std::string lib = android::base::StringPrintf("%s/libutils_tests_singleton1.so", path.c_str());
+ std::string lib = android::base::StringPrintf("%s/libutils_test_singleton1.so", path.c_str());
void* handle1 = dlopen(lib.c_str(), RTLD_NOW);
ASSERT_TRUE(handle1 != nullptr) << dlerror();
- // libutils_tests_singleton2.so references SingletonTestData but should not
+ // libutils_test_singleton2.so references SingletonTestData but should not
// have a definition
- lib = android::base::StringPrintf("%s/libutils_tests_singleton2.so", path.c_str());
+ lib = android::base::StringPrintf("%s/libutils_test_singleton2.so", path.c_str());
void* handle2 = dlopen(lib.c_str(), RTLD_NOW);
ASSERT_TRUE(handle2 != nullptr) << dlerror();
diff --git a/libutils/tests/Singleton_test.h b/libutils/Singleton_test.h
similarity index 100%
rename from libutils/tests/Singleton_test.h
rename to libutils/Singleton_test.h
diff --git a/libutils/tests/Singleton_test1.cpp b/libutils/Singleton_test1.cpp
similarity index 100%
rename from libutils/tests/Singleton_test1.cpp
rename to libutils/Singleton_test1.cpp
diff --git a/libutils/tests/Singleton_test2.cpp b/libutils/Singleton_test2.cpp
similarity index 100%
rename from libutils/tests/Singleton_test2.cpp
rename to libutils/Singleton_test2.cpp
diff --git a/libutils/tests/String8_test.cpp b/libutils/String8_test.cpp
similarity index 100%
rename from libutils/tests/String8_test.cpp
rename to libutils/String8_test.cpp
diff --git a/libutils/tests/StrongPointer_test.cpp b/libutils/StrongPointer_test.cpp
similarity index 100%
rename from libutils/tests/StrongPointer_test.cpp
rename to libutils/StrongPointer_test.cpp
diff --git a/libutils/tests/SystemClock_test.cpp b/libutils/SystemClock_test.cpp
similarity index 100%
rename from libutils/tests/SystemClock_test.cpp
rename to libutils/SystemClock_test.cpp
diff --git a/libutils/tests/Unicode_test.cpp b/libutils/Unicode_test.cpp
similarity index 100%
rename from libutils/tests/Unicode_test.cpp
rename to libutils/Unicode_test.cpp
diff --git a/libutils/tests/Vector_test.cpp b/libutils/Vector_test.cpp
similarity index 100%
rename from libutils/tests/Vector_test.cpp
rename to libutils/Vector_test.cpp
diff --git a/libutils/tests/Android.bp b/libutils/tests/Android.bp
deleted file mode 100644
index 62f5acb..0000000
--- a/libutils/tests/Android.bp
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// Copyright (C) 2014 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.
-//
-
-// Build the unit tests.
-
-cc_test {
- name: "libutils_tests",
- host_supported: true,
-
- srcs: [
- "BitSet_test.cpp",
- "FileMap_test.cpp",
- "LruCache_test.cpp",
- "Mutex_test.cpp",
- "Singleton_test.cpp",
- "String8_test.cpp",
- "StrongPointer_test.cpp",
- "Unicode_test.cpp",
- "Vector_test.cpp",
- ],
-
- target: {
- android: {
- srcs: [
- "SystemClock_test.cpp",
- ],
- shared_libs: [
- "libz",
- "liblog",
- "libcutils",
- "libutils",
- "libbase",
- ],
- },
- linux: {
- srcs: [
- "Looper_test.cpp",
- "RefBase_test.cpp",
- ],
- },
- host: {
- static_libs: [
- "libutils",
- "liblog",
- "libbase",
- ],
- },
- },
-
- required: [
- "libutils_tests_singleton1",
- "libutils_tests_singleton2",
- ],
-
- cflags: [
- "-Wall",
- "-Wextra",
- "-Werror",
- "-Wthread-safety",
- ],
-}
-
-cc_test_library {
- name: "libutils_tests_singleton1",
- host_supported: true,
- relative_install_path: "libutils_tests",
- srcs: ["Singleton_test1.cpp"],
- cflags: [
- "-Wall",
- "-Werror",
- ],
-}
-
-cc_test_library {
- name: "libutils_tests_singleton2",
- host_supported: true,
- relative_install_path: "libutils_tests",
- srcs: ["Singleton_test2.cpp"],
- cflags: [
- "-Wall",
- "-Werror",
- ],
- shared_libs: ["libutils_tests_singleton1"],
-}
diff --git a/libutils/tests/README.txt b/libutils/tests/README.txt
deleted file mode 100644
index ad54e57..0000000
--- a/libutils/tests/README.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Run device tests:
-
-mma -j<whatever>
-(after adb root; adb disable-verity; adb reboot)
-adb root
-adb remount
-adb sync
-adb shell /data/nativetest/libutils_tests/libutils_tests
diff --git a/libutils/tests/TestHelpers.h b/libutils/tests/TestHelpers.h
deleted file mode 100644
index 6801cd7..0000000
--- a/libutils/tests/TestHelpers.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2010 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 TESTHELPERS_H
-#define TESTHELPERS_H
-
-#include <utils/threads.h>
-
-namespace android {
-
-class Pipe {
-public:
- int sendFd;
- int receiveFd;
-
- Pipe() {
- int fds[2];
- ::pipe(fds);
-
- receiveFd = fds[0];
- sendFd = fds[1];
- }
-
- ~Pipe() {
- if (sendFd != -1) {
- ::close(sendFd);
- }
-
- if (receiveFd != -1) {
- ::close(receiveFd);
- }
- }
-
- status_t writeSignal() {
- ssize_t nWritten = ::write(sendFd, "*", 1);
- return nWritten == 1 ? 0 : -errno;
- }
-
- status_t readSignal() {
- char buf[1];
- ssize_t nRead = ::read(receiveFd, buf, 1);
- return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno;
- }
-};
-
-class DelayedTask : public Thread {
- int mDelayMillis;
-
-public:
- explicit DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { }
-
-protected:
- virtual ~DelayedTask() { }
-
- virtual void doTask() = 0;
-
- virtual bool threadLoop() {
- usleep(mDelayMillis * 1000);
- doTask();
- return false;
- }
-};
-
-} // namespace android
-
-#endif // TESTHELPERS_H
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 370bc1c..57032bc 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -277,6 +277,10 @@
# Start logd before any other services run to ensure we capture all of their logs.
start logd
+
+ # Start apexd as soon as we can
+ start apexd
+
# Start essential services.
start servicemanager
start hwservicemanager
@@ -412,8 +416,8 @@
mkdir /data/bootchart 0755 shell shell
bootchart start
- # Start apexd as soon as we can
- start apexd
+ # /data/apex is now available. Let apexd to scan and activate APEXes.
+ setprop apexd.data.status ready
# Avoid predictable entropy pool. Carry over entropy from previous boot.
copy /data/system/entropy.dat /dev/urandom