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.", commit9db409b053
. Add a guard to surface_texture.h. In choreographer.h, declare the types even for older APIs. Bug: http://b/111668906 Bug: http://b/113052379 Test: builds Change-Id: Ia013f48a109310f9f8ca6a3211f28fcb69dd602d (cherry picked from commit92b1ebea09
)
This commit is contained in:
parent
78e548d575
commit
2fb1d47d09
10 changed files with 52 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue