Add a standardized shared memory type
This adds a simple SharedFileRegion type that can be used to pass blocks
of shared memory between processes in a structured AIDL interface.
In addition a small utility library is provided for interfacing with
existing code that uses IMemory.
The intention is to add utilities for direct usage of the memory
content.
Bug: 160253486
Test: Ran the included unit test. Integration testing as part of whole
topic tests via the audio effect tests.
Change-Id: I3f923047e364ba44fda316bdd563561ebec201b2
diff --git a/media/libshmem/Android.bp b/media/libshmem/Android.bp
new file mode 100644
index 0000000..ee33f9e
--- /dev/null
+++ b/media/libshmem/Android.bp
@@ -0,0 +1,50 @@
+aidl_interface {
+ name: "shared-file-region-aidl",
+ unstable: true,
+ local_include_dir: "aidl",
+ srcs: [
+ "aidl/android/media/SharedFileRegion.aidl",
+ ],
+}
+
+cc_library {
+ name: "libshmemcompat",
+ export_include_dirs: ["include"],
+ srcs: ["ShmemCompat.cpp"],
+ shared_libs: [
+ "libbinder",
+ "libshmemutil",
+ "libutils",
+ "shared-file-region-aidl-cpp",
+ ],
+ export_shared_lib_headers: [
+ "libbinder",
+ "libutils",
+ "shared-file-region-aidl-cpp",
+ ],
+}
+
+cc_library {
+ name: "libshmemutil",
+ export_include_dirs: ["include"],
+ srcs: ["ShmemUtil.cpp"],
+ shared_libs: [
+ "shared-file-region-aidl-cpp",
+ ],
+ export_shared_lib_headers: [
+ "shared-file-region-aidl-cpp",
+ ],
+}
+
+cc_test {
+ name: "shmemTest",
+ srcs: ["ShmemTest.cpp"],
+ shared_libs: [
+ "libbinder",
+ "libshmemcompat",
+ "libshmemutil",
+ "libutils",
+ "shared-file-region-aidl-cpp",
+ ],
+ test_suites: ["device-tests"],
+}