summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jesse Hall <jessehall@google.com> 2017-04-17 08:52:32 -0700
committer Jesse Hall <jessehall@google.com> 2017-04-17 12:32:12 -0700
commit1ee859f7f883ef1b17d25dc784fb9ea233c152a4 (patch)
treeef644d45f9f4193bcbfbec1f3bcf9544a0190f47
parent80a50bdc3b48ef3a1e214d85712ecc835fbaa289 (diff)
Move AHardwareBuffer_getNativeHandle to VNDK
This was added to the NDK only because we didn't have a way to do VNDK-only declarations. Now we do. Bug: 34050596 Test: make checkbuild Change-Id: I039fccfd9f29c5cc960e7691f0baa70101659949
-rw-r--r--libs/nativewindow/AHardwareBuffer.cpp9
-rw-r--r--libs/nativewindow/include/android/hardware_buffer.h6
-rw-r--r--libs/nativewindow/include/vndk/hardware_buffer.h31
-rw-r--r--libs/nativewindow/libnativewindow.map.txt1
-rw-r--r--libs/nativewindow/tests/c_compatibility.c1
5 files changed, 39 insertions, 9 deletions
diff --git a/libs/nativewindow/AHardwareBuffer.cpp b/libs/nativewindow/AHardwareBuffer.cpp
index 5812831811..35b76c7095 100644
--- a/libs/nativewindow/AHardwareBuffer.cpp
+++ b/libs/nativewindow/AHardwareBuffer.cpp
@@ -16,7 +16,7 @@
#define LOG_TAG "AHardwareBuffer"
-#include <android/hardware_buffer.h>
+#include <vndk/hardware_buffer.h>
#include <errno.h>
#include <sys/socket.h>
@@ -261,7 +261,12 @@ int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** out
return NO_ERROR;
}
-const struct native_handle* AHardwareBuffer_getNativeHandle(
+
+// ----------------------------------------------------------------------------
+// VNDK functions
+// ----------------------------------------------------------------------------
+
+const native_handle_t* AHardwareBuffer_getNativeHandle(
const AHardwareBuffer* buffer) {
if (!buffer) return nullptr;
const GraphicBuffer* gbuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
diff --git a/libs/nativewindow/include/android/hardware_buffer.h b/libs/nativewindow/include/android/hardware_buffer.h
index e5b685337c..02838d4102 100644
--- a/libs/nativewindow/include/android/hardware_buffer.h
+++ b/libs/nativewindow/include/android/hardware_buffer.h
@@ -252,12 +252,6 @@ int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int so
*/
int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer);
-// ----------------------------------------------------------------------------
-// Everything below here is part of the public NDK API, but is intended only
-// for use by device-specific graphics drivers.
-struct native_handle;
-const struct native_handle* AHardwareBuffer_getNativeHandle(const AHardwareBuffer* buffer);
-
__END_DECLS
#endif // ANDROID_HARDWARE_BUFFER_H
diff --git a/libs/nativewindow/include/vndk/hardware_buffer.h b/libs/nativewindow/include/vndk/hardware_buffer.h
new file mode 100644
index 0000000000..dc2dcbe327
--- /dev/null
+++ b/libs/nativewindow/include/vndk/hardware_buffer.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H
+#define ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H
+
+// vndk is a superset of the NDK
+#include <android/hardware_buffer.h>
+
+#include <cutils/native_handle.h>
+
+__BEGIN_DECLS
+
+const native_handle_t* AHardwareBuffer_getNativeHandle(const AHardwareBuffer* buffer);
+
+__END_DECLS
+
+#endif /* ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H */
diff --git a/libs/nativewindow/libnativewindow.map.txt b/libs/nativewindow/libnativewindow.map.txt
index b29c8888a3..b1d1a725a1 100644
--- a/libs/nativewindow/libnativewindow.map.txt
+++ b/libs/nativewindow/libnativewindow.map.txt
@@ -4,7 +4,6 @@ LIBNATIVEWINDOW {
AHardwareBuffer_allocate;
AHardwareBuffer_describe;
AHardwareBuffer_fromHardwareBuffer;
- AHardwareBuffer_getNativeHandle;
AHardwareBuffer_lock;
AHardwareBuffer_recvHandleFromUnixSocket;
AHardwareBuffer_release;
diff --git a/libs/nativewindow/tests/c_compatibility.c b/libs/nativewindow/tests/c_compatibility.c
index a0dfdf9fb1..befd88fd07 100644
--- a/libs/nativewindow/tests/c_compatibility.c
+++ b/libs/nativewindow/tests/c_compatibility.c
@@ -16,6 +16,7 @@
#include <android/hardware_buffer.h>
#include <android/native_window.h>
+#include <vndk/hardware_buffer.h>
#include <vndk/window.h>
// this checks that all these headers are C-compatible