Loading libs/binder/Android.bp +84 −15 Original line number Diff line number Diff line Loading @@ -22,23 +22,51 @@ package { } cc_library_headers { name: "libbinder_headers", name: "libbinder_headers_base", export_include_dirs: ["include"], vendor_available: true, recovery_available: true, host_supported: true, // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, header_libs: [ "libbase_headers", "libbinder_headers_platform_shared", ], export_header_lib_headers: [ "libbinder_headers_platform_shared", ], apex_available: [ "//apex_available:platform", "com.android.media", "com.android.media.swcodec", ], min_sdk_version: "29", target: { darwin: { enabled: false, }, }, visibility: [ ":__subpackages__", ], } cc_library_headers { name: "libbinder_headers", vendor_available: true, recovery_available: true, host_supported: true, native_bridge_supported: true, header_libs: [ "libbase_headers", "libbinder_headers_base", "libcutils_headers", "libutils_headers", ], export_header_lib_headers: [ "libbase_headers", "libbinder_headers_platform_shared", "libbinder_headers_base", "libcutils_headers", "libutils_headers", ], Loading Loading @@ -87,6 +115,7 @@ cc_defaults { "RpcSession.cpp", "RpcServer.cpp", "RpcState.cpp", "RpcTransportRaw.cpp", "Stability.cpp", "Status.cpp", "TextOutput.cpp", Loading @@ -94,17 +123,8 @@ cc_defaults { "file.cpp", ], shared_libs: [ "libcutils", "libutils", ], static_libs: [ "libbase", ], header_libs: [ "libbinder_headers", "libbinder_headers_base", ], cflags: [ Loading @@ -131,7 +151,6 @@ cc_defaults { srcs: [ "OS_android.cpp", "OS_unix_base.cpp", "RpcTransportRaw.cpp", ], target: { Loading @@ -156,11 +175,18 @@ cc_defaults { }, shared_libs: [ "libcutils", "liblog", "libutils", ], static_libs: [ "libbase", ], header_libs: [ "jni_headers", "libbinder_headers", ], export_header_lib_headers: [ Loading Loading @@ -217,10 +243,15 @@ cc_defaults { host_supported: true, header_libs: [ "libbinder_headers_base", "liblog_stub", "trusty_mock_headers", ], shared_libs: [ "libutils_binder_sdk", ], cflags: [ "-DBINDER_RPC_SINGLE_THREADED", "-DBINDER_ENABLE_LIBLOG_ASSERT", Loading Loading @@ -351,6 +382,44 @@ cc_library { afdo: true, } cc_library_host_shared { name: "libbinder_sdk", defaults: [ "libbinder_common_defaults", ], shared_libs: [ "libutils_binder_sdk", ], cflags: [ "-DBINDER_ENABLE_LIBLOG_ASSERT", "-DBINDER_DISABLE_NATIVE_HANDLE", "-DBINDER_DISABLE_BLOB", "-DBINDER_NO_LIBBASE", ], header_libs: [ "liblog_stub", ], srcs: [ "OS_non_android_linux.cpp", "OS_unix_base.cpp", ], visibility: [ ":__subpackages__", ], target: { windows: { enabled: false, }, }, } cc_library_static { name: "libbinder_rpc_no_kernel", vendor_available: true, Loading libs/binder/OS_non_android_linux.cpp 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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 "OS.h" #include <log/log.h> #include <syscall.h> #include <cstdarg> #ifdef __ANDROID__ #error "This module is not intended for Android, just bare Linux" #endif #ifdef __APPLE__ #error "This module is not intended for MacOS" #endif #ifdef _WIN32 #error "This module is not intended for Windows" #endif namespace android::binder::os { void trace_begin(uint64_t, const char*) {} void trace_end(uint64_t) {} uint64_t GetThreadId() { return syscall(__NR_gettid); } bool report_sysprop_change() { return false; } } // namespace android::binder::os int __android_log_print(int /*prio*/, const char* /*tag*/, const char* fmt, ...) { va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); return 1; } libs/binder/trusty/OS.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -126,8 +126,3 @@ int __android_log_print(int prio [[maybe_unused]], const char* tag, const char* return 1; } // TODO(b/285204695): remove once trusty mock doesn't depend on libbase extern "C" int __android_log_buf_print(int, int, const char*, const char*, ...) { return -ENOSYS; } Loading
libs/binder/Android.bp +84 −15 Original line number Diff line number Diff line Loading @@ -22,23 +22,51 @@ package { } cc_library_headers { name: "libbinder_headers", name: "libbinder_headers_base", export_include_dirs: ["include"], vendor_available: true, recovery_available: true, host_supported: true, // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, header_libs: [ "libbase_headers", "libbinder_headers_platform_shared", ], export_header_lib_headers: [ "libbinder_headers_platform_shared", ], apex_available: [ "//apex_available:platform", "com.android.media", "com.android.media.swcodec", ], min_sdk_version: "29", target: { darwin: { enabled: false, }, }, visibility: [ ":__subpackages__", ], } cc_library_headers { name: "libbinder_headers", vendor_available: true, recovery_available: true, host_supported: true, native_bridge_supported: true, header_libs: [ "libbase_headers", "libbinder_headers_base", "libcutils_headers", "libutils_headers", ], export_header_lib_headers: [ "libbase_headers", "libbinder_headers_platform_shared", "libbinder_headers_base", "libcutils_headers", "libutils_headers", ], Loading Loading @@ -87,6 +115,7 @@ cc_defaults { "RpcSession.cpp", "RpcServer.cpp", "RpcState.cpp", "RpcTransportRaw.cpp", "Stability.cpp", "Status.cpp", "TextOutput.cpp", Loading @@ -94,17 +123,8 @@ cc_defaults { "file.cpp", ], shared_libs: [ "libcutils", "libutils", ], static_libs: [ "libbase", ], header_libs: [ "libbinder_headers", "libbinder_headers_base", ], cflags: [ Loading @@ -131,7 +151,6 @@ cc_defaults { srcs: [ "OS_android.cpp", "OS_unix_base.cpp", "RpcTransportRaw.cpp", ], target: { Loading @@ -156,11 +175,18 @@ cc_defaults { }, shared_libs: [ "libcutils", "liblog", "libutils", ], static_libs: [ "libbase", ], header_libs: [ "jni_headers", "libbinder_headers", ], export_header_lib_headers: [ Loading Loading @@ -217,10 +243,15 @@ cc_defaults { host_supported: true, header_libs: [ "libbinder_headers_base", "liblog_stub", "trusty_mock_headers", ], shared_libs: [ "libutils_binder_sdk", ], cflags: [ "-DBINDER_RPC_SINGLE_THREADED", "-DBINDER_ENABLE_LIBLOG_ASSERT", Loading Loading @@ -351,6 +382,44 @@ cc_library { afdo: true, } cc_library_host_shared { name: "libbinder_sdk", defaults: [ "libbinder_common_defaults", ], shared_libs: [ "libutils_binder_sdk", ], cflags: [ "-DBINDER_ENABLE_LIBLOG_ASSERT", "-DBINDER_DISABLE_NATIVE_HANDLE", "-DBINDER_DISABLE_BLOB", "-DBINDER_NO_LIBBASE", ], header_libs: [ "liblog_stub", ], srcs: [ "OS_non_android_linux.cpp", "OS_unix_base.cpp", ], visibility: [ ":__subpackages__", ], target: { windows: { enabled: false, }, }, } cc_library_static { name: "libbinder_rpc_no_kernel", vendor_available: true, Loading
libs/binder/OS_non_android_linux.cpp 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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 "OS.h" #include <log/log.h> #include <syscall.h> #include <cstdarg> #ifdef __ANDROID__ #error "This module is not intended for Android, just bare Linux" #endif #ifdef __APPLE__ #error "This module is not intended for MacOS" #endif #ifdef _WIN32 #error "This module is not intended for Windows" #endif namespace android::binder::os { void trace_begin(uint64_t, const char*) {} void trace_end(uint64_t) {} uint64_t GetThreadId() { return syscall(__NR_gettid); } bool report_sysprop_change() { return false; } } // namespace android::binder::os int __android_log_print(int /*prio*/, const char* /*tag*/, const char* fmt, ...) { va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); return 1; }
libs/binder/trusty/OS.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -126,8 +126,3 @@ int __android_log_print(int prio [[maybe_unused]], const char* tag, const char* return 1; } // TODO(b/285204695): remove once trusty mock doesn't depend on libbase extern "C" int __android_log_buf_print(int, int, const char*, const char*, ...) { return -ENOSYS; }