summaryrefslogtreecommitdiff
path: root/include/android_stub
diff options
context:
space:
mode:
Diffstat (limited to 'include/android_stub')
-rw-r--r--include/android_stub/android/hardware_buffer.h7
-rw-r--r--include/android_stub/android/log.h2
-rw-r--r--include/android_stub/android/native_window.h12
-rw-r--r--include/android_stub/apex/window.h210
-rw-r--r--include/android_stub/cutils/compiler.h44
-rw-r--r--include/android_stub/cutils/trace.h238
-rw-r--r--include/android_stub/log/log_main.h10
-rw-r--r--include/android_stub/ndk/sync.h4
-rw-r--r--include/android_stub/vndk/hardware_buffer.h14
9 files changed, 300 insertions, 241 deletions
diff --git a/include/android_stub/android/hardware_buffer.h b/include/android_stub/android/hardware_buffer.h
index ae5e47ba97f..dcb05b5536d 100644
--- a/include/android_stub/android/hardware_buffer.h
+++ b/include/android_stub/android/hardware_buffer.h
@@ -332,8 +332,6 @@ typedef struct AHardwareBuffer_Planes {
*/
typedef struct AHardwareBuffer AHardwareBuffer;
-#if __ANDROID_API__ >= 26
-
/**
* Allocates a buffer that matches the passed AHardwareBuffer_Desc.
*
@@ -501,10 +499,6 @@ int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int so
*/
int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer) __INTRODUCED_IN(26);
-#endif // __ANDROID_API__ >= 26
-
-#if __ANDROID_API__ >= 29
-
/**
* Test whether the given format and usage flag combination is
* allocatable.
@@ -540,7 +534,6 @@ int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* desc) __INTRODUCED_I
int AHardwareBuffer_lockAndGetInfo(AHardwareBuffer* buffer, uint64_t usage,
int32_t fence, const ARect* rect, void** outVirtualAddress,
int32_t* outBytesPerPixel, int32_t* outBytesPerStride) __INTRODUCED_IN(29);
-#endif // __ANDROID_API__ >= 29
__END_DECLS
diff --git a/include/android_stub/android/log.h b/include/android_stub/android/log.h
index 8a0ebf22fee..5dc365a4dd1 100644
--- a/include/android_stub/android/log.h
+++ b/include/android_stub/android/log.h
@@ -217,7 +217,6 @@ typedef void (*__android_logger_function)(const struct __android_log_message* lo
*/
typedef void (*__android_aborter_function)(const char* abort_message);
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
/**
* Writes the log message specified by log_message. log_message includes additional file name and
* line number information that a logger may use. log_message is versioned for backwards
@@ -371,7 +370,6 @@ int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(30);
* Available since API level 30.
*/
void __android_log_set_default_tag(const char* tag) __INTRODUCED_IN(30);
-#endif
#ifdef __cplusplus
}
diff --git a/include/android_stub/android/native_window.h b/include/android_stub/android/native_window.h
index 36aad2eced7..a3a45e37053 100644
--- a/include/android_stub/android/native_window.h
+++ b/include/android_stub/android/native_window.h
@@ -185,8 +185,6 @@ int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffe
*/
int32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
-#if __ANDROID_API__ >= 26
-
/**
* Set a transform that will be applied to future buffers posted to the window.
*
@@ -197,10 +195,6 @@ int32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
*/
int32_t ANativeWindow_setBuffersTransform(ANativeWindow* window, int32_t transform) __INTRODUCED_IN(26);
-#endif // __ANDROID_API__ >= 26
-
-#if __ANDROID_API__ >= 28
-
/**
* All buffers queued after this call will be associated with the dataSpace
* parameter specified.
@@ -229,10 +223,6 @@ int32_t ANativeWindow_setBuffersDataSpace(ANativeWindow* window, int32_t dataSpa
*/
int32_t ANativeWindow_getBuffersDataSpace(ANativeWindow* window) __INTRODUCED_IN(28);
-#endif // __ANDROID_API__ >= 28
-
-#if __ANDROID_API__ >= 30
-
/** Compatibility value for ANativeWindow_setFrameRate. */
enum ANativeWindow_FrameRateCompatibility {
/**
@@ -301,8 +291,6 @@ int32_t ANativeWindow_setFrameRate(ANativeWindow* window, float frameRate, int8_
*/
void ANativeWindow_tryAllocateBuffers(ANativeWindow* window);
-#endif // __ANDROID_API__ >= 30
-
#ifdef __cplusplus
};
#endif
diff --git a/include/android_stub/apex/window.h b/include/android_stub/apex/window.h
deleted file mode 100644
index 2d1354cdf1f..00000000000
--- a/include/android_stub/apex/window.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright 2019 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 <nativebase/nativebase.h>
-#include <stdarg.h>
-
-// apex is a superset of the NDK
-#include <android/native_window.h>
-
-__BEGIN_DECLS
-
-/*
- * perform bits that can be used with ANativeWindow_perform()
- *
- * This is only to support the intercepting methods below - these should notbe
- * used directly otherwise.
- */
-enum ANativeWindowPerform {
- // clang-format off
- ANATIVEWINDOW_PERFORM_SET_USAGE = 0,
- ANATIVEWINDOW_PERFORM_SET_BUFFERS_GEOMETRY = 5,
- ANATIVEWINDOW_PERFORM_SET_BUFFERS_FORMAT = 9,
- ANATIVEWINDOW_PERFORM_SET_USAGE64 = 30,
- // clang-format on
-};
-
-/**
- * Prototype of the function that an ANativeWindow implementation would call
- * when ANativeWindow_cancelBuffer is called.
- */
-typedef int (*ANativeWindow_cancelBufferFn)(ANativeWindow* window, ANativeWindowBuffer* buffer,
- int fenceFd);
-
-/**
- * Prototype of the function that intercepts an invocation of
- * ANativeWindow_cancelBufferFn, along with a data pointer that's passed by the
- * caller who set the interceptor, as well as arguments that would be
- * passed to ANativeWindow_cancelBufferFn if it were to be called.
- */
-typedef int (*ANativeWindow_cancelBufferInterceptor)(ANativeWindow* window,
- ANativeWindow_cancelBufferFn cancelBuffer,
- void* data, ANativeWindowBuffer* buffer,
- int fenceFd);
-
-/**
- * Prototype of the function that an ANativeWindow implementation would call
- * when ANativeWindow_dequeueBuffer is called.
- */
-typedef int (*ANativeWindow_dequeueBufferFn)(ANativeWindow* window, ANativeWindowBuffer** buffer,
- int* fenceFd);
-
-/**
- * Prototype of the function that intercepts an invocation of
- * ANativeWindow_dequeueBufferFn, along with a data pointer that's passed by the
- * caller who set the interceptor, as well as arguments that would be
- * passed to ANativeWindow_dequeueBufferFn if it were to be called.
- */
-typedef int (*ANativeWindow_dequeueBufferInterceptor)(ANativeWindow* window,
- ANativeWindow_dequeueBufferFn dequeueBuffer,
- void* data, ANativeWindowBuffer** buffer,
- int* fenceFd);
-
-/**
- * Prototype of the function that an ANativeWindow implementation would call
- * when ANativeWindow_perform is called.
- */
-typedef int (*ANativeWindow_performFn)(ANativeWindow* window, int operation, va_list args);
-
-/**
- * Prototype of the function that intercepts an invocation of
- * ANativeWindow_performFn, along with a data pointer that's passed by the
- * caller who set the interceptor, as well as arguments that would be
- * passed to ANativeWindow_performFn if it were to be called.
- */
-typedef int (*ANativeWindow_performInterceptor)(ANativeWindow* window,
- ANativeWindow_performFn perform, void* data,
- int operation, va_list args);
-
-/**
- * Prototype of the function that an ANativeWindow implementation would call
- * when ANativeWindow_queueBuffer is called.
- */
-typedef int (*ANativeWindow_queueBufferFn)(ANativeWindow* window, ANativeWindowBuffer* buffer,
- int fenceFd);
-
-/**
- * Prototype of the function that intercepts an invocation of
- * ANativeWindow_queueBufferFn, along with a data pointer that's passed by the
- * caller who set the interceptor, as well as arguments that would be
- * passed to ANativeWindow_queueBufferFn if it were to be called.
- */
-typedef int (*ANativeWindow_queueBufferInterceptor)(ANativeWindow* window,
- ANativeWindow_queueBufferFn queueBuffer,
- void* data, ANativeWindowBuffer* buffer,
- int fenceFd);
-
-/**
- * Registers an interceptor for ANativeWindow_cancelBuffer. Instead of calling
- * the underlying cancelBuffer function, instead the provided interceptor is
- * called, which may optionally call the underlying cancelBuffer function. An
- * optional data pointer is also provided to side-channel additional arguments.
- *
- * Note that usage of this should only be used for specialized use-cases by
- * either the system partition or to Mainline modules. This should never be
- * exposed to NDK or LL-NDK.
- *
- * Returns NO_ERROR on success, -errno if registration failed.
- */
-int ANativeWindow_setCancelBufferInterceptor(ANativeWindow* window,
- ANativeWindow_cancelBufferInterceptor interceptor,
- void* data);
-
-/**
- * Registers an interceptor for ANativeWindow_dequeueBuffer. Instead of calling
- * the underlying dequeueBuffer function, instead the provided interceptor is
- * called, which may optionally call the underlying dequeueBuffer function. An
- * optional data pointer is also provided to side-channel additional arguments.
- *
- * Note that usage of this should only be used for specialized use-cases by
- * either the system partition or to Mainline modules. This should never be
- * exposed to NDK or LL-NDK.
- *
- * Returns NO_ERROR on success, -errno if registration failed.
- */
-int ANativeWindow_setDequeueBufferInterceptor(ANativeWindow* window,
- ANativeWindow_dequeueBufferInterceptor interceptor,
- void* data);
-/**
- * Registers an interceptor for ANativeWindow_perform. Instead of calling
- * the underlying perform function, instead the provided interceptor is
- * called, which may optionally call the underlying perform function. An
- * optional data pointer is also provided to side-channel additional arguments.
- *
- * Note that usage of this should only be used for specialized use-cases by
- * either the system partition or to Mainline modules. This should never be
- * exposed to NDK or LL-NDK.
- *
- * Returns NO_ERROR on success, -errno if registration failed.
- */
-int ANativeWindow_setPerformInterceptor(ANativeWindow* window,
- ANativeWindow_performInterceptor interceptor, void* data);
-/**
- * Registers an interceptor for ANativeWindow_queueBuffer. Instead of calling
- * the underlying queueBuffer function, instead the provided interceptor is
- * called, which may optionally call the underlying queueBuffer function. An
- * optional data pointer is also provided to side-channel additional arguments.
- *
- * Note that usage of this should only be used for specialized use-cases by
- * either the system partition or to Mainline modules. This should never be
- * exposed to NDK or LL-NDK.
- *
- * Returns NO_ERROR on success, -errno if registration failed.
- */
-int ANativeWindow_setQueueBufferInterceptor(ANativeWindow* window,
- ANativeWindow_queueBufferInterceptor interceptor,
- void* data);
-
-/**
- * Retrieves how long it took for the last time a buffer was dequeued.
- *
- * \return the dequeue duration in nanoseconds
- */
-int64_t ANativeWindow_getLastDequeueDuration(ANativeWindow* window);
-
-/**
- * Retrieves how long it took for the last time a buffer was queued.
- *
- * \return the queue duration in nanoseconds
- */
-int64_t ANativeWindow_getLastQueueDuration(ANativeWindow* window);
-
-/**
- * Retrieves the system time in nanoseconds when the last time a buffer
- * started to be dequeued.
- *
- * \return the start time in nanoseconds
- */
-int64_t ANativeWindow_getLastDequeueStartTime(ANativeWindow* window);
-
-/**
- * Sets a timeout in nanoseconds for dequeue calls. All subsequent dequeue calls
- * made by the window will return -ETIMEDOUT after the timeout if the dequeue
- * takes too long.
- *
- * If the provided timeout is negative, hen this removes the previously configured
- * timeout. The window then behaves as if ANativeWindow_setDequeueTimeout was
- * never called.
- *
- * \return NO_ERROR on success
- * \return BAD_VALUE if the dequeue timeout was unabled to be updated, as
- * updating the dequeue timeout may change internals of the underlying window.
- */
-int ANativeWindow_setDequeueTimeout(ANativeWindow* window, int64_t timeout);
-
-__END_DECLS
diff --git a/include/android_stub/cutils/compiler.h b/include/android_stub/cutils/compiler.h
new file mode 100644
index 00000000000..70f884a1e70
--- /dev/null
+++ b/include/android_stub/cutils/compiler.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 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_CUTILS_COMPILER_H
+#define ANDROID_CUTILS_COMPILER_H
+
+/*
+ * helps the compiler's optimizer predicting branches
+ */
+
+#ifdef __cplusplus
+# define CC_LIKELY( exp ) (__builtin_expect( !!(exp), true ))
+# define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), false ))
+#else
+# define CC_LIKELY( exp ) (__builtin_expect( !!(exp), 1 ))
+# define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), 0 ))
+#endif
+
+/**
+ * exports marked symbols
+ *
+ * if used on a C++ class declaration, this macro must be inserted
+ * after the "class" keyword. For instance:
+ *
+ * template <typename TYPE>
+ * class ANDROID_API Singleton { }
+ */
+
+#define ANDROID_API __attribute__((visibility("default")))
+
+#endif // ANDROID_CUTILS_COMPILER_H
diff --git a/include/android_stub/cutils/trace.h b/include/android_stub/cutils/trace.h
new file mode 100644
index 00000000000..24c6ae62905
--- /dev/null
+++ b/include/android_stub/cutils/trace.h
@@ -0,0 +1,238 @@
+/*
+ * Copyright (C) 2012 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 _LIBS_CUTILS_TRACE_H
+#define _LIBS_CUTILS_TRACE_H
+
+#include <inttypes.h>
+#include <stdatomic.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <cutils/compiler.h>
+
+__BEGIN_DECLS
+
+/**
+ * The ATRACE_TAG macro can be defined before including this header to trace
+ * using one of the tags defined below. It must be defined to one of the
+ * following ATRACE_TAG_* macros. The trace tag is used to filter tracing in
+ * userland to avoid some of the runtime cost of tracing when it is not desired.
+ *
+ * Defining ATRACE_TAG to be ATRACE_TAG_ALWAYS will result in the tracing always
+ * being enabled - this should ONLY be done for debug code, as userland tracing
+ * has a performance cost even when the trace is not being recorded. Defining
+ * ATRACE_TAG to be ATRACE_TAG_NEVER or leaving ATRACE_TAG undefined will result
+ * in the tracing always being disabled.
+ *
+ * ATRACE_TAG_HAL should be bitwise ORed with the relevant tags for tracing
+ * within a hardware module. For example a camera hardware module would set:
+ * #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
+ *
+ * Keep these in sync with frameworks/base/core/java/android/os/Trace.java.
+ */
+#define ATRACE_TAG_NEVER 0 // This tag is never enabled.
+#define ATRACE_TAG_ALWAYS (1<<0) // This tag is always enabled.
+#define ATRACE_TAG_GRAPHICS (1<<1)
+#define ATRACE_TAG_INPUT (1<<2)
+#define ATRACE_TAG_VIEW (1<<3)
+#define ATRACE_TAG_WEBVIEW (1<<4)
+#define ATRACE_TAG_WINDOW_MANAGER (1<<5)
+#define ATRACE_TAG_ACTIVITY_MANAGER (1<<6)
+#define ATRACE_TAG_SYNC_MANAGER (1<<7)
+#define ATRACE_TAG_AUDIO (1<<8)
+#define ATRACE_TAG_VIDEO (1<<9)
+#define ATRACE_TAG_CAMERA (1<<10)
+#define ATRACE_TAG_HAL (1<<11)
+#define ATRACE_TAG_APP (1<<12)
+#define ATRACE_TAG_RESOURCES (1<<13)
+#define ATRACE_TAG_DALVIK (1<<14)
+#define ATRACE_TAG_RS (1<<15)
+#define ATRACE_TAG_BIONIC (1<<16)
+#define ATRACE_TAG_POWER (1<<17)
+#define ATRACE_TAG_PACKAGE_MANAGER (1<<18)
+#define ATRACE_TAG_SYSTEM_SERVER (1<<19)
+#define ATRACE_TAG_DATABASE (1<<20)
+#define ATRACE_TAG_NETWORK (1<<21)
+#define ATRACE_TAG_ADB (1<<22)
+#define ATRACE_TAG_VIBRATOR (1<<23)
+#define ATRACE_TAG_AIDL (1<<24)
+#define ATRACE_TAG_NNAPI (1<<25)
+#define ATRACE_TAG_RRO (1<<26)
+#define ATRACE_TAG_LAST ATRACE_TAG_RRO
+
+// Reserved for initialization.
+#define ATRACE_TAG_NOT_READY (1ULL<<63)
+
+#define ATRACE_TAG_VALID_MASK ((ATRACE_TAG_LAST - 1) | ATRACE_TAG_LAST)
+
+#ifndef ATRACE_TAG
+#define ATRACE_TAG ATRACE_TAG_NEVER
+#elif ATRACE_TAG > ATRACE_TAG_VALID_MASK
+#error ATRACE_TAG must be defined to be one of the tags defined in cutils/trace.h
+#endif
+
+/**
+ * Opens the trace file for writing and reads the property for initial tags.
+ * The atrace.tags.enableflags property sets the tags to trace.
+ * This function should not be explicitly called, the first call to any normal
+ * trace function will cause it to be run safely.
+ */
+void atrace_setup();
+
+/**
+ * If tracing is ready, set atrace_enabled_tags to the system property
+ * debug.atrace.tags.enableflags. Can be used as a sysprop change callback.
+ */
+void atrace_update_tags();
+
+/**
+ * Set whether tracing is enabled for the current process. This is used to
+ * prevent tracing within the Zygote process.
+ */
+void atrace_set_tracing_enabled(bool enabled);
+
+/**
+ * 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;
+
+/**
+ * Set of ATRACE_TAG flags to trace for, initialized to ATRACE_TAG_NOT_READY.
+ * A value of zero indicates setup has failed.
+ * Any other nonzero value indicates setup has succeeded, and tracing is on.
+ */
+extern uint64_t atrace_enabled_tags;
+
+/**
+ * Handle to the kernel's trace buffer, initialized to -1.
+ * Any other value indicates setup has succeeded, and is a valid fd for tracing.
+ */
+extern int atrace_marker_fd;
+
+/**
+ * atrace_init readies the process for tracing by opening the trace_marker file.
+ * Calling any trace function causes this to be run, so calling it is optional.
+ * This can be explicitly run to avoid setup delay on first trace function.
+ */
+#define ATRACE_INIT() atrace_init()
+#define ATRACE_GET_ENABLED_TAGS() atrace_get_enabled_tags()
+
+void atrace_init();
+uint64_t atrace_get_enabled_tags();
+
+/**
+ * Test if a given tag is currently enabled.
+ * Returns nonzero if the tag is enabled, otherwise zero.
+ * It can be used as a guard condition around more expensive trace calculations.
+ */
+#define ATRACE_ENABLED() atrace_is_tag_enabled(ATRACE_TAG)
+static inline uint64_t atrace_is_tag_enabled(uint64_t tag)
+{
+ return atrace_get_enabled_tags() & tag;
+}
+
+/**
+ * Trace the beginning of a context. name is used to identify the context.
+ * This is often used to time function execution.
+ */
+#define ATRACE_BEGIN(name) atrace_begin(ATRACE_TAG, name)
+static inline void atrace_begin(uint64_t tag, const char* name)
+{
+ if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
+ void atrace_begin_body(const char*);
+ atrace_begin_body(name);
+ }
+}
+
+/**
+ * Trace the end of a context.
+ * This should match up (and occur after) a corresponding ATRACE_BEGIN.
+ */
+#define ATRACE_END() atrace_end(ATRACE_TAG)
+static inline void atrace_end(uint64_t tag)
+{
+ if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
+ void atrace_end_body();
+ atrace_end_body();
+ }
+}
+
+/**
+ * Trace the beginning of an asynchronous event. Unlike ATRACE_BEGIN/ATRACE_END
+ * contexts, asynchronous events do not need to be nested. The name describes
+ * the event, and the cookie provides a unique identifier for distinguishing
+ * simultaneous events. The name and cookie used to begin an event must be
+ * used to end it.
+ */
+#define ATRACE_ASYNC_BEGIN(name, cookie) \
+ atrace_async_begin(ATRACE_TAG, name, cookie)
+static inline void atrace_async_begin(uint64_t tag, const char* name,
+ int32_t cookie)
+{
+ if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
+ void atrace_async_begin_body(const char*, int32_t);
+ atrace_async_begin_body(name, cookie);
+ }
+}
+
+/**
+ * Trace the end of an asynchronous event.
+ * This should have a corresponding ATRACE_ASYNC_BEGIN.
+ */
+#define ATRACE_ASYNC_END(name, cookie) atrace_async_end(ATRACE_TAG, name, cookie)
+static inline void atrace_async_end(uint64_t tag, const char* name, int32_t cookie)
+{
+ if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
+ void atrace_async_end_body(const char*, int32_t);
+ atrace_async_end_body(name, cookie);
+ }
+}
+
+/**
+ * Traces an integer counter value. name is used to identify the counter.
+ * This can be used to track how a value changes over time.
+ */
+#define ATRACE_INT(name, value) atrace_int(ATRACE_TAG, name, value)
+static inline void atrace_int(uint64_t tag, const char* name, int32_t value)
+{
+ if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
+ void atrace_int_body(const char*, int32_t);
+ atrace_int_body(name, value);
+ }
+}
+
+/**
+ * Traces a 64-bit integer counter value. name is used to identify the
+ * counter. This can be used to track how a value changes over time.
+ */
+#define ATRACE_INT64(name, value) atrace_int64(ATRACE_TAG, name, value)
+static inline void atrace_int64(uint64_t tag, const char* name, int64_t value)
+{
+ if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
+ void atrace_int64_body(const char*, int64_t);
+ atrace_int64_body(name, value);
+ }
+}
+
+__END_DECLS
+
+#endif // _LIBS_CUTILS_TRACE_H
diff --git a/include/android_stub/log/log_main.h b/include/android_stub/log/log_main.h
index 1bd1c8aec19..799a8e2de60 100644
--- a/include/android_stub/log/log_main.h
+++ b/include/android_stub/log/log_main.h
@@ -364,13 +364,11 @@ int __android_log_is_loggable(int prio, const char* tag, int default_prio);
int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio);
#if LOG_NDEBUG /* Production */
-#define android_testLog(prio, tag) \
- (__android_log_is_loggable_len(prio, tag, ((tag) && *(tag)) ? strlen(tag) : 0, \
- ANDROID_LOG_DEBUG) != 0)
+#define android_testLog(prio, tag) \
+ (__android_log_is_loggable_len(prio, tag, (tag) ? strlen(tag) : 0, ANDROID_LOG_DEBUG) != 0)
#else
-#define android_testLog(prio, tag) \
- (__android_log_is_loggable_len(prio, tag, ((tag) && *(tag)) ? strlen(tag) : 0, \
- ANDROID_LOG_VERBOSE) != 0)
+#define android_testLog(prio, tag) \
+ (__android_log_is_loggable_len(prio, tag, (tag) ? strlen(tag) : 0, ANDROID_LOG_VERBOSE) != 0)
#endif
#if defined(__clang__)
diff --git a/include/android_stub/ndk/sync.h b/include/android_stub/ndk/sync.h
index 2a59e35bbc6..38ccb686c13 100644
--- a/include/android_stub/ndk/sync.h
+++ b/include/android_stub/ndk/sync.h
@@ -33,8 +33,6 @@
__BEGIN_DECLS
-#if __ANDROID_API__ >= 26
-
/* Fences indicate the status of an asynchronous task. They are initially
* in unsignaled state (0), and make a one-time transition to either signaled
* (1) or error (< 0) state. A sync file is a collection of one or more fences;
@@ -101,8 +99,6 @@ static inline struct sync_fence_info* sync_get_fence_info(const struct sync_file
*/
void sync_file_info_free(struct sync_file_info* info) __INTRODUCED_IN(26);
-#endif /* __ANDROID_API__ >= 26 */
-
__END_DECLS
#endif /* ANDROID_SYNC_H */
diff --git a/include/android_stub/vndk/hardware_buffer.h b/include/android_stub/vndk/hardware_buffer.h
index 3392d7f0940..12f86916844 100644
--- a/include/android_stub/vndk/hardware_buffer.h
+++ b/include/android_stub/vndk/hardware_buffer.h
@@ -81,6 +81,20 @@ enum {
AHARDWAREBUFFER_FORMAT_YCbCr_422_I = 0x14,
};
+/**
+ * Buffer usage flags.
+ */
+enum {
+ /* for future proofing, keep these in sync with hardware/gralloc.h */
+
+ /* The buffer will be written by the HW camera pipeline. */
+ AHARDWAREBUFFER_USAGE_CAMERA_WRITE = 2UL << 16,
+ /* The buffer will be read by the HW camera pipeline. */
+ AHARDWAREBUFFER_USAGE_CAMERA_READ = 4UL << 16,
+ /* Mask for the camera access values. */
+ AHARDWAREBUFFER_USAGE_CAMERA_MASK = 6UL << 16,
+};
+
__END_DECLS
#endif /* ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H */