Merge "Mark fs-verity support for ext4 userdata if first_api_level >= R" into rvc-dev
diff --git a/adb/Android.bp b/adb/Android.bp
index 1004483..fea8c78 100644
--- a/adb/Android.bp
+++ b/adb/Android.bp
@@ -114,66 +114,6 @@
},
}
-// libadbconnection
-// =========================================================
-// libadbconnection_client/server implement the socket handling for jdwp
-// forwarding and the track-jdwp service.
-cc_library {
- name: "libadbconnection_server",
- srcs: ["adbconnection/adbconnection_server.cpp"],
-
- export_include_dirs: ["adbconnection/include"],
-
- stl: "libc++_static",
- shared_libs: ["liblog"],
- static_libs: ["libbase"],
-
- defaults: ["adbd_defaults", "host_adbd_supported"],
-
- // Avoid getting duplicate symbol of android::build::getbuildnumber().
- use_version_lib: false,
-
- recovery_available: true,
- compile_multilib: "both",
-}
-
-cc_library {
- name: "libadbconnection_client",
- srcs: ["adbconnection/adbconnection_client.cpp"],
-
- export_include_dirs: ["adbconnection/include"],
-
- stl: "libc++_static",
- shared_libs: ["liblog"],
- static_libs: ["libbase"],
-
- defaults: ["adbd_defaults"],
- visibility: [
- "//art:__subpackages__",
- "//system/core/adb/apex:__subpackages__",
- ],
- apex_available: [
- "com.android.adbd",
- "test_com.android.adbd",
- ],
-
- // libadbconnection_client doesn't need an embedded build number.
- use_version_lib: false,
-
- target: {
- linux: {
- version_script: "adbconnection/libadbconnection_client.map.txt",
- },
- },
- stubs: {
- symbol_file: "adbconnection/libadbconnection_client.map.txt",
- versions: ["1"],
- },
-
- host_supported: true,
- compile_multilib: "both",
-}
-
// libadb
// =========================================================
// These files are compiled for both the host and the device.
@@ -435,7 +375,7 @@
srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
"daemon/auth.cpp",
"daemon/jdwp_service.cpp",
- "daemon/adb_wifi.cpp",
+ "daemon/adb_wifi.cpp",
],
local_include_dirs: [
@@ -459,7 +399,6 @@
"libbase",
"libcrypto",
"libcrypto_utils",
- "libcutils",
"liblog",
],
@@ -483,7 +422,7 @@
},
}
-cc_library {
+cc_library_static {
name: "libadbd_services",
defaults: ["adbd_defaults", "host_adbd_supported"],
recovery_available: true,
@@ -513,11 +452,11 @@
"libadb_protos",
"libadb_tls_connection",
"libadbd_auth",
+ "libadbd_fs",
"libasyncio",
"libbase",
"libcrypto",
"libcrypto_utils",
- "libcutils",
"liblog",
],
@@ -564,13 +503,20 @@
"libadb_pairing_connection",
"libadb_tls_connection",
"libadbd_auth",
- "libadbd_services",
+ "libadbd_fs",
"libasyncio",
"libbase",
"libcrypto",
"libcrypto_utils",
- "libcutils",
"liblog",
+ "libselinux",
+ ],
+
+ static_libs: [
+ "libadbd_services",
+ "libcutils_sockets",
+ "libdiagnose_usb",
+ "libmdnssd",
],
export_include_dirs: [
@@ -605,7 +551,7 @@
"libbase",
"libcap",
"libcrypto_utils",
- "libcutils",
+ "libcutils_sockets",
"libdiagnose_usb",
"liblog",
"libmdnssd",
@@ -620,10 +566,14 @@
"libadb_protos",
"libadb_tls_connection",
"libadbd_auth",
+ "libadbd_fs",
"libcrypto",
],
- required: ["libadbd_auth"],
+ required: [
+ "libadbd_auth",
+ "libadbd_fs",
+ ],
}
phony {
@@ -699,9 +649,9 @@
"libadb_pairing_connection_static",
"libadb_tls_connection_static",
"libbase",
- "libcutils",
"libcrypto_utils",
"libcrypto_static",
+ "libcutils_sockets",
"libdiagnose_usb",
"liblog",
"libusb",
diff --git a/adb/adb_trace.h b/adb/adb_trace.h
index ed4be88..3421a02 100644
--- a/adb/adb_trace.h
+++ b/adb/adb_trace.h
@@ -59,11 +59,4 @@
void adb_trace_init(char**);
void adb_trace_enable(AdbTrace trace_tag);
-// Include <atomic> before stdatomic.h (introduced in cutils/trace.h) to avoid compile error.
-#include <atomic>
-
-#define ATRACE_TAG ATRACE_TAG_ADB
-#include <cutils/trace.h>
-#include <utils/Trace.h>
-
#endif /* __ADB_TRACE_H */
diff --git a/adb/apex/Android.bp b/adb/apex/Android.bp
index 0189455..4346f67 100644
--- a/adb/apex/Android.bp
+++ b/adb/apex/Android.bp
@@ -1,5 +1,6 @@
apex_defaults {
name: "com.android.adbd-defaults",
+ updatable: true,
binaries: ["adbd"],
compile_multilib: "both",
diff --git a/adb/client/adb_install.cpp b/adb/client/adb_install.cpp
index 982a96b..21b8f49 100644
--- a/adb/client/adb_install.cpp
+++ b/adb/client/adb_install.cpp
@@ -17,6 +17,7 @@
#include "adb_install.h"
#include <fcntl.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/adb/client/incremental_server.cpp b/adb/client/incremental_server.cpp
index 726533d..2512d05 100644
--- a/adb/client/incremental_server.cpp
+++ b/adb/client/incremental_server.cpp
@@ -27,6 +27,7 @@
#include <android-base/endian.h>
#include <android-base/strings.h>
+#include <inttypes.h>
#include <lz4.h>
#include <stdio.h>
#include <stdlib.h>
@@ -258,7 +259,7 @@
if (r == -1) {
fprintf(stderr, "Failed to read from fd %d: %d. Exit\n", adb_fd_.get(), errno);
- return true;
+ return false;
}
// socket is closed
diff --git a/adb/client/transport_mdns.cpp b/adb/client/transport_mdns.cpp
index ff1f7b4..22b9b18 100644
--- a/adb/client/transport_mdns.cpp
+++ b/adb/client/transport_mdns.cpp
@@ -409,9 +409,9 @@
}
std::string sName(serviceName);
- std::remove_if(services->begin(), services->end(), [&sName](ResolvedService* service) {
- return (sName == service->serviceName());
- });
+ services->erase(std::remove_if(
+ services->begin(), services->end(),
+ [&sName](ResolvedService* service) { return (sName == service->serviceName()); }));
}
// Returns the version the device wanted to advertise,
diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp
index d6af708..edf5683 100644
--- a/adb/daemon/file_sync_service.cpp
+++ b/adb/daemon/file_sync_service.cpp
@@ -40,10 +40,13 @@
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
-#include <private/android_filesystem_config.h>
+#include <adbd_fs.h>
+
+// Needed for __android_log_security_bswrite.
#include <private/android_logger.h>
#if defined(__ANDROID__)
+#include <linux/capability.h>
#include <selinux/android.h>
#include <sys/xattr.h>
#endif
@@ -98,7 +101,7 @@
for (const auto& path_component : path_components) {
uid_t uid = -1;
gid_t gid = -1;
- unsigned int mode = 0775;
+ mode_t mode = 0775;
uint64_t capabilities = 0;
if (path_component.empty()) {
@@ -111,7 +114,7 @@
partial_path += path_component;
if (should_use_fs_config(partial_path)) {
- fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
+ adbd_fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
}
if (adb_mkdir(partial_path.c_str(), mode) == -1) {
if (errno != EEXIST) {
@@ -468,9 +471,7 @@
gid_t gid = -1;
uint64_t capabilities = 0;
if (should_use_fs_config(path)) {
- unsigned int broken_api_hack = mode;
- fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities);
- mode = broken_api_hack;
+ adbd_fs_config(path.c_str(), 0, nullptr, &uid, &gid, &mode, &capabilities);
}
result = handle_send_file(s, path.c_str(), ×tamp, uid, gid, capabilities, mode, buffer,
@@ -550,7 +551,6 @@
static bool handle_sync_command(int fd, std::vector<char>& buffer) {
D("sync: waiting for request");
- ATRACE_CALL();
SyncRequest request;
if (!ReadFdExactly(fd, &request, sizeof(request))) {
SendSyncFail(fd, "command read failure");
@@ -569,8 +569,6 @@
name[path_length] = 0;
std::string id_name = sync_id_to_name(request.id);
- std::string trace_name = StringPrintf("%s(%s)", id_name.c_str(), name);
- ATRACE_NAME(trace_name.c_str());
D("sync: %s('%s')", id_name.c_str(), name);
switch (request.id) {
diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp
index c7f8895..0928198 100644
--- a/adb/daemon/usb.cpp
+++ b/adb/daemon/usb.cpp
@@ -19,6 +19,7 @@
#include "sysdeps.h"
#include <errno.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/adb/fastdeploy/deploypatchgenerator/apk_archive.cpp b/adb/fastdeploy/deploypatchgenerator/apk_archive.cpp
index 932d579..9da256e 100644
--- a/adb/fastdeploy/deploypatchgenerator/apk_archive.cpp
+++ b/adb/fastdeploy/deploypatchgenerator/apk_archive.cpp
@@ -18,6 +18,8 @@
#include "apk_archive.h"
+#include <inttypes.h>
+
#include "adb_trace.h"
#include "sysdeps.h"
diff --git a/adb/adbconnection/.clang-format b/adb/libs/.clang-format
similarity index 100%
copy from adb/adbconnection/.clang-format
copy to adb/libs/.clang-format
diff --git a/adb/adbconnection/.clang-format b/adb/libs/adbconnection/.clang-format
similarity index 100%
rename from adb/adbconnection/.clang-format
rename to adb/libs/adbconnection/.clang-format
diff --git a/adb/libs/adbconnection/Android.bp b/adb/libs/adbconnection/Android.bp
new file mode 100644
index 0000000..f6b0a42
--- /dev/null
+++ b/adb/libs/adbconnection/Android.bp
@@ -0,0 +1,59 @@
+// libadbconnection
+// =========================================================
+// libadbconnection_client/server implement the socket handling for jdwp
+// forwarding and the track-jdwp service.
+cc_library {
+ name: "libadbconnection_server",
+ srcs: ["adbconnection_server.cpp"],
+
+ export_include_dirs: ["include"],
+
+ stl: "libc++_static",
+ shared_libs: ["liblog"],
+ static_libs: ["libbase"],
+
+ defaults: ["adbd_defaults", "host_adbd_supported"],
+
+ // Avoid getting duplicate symbol of android::build::GetBuildNumber().
+ use_version_lib: false,
+
+ recovery_available: true,
+ compile_multilib: "both",
+}
+
+cc_library {
+ name: "libadbconnection_client",
+ srcs: ["adbconnection_client.cpp"],
+
+ export_include_dirs: ["include"],
+
+ stl: "libc++_static",
+ shared_libs: ["liblog"],
+ static_libs: ["libbase"],
+
+ defaults: ["adbd_defaults"],
+ visibility: [
+ "//art:__subpackages__",
+ "//system/core/adb/apex:__subpackages__",
+ ],
+ apex_available: [
+ "com.android.adbd",
+ "test_com.android.adbd",
+ ],
+
+ // libadbconnection_client doesn't need an embedded build number.
+ use_version_lib: false,
+
+ target: {
+ linux: {
+ version_script: "libadbconnection_client.map.txt",
+ },
+ },
+ stubs: {
+ symbol_file: "libadbconnection_client.map.txt",
+ versions: ["1"],
+ },
+
+ host_supported: true,
+ compile_multilib: "both",
+}
diff --git a/adb/adbconnection/adbconnection_client.cpp b/adb/libs/adbconnection/adbconnection_client.cpp
similarity index 100%
rename from adb/adbconnection/adbconnection_client.cpp
rename to adb/libs/adbconnection/adbconnection_client.cpp
diff --git a/adb/adbconnection/adbconnection_server.cpp b/adb/libs/adbconnection/adbconnection_server.cpp
similarity index 100%
rename from adb/adbconnection/adbconnection_server.cpp
rename to adb/libs/adbconnection/adbconnection_server.cpp
diff --git a/adb/adbconnection/include/adbconnection/client.h b/adb/libs/adbconnection/include/adbconnection/client.h
similarity index 100%
rename from adb/adbconnection/include/adbconnection/client.h
rename to adb/libs/adbconnection/include/adbconnection/client.h
diff --git a/adb/adbconnection/include/adbconnection/server.h b/adb/libs/adbconnection/include/adbconnection/server.h
similarity index 100%
rename from adb/adbconnection/include/adbconnection/server.h
rename to adb/libs/adbconnection/include/adbconnection/server.h
diff --git a/adb/adbconnection/libadbconnection_client.map.txt b/adb/libs/adbconnection/libadbconnection_client.map.txt
similarity index 100%
rename from adb/adbconnection/libadbconnection_client.map.txt
rename to adb/libs/adbconnection/libadbconnection_client.map.txt
diff --git a/adb/libs/libadbd_fs/Android.bp b/adb/libs/libadbd_fs/Android.bp
new file mode 100644
index 0000000..d178148
--- /dev/null
+++ b/adb/libs/libadbd_fs/Android.bp
@@ -0,0 +1,30 @@
+// libadbd_fs
+// =========================================================
+cc_library {
+ name: "libadbd_fs",
+ defaults: ["adbd_defaults"],
+
+ srcs: ["adbd_fs.cpp"],
+ static_libs: [
+ "libbase",
+ "libcutils",
+ "liblog",
+ ],
+ export_include_dirs: ["include"],
+
+ version_script: "libadbd_fs.map.txt",
+ stubs: {
+ versions: ["1"],
+ symbol_file: "libadbd_fs.map.txt",
+ },
+
+ host_supported: true,
+ recovery_available: true,
+ compile_multilib: "both",
+
+ target: {
+ darwin: {
+ enabled: false,
+ }
+ },
+}
diff --git a/adb/libs/libadbd_fs/adbd_fs.cpp b/adb/libs/libadbd_fs/adbd_fs.cpp
new file mode 100644
index 0000000..8e62d40
--- /dev/null
+++ b/adb/libs/libadbd_fs/adbd_fs.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <adbd_fs.h>
+
+#include <private/fs_config.h>
+
+void adbd_fs_config(const char* path, int dir, const char* target_out_path, uid_t* uid, gid_t* gid,
+ mode_t* mode, uint64_t* capabilities) {
+ unsigned uid_hack;
+ unsigned gid_hack;
+ unsigned mode_hack;
+ fs_config(path, dir, target_out_path, &uid_hack, &gid_hack, &mode_hack, capabilities);
+ *uid = uid_hack;
+ *gid = gid_hack;
+ *mode = mode_hack;
+}
diff --git a/adb/libs/libadbd_fs/include/adbd_fs.h b/adb/libs/libadbd_fs/include/adbd_fs.h
new file mode 100644
index 0000000..6158d72
--- /dev/null
+++ b/adb/libs/libadbd_fs/include/adbd_fs.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <stdint.h>
+#include <sys/types.h>
+
+extern "C" {
+// Thin wrapper around libcutils fs_config.
+void adbd_fs_config(const char* path, int dir, const char* target_out_path, uid_t* uid, gid_t* gid,
+ mode_t* mode, uint64_t* capabilities);
+}
diff --git a/adb/libs/libadbd_fs/libadbd_fs.map.txt b/adb/libs/libadbd_fs/libadbd_fs.map.txt
new file mode 100644
index 0000000..1454e96
--- /dev/null
+++ b/adb/libs/libadbd_fs/libadbd_fs.map.txt
@@ -0,0 +1,6 @@
+LIBADBD_FS {
+ global:
+ adbd_fs_config; # apex
+ local:
+ *;
+};
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 8840e7d..7bc4559 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -512,8 +512,7 @@
// Enable casefold if needed.
static void tune_casefold(const std::string& blk_device, const struct ext4_super_block* sb,
int* fs_stat) {
- bool has_casefold =
- (sb->s_feature_ro_compat & cpu_to_le32(EXT4_FEATURE_INCOMPAT_CASEFOLD)) != 0;
+ bool has_casefold = (sb->s_feature_incompat & cpu_to_le32(EXT4_FEATURE_INCOMPAT_CASEFOLD)) != 0;
bool wants_casefold = android::base::GetBoolProperty("ro.emulated_storage.casefold", false);
if (!wants_casefold || has_casefold) return;
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 84644e8..730bf6d 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -745,7 +745,9 @@
static void update_sys_usb_config() {
bool is_debuggable = android::base::GetBoolProperty("ro.debuggable", false);
std::string config = android::base::GetProperty("persist.sys.usb.config", "");
- if (config.empty()) {
+ // b/150130503, add (config == "none") condition here to prevent appending
+ // ",adb" if "none" is explicitly defined in default prop.
+ if (config.empty() || config == "none") {
InitPropertySet("persist.sys.usb.config", is_debuggable ? "adb" : "none");
} else if (is_debuggable && config.find("adb") == std::string::npos &&
config.length() + 4 < PROP_VALUE_MAX) {
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index 0379f6e..4e93df3 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -21,11 +21,6 @@
"fs.cpp",
"hashmap.cpp",
"multiuser.cpp",
- "socket_inaddr_any_server_unix.cpp",
- "socket_local_client_unix.cpp",
- "socket_local_server_unix.cpp",
- "socket_network_client_unix.cpp",
- "sockets_unix.cpp",
"str_parms.cpp",
]
@@ -49,6 +44,90 @@
},
}
+// Socket specific parts of libcutils that are safe to statically link into an APEX.
+cc_library_static {
+ name: "libcutils_sockets",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
+ recovery_available: true,
+ host_supported: true,
+ native_bridge_supported: true,
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+
+ export_include_dirs: ["include"],
+
+ srcs: ["sockets.cpp"],
+ target: {
+ linux_bionic: {
+ enabled: true,
+ },
+
+ not_windows: {
+ srcs: [
+ "socket_inaddr_any_server_unix.cpp",
+ "socket_local_client_unix.cpp",
+ "socket_local_server_unix.cpp",
+ "socket_network_client_unix.cpp",
+ "sockets_unix.cpp",
+ ],
+ },
+
+ // "not_windows" means "non-Windows host".
+ android: {
+ srcs: [
+ "android_get_control_file.cpp",
+ "socket_inaddr_any_server_unix.cpp",
+ "socket_local_client_unix.cpp",
+ "socket_local_server_unix.cpp",
+ "socket_network_client_unix.cpp",
+ "sockets_unix.cpp",
+ ],
+ static_libs: ["libbase"],
+ },
+
+ windows: {
+ host_ldlibs: ["-lws2_32"],
+ srcs: [
+ "socket_inaddr_any_server_windows.cpp",
+ "socket_network_client_windows.cpp",
+ "sockets_windows.cpp",
+ ],
+
+ enabled: true,
+ cflags: [
+ "-D_GNU_SOURCE",
+ ],
+ },
+ },
+}
+
+cc_test {
+ name: "libcutils_sockets_test",
+ test_suites: ["device-tests"],
+ static_libs: ["libbase", "libcutils_sockets"],
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+
+ srcs: ["sockets_test.cpp"],
+ target: {
+ android: {
+ srcs: [
+ "android_get_control_file_test.cpp",
+ "android_get_control_socket_test.cpp",
+ ],
+ },
+ },
+}
+
cc_library {
name: "libcutils",
vendor_available: true,
@@ -66,7 +145,6 @@
"load_file.cpp",
"native_handle.cpp",
"record_stream.cpp",
- "sockets.cpp",
"strlcpy.c",
"threads.cpp",
],
@@ -86,9 +164,6 @@
host_ldlibs: ["-lws2_32"],
srcs: [
- "socket_inaddr_any_server_windows.cpp",
- "socket_network_client_windows.cpp",
- "sockets_windows.cpp",
"trace-host.cpp",
],
@@ -97,10 +172,8 @@
"-D_GNU_SOURCE",
],
},
-
android: {
srcs: libcutils_nonwindows_sources + [
- "android_get_control_file.cpp",
"android_reboot.cpp",
"ashmem-dev.cpp",
"fs_config.cpp",
@@ -149,6 +222,7 @@
}
},
+ whole_static_libs: ["libcutils_sockets"],
shared_libs: [
"liblog",
"libbase",
diff --git a/libcutils/include/cutils/trace.h b/libcutils/include/cutils/trace.h
index e12c32c..c74ee3e 100644
--- a/libcutils/include/cutils/trace.h
+++ b/libcutils/include/cutils/trace.h
@@ -88,12 +88,6 @@
#error ATRACE_TAG must be defined to be one of the tags defined in cutils/trace.h
#endif
-// Set this to 0 to revert to the old Binder-based atrace implementation.
-// This is only here in case rollbacks do not apply cleanly.
-// TODO(fmayer): Remove this once we are confident this won't need to be
-// rolled back, no later than 2020-03-01.
-#define ATRACE_SHMEM 1
-
/**
* Opens the trace file for writing and reads the property for initial tags.
* The atrace.tags.enableflags property sets the tags to trace.
@@ -121,15 +115,11 @@
* prevent tracing within the Zygote process.
*/
void atrace_set_tracing_enabled(bool enabled);
+
/**
- * If !ATRACE_SHMEM:
- * Flag indicating whether setup has been completed, initialized to 0.
- * Nonzero indicates setup has completed.
- * Note: This does NOT indicate whether or not setup was successful.
- * If ATRACE_SHMEM:
- * This is always set to false. This forces code that uses an old version
- * of this header to always call into atrace_setup, in which we call
- * atrace_init unconditionally.
+ * This is always set to false. This forces code that uses an old version
+ * of this header to always call into atrace_setup, in which we call
+ * atrace_init unconditionally.
*/
extern atomic_bool atrace_is_ready;
@@ -154,28 +144,8 @@
#define ATRACE_INIT() atrace_init()
#define ATRACE_GET_ENABLED_TAGS() atrace_get_enabled_tags()
-#if ATRACE_SHMEM
void atrace_init();
uint64_t atrace_get_enabled_tags();
-#else
-static inline void atrace_init()
-{
- if (CC_UNLIKELY(!atomic_load_explicit(&atrace_is_ready, memory_order_acquire))) {
- atrace_setup();
- }
-}
-
-/**
- * Get the mask of all tags currently enabled.
- * It can be used as a guard condition around more expensive trace calculations.
- * Every trace function calls this, which ensures atrace_init is run.
- */
-static inline uint64_t atrace_get_enabled_tags()
-{
- atrace_init();
- return atrace_enabled_tags;
-}
-#endif
/**
* Test if a given tag is currently enabled.
diff --git a/libcutils/include/private/android_filesystem_config.h b/libcutils/include/private/android_filesystem_config.h
index a2d36ff..b73a29b 100644
--- a/libcutils/include/private/android_filesystem_config.h
+++ b/libcutils/include/private/android_filesystem_config.h
@@ -133,6 +133,7 @@
#define AID_EXTERNAL_STORAGE 1077 /* Full external storage access including USB OTG volumes */
#define AID_EXT_DATA_RW 1078 /* GID for app-private data directories on external storage */
#define AID_EXT_OBB_RW 1079 /* GID for OBB directories on external storage */
+#define AID_CONTEXT_HUB 1080 /* GID for access to the Context Hub */
/* Changes to this file must be made in AOSP, *not* in internal branches. */
#define AID_SHELL 2000 /* adb and debug shell user */
diff --git a/libcutils/trace-dev.cpp b/libcutils/trace-dev.cpp
index 9ca1729..5a09a2d 100644
--- a/libcutils/trace-dev.cpp
+++ b/libcutils/trace-dev.cpp
@@ -41,9 +41,6 @@
} else {
atrace_enabled_tags = atrace_get_property();
}
-#if !ATRACE_SHMEM
- atomic_store_explicit(&atrace_is_ready, true, memory_order_release);
-#endif
}
static void atrace_seq_number_changed(uint32_t prev_seq_no, uint32_t seq_no) {
@@ -69,11 +66,7 @@
void atrace_setup()
{
-#if ATRACE_SHMEM
atrace_init();
-#else
- pthread_once(&atrace_once_control, atrace_init_once);
-#endif
}
void atrace_begin_body(const char* name)
diff --git a/libcutils/trace-dev.inc b/libcutils/trace-dev.inc
index a57a4c5..3ec98b3 100644
--- a/libcutils/trace-dev.inc
+++ b/libcutils/trace-dev.inc
@@ -71,8 +71,6 @@
static const prop_info* atrace_property_info = reinterpret_cast<const prop_info*>(empty_pi);
#endif
-#if ATRACE_SHMEM
-
/**
* This is called when the sequence number of debug.atrace.tags.enableflags
* changes and we need to reload the enabled tags.
@@ -96,7 +94,6 @@
atrace_init();
return atrace_enabled_tags;
}
-#endif
// Set whether this process is debuggable, which determines whether
// application-level tracing is allowed when the ro.debuggable system property
@@ -186,19 +183,17 @@
void atrace_update_tags()
{
uint64_t tags;
- if (ATRACE_SHMEM || CC_UNLIKELY(atomic_load_explicit(&atrace_is_ready, memory_order_acquire))) {
- if (atomic_load_explicit(&atrace_is_enabled, memory_order_acquire)) {
- tags = atrace_get_property();
- pthread_mutex_lock(&atrace_tags_mutex);
- atrace_enabled_tags = tags;
- pthread_mutex_unlock(&atrace_tags_mutex);
- } else {
- // Tracing is disabled for this process, so we simply don't
- // initialize the tags.
- pthread_mutex_lock(&atrace_tags_mutex);
- atrace_enabled_tags = ATRACE_TAG_NOT_READY;
- pthread_mutex_unlock(&atrace_tags_mutex);
- }
+ if (atomic_load_explicit(&atrace_is_enabled, memory_order_acquire)) {
+ tags = atrace_get_property();
+ pthread_mutex_lock(&atrace_tags_mutex);
+ atrace_enabled_tags = tags;
+ pthread_mutex_unlock(&atrace_tags_mutex);
+ } else {
+ // Tracing is disabled for this process, so we simply don't
+ // initialize the tags.
+ pthread_mutex_lock(&atrace_tags_mutex);
+ atrace_enabled_tags = ATRACE_TAG_NOT_READY;
+ pthread_mutex_unlock(&atrace_tags_mutex);
}
}
diff --git a/libcutils/trace-host.cpp b/libcutils/trace-host.cpp
index c21d0ee..9781ad3 100644
--- a/libcutils/trace-host.cpp
+++ b/libcutils/trace-host.cpp
@@ -30,10 +30,8 @@
void atrace_async_end_body(const char* /*name*/, int32_t /*cookie*/) {}
void atrace_int_body(const char* /*name*/, int32_t /*value*/) {}
void atrace_int64_body(const char* /*name*/, int64_t /*value*/) {}
-#if ATRACE_SHMEM
void atrace_init() {}
uint64_t atrace_get_enabled_tags()
{
return ATRACE_TAG_NOT_READY;
}
-#endif