diff options
author | Steven Moreland <smoreland@google.com> | 2018-10-11 15:20:04 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-10-12 16:31:04 +0000 |
commit | 7c93337add97ce36f0a35c6705f3a67a441f2ae7 (patch) | |
tree | 77813b5e7b5d9fde4435e20ef8e27f9872380a04 /aidl_to_ndk.cpp | |
parent | b3cd3c7e3a2943740f586575ce095a5af66cb524 (diff) | |
download | aidl-7c93337add97ce36f0a35c6705f3a67a441f2ae7.tar.gz |
NDK Backend: different header locationsandroid-o-mr1-iot-release-smart-display-r3oreo-mr1-1.2-iot-release
For an interface 'my.package.IFoo', we generate:
CPP Backend -> ::my::package::IFoo
NDK Backend -> ::aidl::my::package::IFoo
Before this change their headers were located in the same location:
CPP Backend -> "my/package/*Foo.h"
NDK Backend -> "my/package/*Foo.h"
Now, NDK Backend headers correspond to their namespace:
CPP Backend -> "my/package/*Foo.h"
NDK Backend -> "aidl/my/package/*Foo.h"
This prevents header collisions just like the separate packages
prevents ODR violations. Header collisions are expected when one
library uses the cpp backend and the other uses the ndk backend.
For instance, imagine 'libfoo' is APEXified and uses the NDK backend.
However, food (foo daemon) uses both libfoo and the CPP Backend to talk
to the service. In this case, the pre-existing headers would collide.
Bug: 112664205
Test: atest android.binder.cts
Change-Id: Iba6e9c2e4a37fa3c9c9115f65c48e0991057c7f2
Diffstat (limited to 'aidl_to_ndk.cpp')
-rw-r--r-- | aidl_to_ndk.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/aidl_to_ndk.cpp b/aidl_to_ndk.cpp index 56473a56..d5b00720 100644 --- a/aidl_to_ndk.cpp +++ b/aidl_to_ndk.cpp @@ -16,6 +16,7 @@ #include "aidl_language.h" #include "aidl_to_cpp_common.h" #include "logging.h" +#include "os.h" #include <android-base/strings.h> @@ -28,6 +29,12 @@ namespace android { namespace aidl { namespace ndk { +std::string NdkHeaderFile(const AidlDefinedType& defined_type, cpp::ClassNames name, + bool use_os_sep) { + char seperator = (use_os_sep) ? OS_PATH_SEPARATOR : '/'; + return std::string("aidl") + seperator + cpp::HeaderFile(defined_type, name, use_os_sep); +} + struct TypeInfo { // name of the type in C++ output std::string cpp_name; |