diff options
author | 2018-07-19 20:32:19 -0700 | |
---|---|---|
committer | 2018-08-23 18:17:41 -0700 | |
commit | 749aaebf8af624d2764deed6b059c285dd82b9da (patch) | |
tree | dda79a96c6219089e313753b4089495030e96c70 | |
parent | f468259bd6d9745503b34e6c72830714d2461c2f (diff) |
Restore __ANDROID_API__ guards for core <android/*> APIs
This commit restores the __ANDROID_API__ guards removed in
"Add __INTRODUCED_IN to core <android/*.h> APIs.",
commit 9db409b053460e065cefb1d1caefe048f90cfff0.
Add a guard to surface_texture.h.
In choreographer.h, declare the types even for older APIs.
Bug: http://b/111668906
Test: builds
Change-Id: Ia013f48a109310f9f8ca6a3211f28fcb69dd602d
Merged-In: Ia013f48a109310f9f8ca6a3211f28fcb69dd602d
(cherry picked from commit 92b1ebea095f9cac70b81ae7382ae69583c9914d)
-rw-r--r-- | include/android/choreographer.h | 4 | ||||
-rw-r--r-- | include/android/configuration.h | 4 | ||||
-rw-r--r-- | include/android/input.h | 8 | ||||
-rw-r--r-- | include/android/multinetwork.h | 4 | ||||
-rw-r--r-- | include/android/native_window_jni.h | 2 | ||||
-rw-r--r-- | include/android/sensor.h | 12 | ||||
-rw-r--r-- | include/android/sharedmem.h | 5 | ||||
-rw-r--r-- | include/android/sharedmem_jni.h | 5 | ||||
-rw-r--r-- | include/android/surface_texture.h | 5 | ||||
-rw-r--r-- | include/android/trace.h | 4 |
10 files changed, 52 insertions, 1 deletions
diff --git a/include/android/choreographer.h b/include/android/choreographer.h index 11f8f6b0c7..d75de1ee1a 100644 --- a/include/android/choreographer.h +++ b/include/android/choreographer.h @@ -43,6 +43,8 @@ typedef struct AChoreographer AChoreographer; */ typedef void (*AChoreographer_frameCallback)(long frameTimeNanos, void* data); +#if __ANDROID_API__ >= 24 + /** * Get the AChoreographer instance for the current thread. This must be called * on an ALooper thread. @@ -65,6 +67,8 @@ void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer, AChoreographer_frameCallback callback, void* data, long delayMillis) __INTRODUCED_IN(24); +#endif /* __ANDROID_API__ >= 24 */ + __END_DECLS #endif // ANDROID_CHOREOGRAPHER_H diff --git a/include/android/configuration.h b/include/android/configuration.h index 81aedca9d8..ef6c5a2f81 100644 --- a/include/android/configuration.h +++ b/include/android/configuration.h @@ -675,6 +675,7 @@ int32_t AConfiguration_getUiModeNight(AConfiguration* config); */ void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight); +#if __ANDROID_API__ >= 13 /** * Return the current configuration screen width in dp units, or * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set. @@ -707,7 +708,9 @@ int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config) __INTROD * Set the configuration's smallest screen width in dp units. */ void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value) __INTRODUCED_IN(13); +#endif /* __ANDROID_API__ >= 13 */ +#if __ANDROID_API__ >= 17 /** * Return the configuration's layout direction, or * ACONFIGURATION_LAYOUTDIR_ANY if not set. @@ -718,6 +721,7 @@ int32_t AConfiguration_getLayoutDirection(AConfiguration* config) __INTRODUCED_I * Set the configuration's layout direction. */ void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value) __INTRODUCED_IN(17); +#endif /* __ANDROID_API__ >= 17 */ /** * Perform a diff between two configurations. Returns a bit mask of diff --git a/include/android/input.h b/include/android/input.h index 1e49b7a16d..681090188f 100644 --- a/include/android/input.h +++ b/include/android/input.h @@ -986,8 +986,10 @@ int32_t AMotionEvent_getFlags(const AInputEvent* motion_event); */ int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); +#if __ANDROID_API__ >= 14 /** Get the button state of all buttons that are pressed. */ int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event) __INTRODUCED_IN(14); +#endif /** * Get a bitfield indicating which edges, if any, were touched by this motion event. @@ -1052,12 +1054,14 @@ size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); */ int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); +#if __ANDROID_API__ >= 14 /** * Get the tool type of a pointer for the given pointer index. * The tool type indicates the type of tool used to make contact such as a * finger or stylus, if known. */ int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index) __INTRODUCED_IN(14); +#endif /** * Get the original raw X coordinate of this event. @@ -1147,9 +1151,11 @@ float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_ */ float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index); +#if __ANDROID_API__ >= 13 /** Get the value of the request axis for the given pointer index. */ float AMotionEvent_getAxisValue(const AInputEvent* motion_event, int32_t axis, size_t pointer_index) __INTRODUCED_IN(13); +#endif /** * Get the number of historical points in this event. These are movements that @@ -1280,12 +1286,14 @@ float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_ float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); +#if __ANDROID_API__ >= 13 /** * Get the historical value of the request axis for the given pointer index * that occurred between this event and the previous motion event. */ float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event, int32_t axis, size_t pointer_index, size_t history_index) __INTRODUCED_IN(13); +#endif struct AInputQueue; diff --git a/include/android/multinetwork.h b/include/android/multinetwork.h index 55df9f85c3..4d24680246 100644 --- a/include/android/multinetwork.h +++ b/include/android/multinetwork.h @@ -60,6 +60,8 @@ typedef uint64_t net_handle_t; * on failure with an appropriate errno value set. */ +#if __ANDROID_API__ >= 23 + /** * Set the network to be used by the given socket file descriptor. * @@ -106,6 +108,8 @@ int android_getaddrinfofornetwork(net_handle_t network, const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) __INTRODUCED_IN(23); +#endif /* __ANDROID_API__ >= 23 */ + __END_DECLS #endif // ANDROID_MULTINETWORK_H diff --git a/include/android/native_window_jni.h b/include/android/native_window_jni.h index 74e43c77b9..0c196b9671 100644 --- a/include/android/native_window_jni.h +++ b/include/android/native_window_jni.h @@ -44,6 +44,7 @@ extern "C" { */ ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface); +#if __ANDROID_API__ >= 26 /** * Return a Java Surface object derived from the ANativeWindow, for interacting * with it through Java code. The returned Java object acquires a reference on @@ -52,6 +53,7 @@ ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface); * collected. */ jobject ANativeWindow_toSurface(JNIEnv* env, ANativeWindow* window) __INTRODUCED_IN(26); +#endif #ifdef __cplusplus }; diff --git a/include/android/sensor.h b/include/android/sensor.h index 59229c114f..005564d153 100644 --- a/include/android/sensor.h +++ b/include/android/sensor.h @@ -472,12 +472,13 @@ typedef ASensorRef const* ASensorList; * ASensorManager* sensorManager = ASensorManager_getInstance(); * */ -#if __ANDROID_API__ >= __ANDROID_API_O__ +#if __ANDROID_API__ >= 26 __attribute__ ((deprecated)) ASensorManager* ASensorManager_getInstance(); #else ASensorManager* ASensorManager_getInstance(); #endif +#if __ANDROID_API__ >= 26 /** * Get a reference to the sensor manager. ASensorManager is a singleton * per package as different packages may have access to different sensors. @@ -488,6 +489,7 @@ ASensorManager* ASensorManager_getInstance(); * */ ASensorManager* ASensorManager_getInstanceForPackage(const char* packageName) __INTRODUCED_IN(26); +#endif /** * Returns the list of available sensors. @@ -500,11 +502,13 @@ int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list); */ ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type); +#if __ANDROID_API__ >= 21 /** * Returns the default sensor with the given type and wakeUp properties or NULL if no sensor * of this type and wakeUp properties exists. */ ASensor const* ASensorManager_getDefaultSensorEx(ASensorManager* manager, int type, bool wakeUp) __INTRODUCED_IN(21); +#endif /** * Creates a new sensor event queue and associate it with a looper. @@ -521,6 +525,7 @@ ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, */ int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue); +#if __ANDROID_API__ >= 26 /** * Create direct channel based on shared memory * @@ -609,6 +614,7 @@ void ASensorManager_destroyDirectChannel(ASensorManager* manager, int channelId) */ int ASensorManager_configureDirectReport(ASensorManager* manager, ASensor const* sensor, int channelId, int rate) __INTRODUCED_IN(26); +#endif /* __ANDROID_API__ >= 26 */ /*****************************************************************************/ @@ -727,6 +733,7 @@ float ASensor_getResolution(ASensor const* sensor); */ int ASensor_getMinDelay(ASensor const* sensor); +#if __ANDROID_API__ >= 21 /** * Returns the maximum size of batches for this sensor. Batches will often be * smaller, as the hardware fifo might be used for other sensors. @@ -752,7 +759,9 @@ int ASensor_getReportingMode(ASensor const* sensor) __INTRODUCED_IN(21); * Returns true if this is a wake up sensor, false otherwise. */ bool ASensor_isWakeUpSensor(ASensor const* sensor) __INTRODUCED_IN(21); +#endif /* __ANDROID_API__ >= 21 */ +#if __ANDROID_API__ >= 26 /** * Test if sensor supports a certain type of direct channel. * @@ -774,6 +783,7 @@ bool ASensor_isDirectChannelTypeSupported(ASensor const* sensor, int channelType * does not support direct report. */ int ASensor_getHighestDirectReportRateLevel(ASensor const* sensor) __INTRODUCED_IN(26); +#endif /* __ANDROID_API__ >= 26 */ #ifdef __cplusplus }; diff --git a/include/android/sharedmem.h b/include/android/sharedmem.h index 5a4f6953a3..8c3ff747ce 100644 --- a/include/android/sharedmem.h +++ b/include/android/sharedmem.h @@ -28,6 +28,7 @@ #define ANDROID_SHARED_MEMORY_H #include <stddef.h> +#include <sys/cdefs.h> /****************************************************************** * @@ -49,6 +50,8 @@ extern "C" { #endif +#if __ANDROID_API__ >= 26 + /** * Create a shared memory region. * @@ -109,6 +112,8 @@ size_t ASharedMemory_getSize(int fd) __INTRODUCED_IN(26); */ int ASharedMemory_setProt(int fd, int prot) __INTRODUCED_IN(26); +#endif // __ANDROID_API__ >= 26 + #ifdef __cplusplus }; #endif diff --git a/include/android/sharedmem_jni.h b/include/android/sharedmem_jni.h index 5abc245083..13e56e6f09 100644 --- a/include/android/sharedmem_jni.h +++ b/include/android/sharedmem_jni.h @@ -30,6 +30,7 @@ #include <jni.h> #include <android/sharedmem.h> #include <stddef.h> +#include <sys/cdefs.h> /****************************************************************** * @@ -51,6 +52,8 @@ extern "C" { #endif +#if __ANDROID_API__ >= 27 + /** * Returns a dup'd FD from the given Java android.os.SharedMemory object. The returned file * descriptor has all the same properties & capabilities as the FD returned from @@ -69,6 +72,8 @@ extern "C" { */ int ASharedMemory_dupFromJava(JNIEnv* env, jobject sharedMemory) __INTRODUCED_IN(27); +#endif // __ANDROID_API__ >= 27 + #ifdef __cplusplus }; #endif diff --git a/include/android/surface_texture.h b/include/android/surface_texture.h index db10a1618e..a36e982c78 100644 --- a/include/android/surface_texture.h +++ b/include/android/surface_texture.h @@ -43,6 +43,7 @@ */ #include <stdint.h> +#include <sys/cdefs.h> #include <android/native_window.h> @@ -58,6 +59,8 @@ struct ASurfaceTexture; */ typedef struct ASurfaceTexture ASurfaceTexture; +#if __ANDROID_API__ >= 28 + /** * Release the reference to the native ASurfaceTexture acquired with * ASurfaceTexture_fromSurfaceTexture(). @@ -157,6 +160,8 @@ void ASurfaceTexture_getTransformMatrix(ASurfaceTexture* st, float mtx[16]) __IN */ int64_t ASurfaceTexture_getTimestamp(ASurfaceTexture* st) __INTRODUCED_IN(28); +#endif /* __ANDROID_API__ >= 28 */ + __END_DECLS #endif /* ANDROID_NATIVE_SURFACE_TEXTURE_H */ diff --git a/include/android/trace.h b/include/android/trace.h index 0c4473230a..aa24995cae 100644 --- a/include/android/trace.h +++ b/include/android/trace.h @@ -39,6 +39,8 @@ extern "C" { #endif +#if __ANDROID_API__ >= 23 + /** * Returns true if tracing is enabled. Use this to avoid expensive computation only necessary * when tracing is enabled. @@ -69,6 +71,8 @@ void ATrace_beginSection(const char* sectionName) __INTRODUCED_IN(23); */ void ATrace_endSection() __INTRODUCED_IN(23); +#endif /* __ANDROID_API__ >= 23 */ + #ifdef __cplusplus }; #endif |