ndk: Update headers and libraries for API level 9

Change-Id: I39eded0065145803b51b22cdc18abef43abe426c
diff --git a/ndk/platforms/android-9/arch-arm/lib/libEGL.so b/ndk/platforms/android-9/arch-arm/lib/libEGL.so
index f63b64c..3d8c151 100644
--- a/ndk/platforms/android-9/arch-arm/lib/libEGL.so
+++ b/ndk/platforms/android-9/arch-arm/lib/libEGL.so
Binary files differ
diff --git a/ndk/platforms/android-9/arch-arm/lib/libOpenSLES.so b/ndk/platforms/android-9/arch-arm/lib/libOpenSLES.so
index 1e7c180..3f2ae90 100755
--- a/ndk/platforms/android-9/arch-arm/lib/libOpenSLES.so
+++ b/ndk/platforms/android-9/arch-arm/lib/libOpenSLES.so
Binary files differ
diff --git a/ndk/platforms/android-9/arch-arm/lib/libandroid.so b/ndk/platforms/android-9/arch-arm/lib/libandroid.so
index 1ac0a9c..32d907b 100644
--- a/ndk/platforms/android-9/arch-arm/lib/libandroid.so
+++ b/ndk/platforms/android-9/arch-arm/lib/libandroid.so
Binary files differ
diff --git a/ndk/platforms/android-9/arch-arm/symbols/libEGL.so.txt b/ndk/platforms/android-9/arch-arm/symbols/libEGL.so.txt
new file mode 100644
index 0000000..cc71131
--- /dev/null
+++ b/ndk/platforms/android-9/arch-arm/symbols/libEGL.so.txt
@@ -0,0 +1,40 @@
+eglBindAPI
+eglBindTexImage
+eglChooseConfig
+eglCopyBuffers
+eglCreateContext
+eglCreateImageKHR
+eglCreatePbufferFromClientBuffer
+eglCreatePbufferSurface
+eglCreatePixmapSurface
+eglCreateWindowSurface
+eglDestroyContext
+eglDestroyImageKHR
+eglDestroySurface
+eglGetConfigAttrib
+eglGetConfigs
+eglGetCurrentContext
+eglGetCurrentDisplay
+eglGetCurrentSurface
+eglGetDisplay
+eglGetError
+eglGetProcAddress
+eglInitialize
+eglLockSurfaceKHR
+eglMakeCurrent
+eglQueryAPI
+eglQueryContext
+eglQueryString
+eglQuerySurface
+eglReleaseTexImage
+eglReleaseThread
+eglSetSwapRectangleANDROID
+eglSurfaceAttrib
+eglSwapBuffers
+eglSwapInterval
+eglTerminate
+eglUnlockSurfaceKHR
+eglWaitClient
+eglWaitGL
+eglWaitNative
+
diff --git a/ndk/platforms/android-9/arch-arm/symbols/libOpenSLES.so.txt b/ndk/platforms/android-9/arch-arm/symbols/libOpenSLES.so.txt
index e7ccafb..b42d1ee 100644
--- a/ndk/platforms/android-9/arch-arm/symbols/libOpenSLES.so.txt
+++ b/ndk/platforms/android-9/arch-arm/symbols/libOpenSLES.so.txt
@@ -1,3 +1,6 @@
+slCreateEngine
+slQueryNumSupportedEngineInterfaces
+slQuerySupportedEngineInterfaces
 SL_IID_3DCOMMIT
 SL_IID_3DDOPPLER
 SL_IID_3DGROUPING
@@ -47,6 +50,3 @@
 SL_IID_VIRTUALIZER
 SL_IID_VISUALIZATION
 SL_IID_VOLUME
-slCreateEngine
-slQueryNumSupportedEngineInterfaces
-slQuerySupportedEngineInterfaces
diff --git a/ndk/platforms/android-9/arch-arm/symbols/libandroid.so.txt b/ndk/platforms/android-9/arch-arm/symbols/libandroid.so.txt
new file mode 100644
index 0000000..e6d17fe
--- /dev/null
+++ b/ndk/platforms/android-9/arch-arm/symbols/libandroid.so.txt
@@ -0,0 +1,149 @@
+AAssetDir_close
+AAssetDir_getNextFileName
+AAssetDir_rewind
+AAssetManager_fromJava
+AAssetManager_open
+AAssetManager_openDir
+AAsset_close
+AAsset_getBuffer
+AAsset_getLength
+AAsset_getRemainingLength
+AAsset_isAllocated
+AAsset_openFileDescriptor
+AAsset_read
+AAsset_seek
+AConfiguration_copy
+AConfiguration_delete
+AConfiguration_diff
+AConfiguration_fromAssetManager
+AConfiguration_getCountry
+AConfiguration_getDensity
+AConfiguration_getKeyboard
+AConfiguration_getKeysHidden
+AConfiguration_getLanguage
+AConfiguration_getMcc
+AConfiguration_getMnc
+AConfiguration_getNavHidden
+AConfiguration_getNavigation
+AConfiguration_getOrientation
+AConfiguration_getScreenLong
+AConfiguration_getScreenSize
+AConfiguration_getSdkVersion
+AConfiguration_getTouchscreen
+AConfiguration_getUiModeNight
+AConfiguration_getUiModeType
+AConfiguration_isBetterThan
+AConfiguration_match
+AConfiguration_new
+AConfiguration_setCountry
+AConfiguration_setDensity
+AConfiguration_setKeyboard
+AConfiguration_setKeysHidden
+AConfiguration_setLanguage
+AConfiguration_setMcc
+AConfiguration_setMnc
+AConfiguration_setNavHidden
+AConfiguration_setNavigation
+AConfiguration_setOrientation
+AConfiguration_setScreenLong
+AConfiguration_setScreenSize
+AConfiguration_setSdkVersion
+AConfiguration_setTouchscreen
+AConfiguration_setUiModeNight
+AConfiguration_setUiModeType
+AInputEvent_getDeviceId
+AInputEvent_getSource
+AInputEvent_getType
+AInputQueue_attachLooper
+AInputQueue_detachLooper
+AInputQueue_finishEvent
+AInputQueue_getEvent
+AInputQueue_hasEvents
+AInputQueue_preDispatchEvent
+AKeyEvent_getAction
+AKeyEvent_getDownTime
+AKeyEvent_getEventTime
+AKeyEvent_getFlags
+AKeyEvent_getKeyCode
+AKeyEvent_getMetaState
+AKeyEvent_getRepeatCount
+AKeyEvent_getScanCode
+ALooper_acquire
+ALooper_addFd
+ALooper_forThread
+ALooper_pollAll
+ALooper_pollOnce
+ALooper_prepare
+ALooper_release
+ALooper_removeFd
+ALooper_wake
+AMotionEvent_getAction
+AMotionEvent_getDownTime
+AMotionEvent_getEdgeFlags
+AMotionEvent_getEventTime
+AMotionEvent_getFlags
+AMotionEvent_getHistoricalEventTime
+AMotionEvent_getHistoricalPressure
+AMotionEvent_getHistoricalSize
+AMotionEvent_getHistoricalX
+AMotionEvent_getHistoricalY
+AMotionEvent_getHistorySize
+AMotionEvent_getMetaState
+AMotionEvent_getOrientation
+AMotionEvent_getPointerCount
+AMotionEvent_getPointerId
+AMotionEvent_getPressure
+AMotionEvent_getRawX
+AMotionEvent_getRawY
+AMotionEvent_getSize
+AMotionEvent_getToolMajor
+AMotionEvent_getToolMinor
+AMotionEvent_getTouchMajor
+AMotionEvent_getTouchMinor
+AMotionEvent_getX
+AMotionEvent_getXOffset
+AMotionEvent_getXPrecision
+AMotionEvent_getY
+AMotionEvent_getYOffset
+AMotionEvent_getYPrecision
+ANativeActivity_finish
+ANativeActivity_hideSoftInput
+ANativeActivity_setWindowFlags
+ANativeActivity_setWindowFormat
+ANativeActivity_showSoftInput
+ANativeWindow_acquire
+ANativeWindow_fromSurface
+ANativeWindow_getFormat
+ANativeWindow_getHeight
+ANativeWindow_getWidth
+ANativeWindow_lock
+ANativeWindow_release
+ANativeWindow_setBuffersGeometry
+ANativeWindow_unlockAndPost
+AObbInfo_delete
+AObbInfo_getFlags
+AObbInfo_getPackageName
+AObbInfo_getVersion
+AObbScanner_getObbInfo
+ASensorEventQueue_disableSensor
+ASensorEventQueue_enableSensor
+ASensorEventQueue_getEvents
+ASensorEventQueue_hasEvents
+ASensorEventQueue_setEventRate
+ASensorManager_createEventQueue
+ASensorManager_destroyEventQueue
+ASensorManager_getDefaultSensor
+ASensorManager_getInstance
+ASensorManager_getSensorList
+ASensor_getMinDelay
+ASensor_getName
+ASensor_getResolution
+ASensor_getType
+ASensor_getVendor
+AStorageManager_delete
+AStorageManager_getMountedObbPath
+AStorageManager_isObbMounted
+AStorageManager_mountObb
+AStorageManager_new
+AStorageManager_unmountObb
+
diff --git a/ndk/platforms/android-9/include/EGL/eglext.h b/ndk/platforms/android-9/include/EGL/eglext.h
index b121158..1ffcd56 100644
--- a/ndk/platforms/android-9/include/EGL/eglext.h
+++ b/ndk/platforms/android-9/include/EGL/eglext.h
@@ -229,14 +229,6 @@
 #define EGL_NATIVE_BUFFER_ANDROID       0x3140  /* eglCreateImageKHR target */
 #endif
 
-#ifndef EGL_ANDROID_get_render_buffer
-#define EGL_ANDROID_get_render_buffer 1
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLClientBuffer EGLAPIENTRY eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw);
-#endif
-typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETRENDERBUFFERANDROIDPROC) (EGLDisplay dpy, EGLSurface draw);
-#endif
-
 #ifndef EGL_ANDROID_swap_rectangle
 #define EGL_ANDROID_swap_rectangle 1
 #ifdef EGL_EGLEXT_PROTOTYPES
diff --git a/ndk/platforms/android-9/include/EGL/eglplatform.h b/ndk/platforms/android-9/include/EGL/eglplatform.h
index e6c250d..bfac71b 100644
--- a/ndk/platforms/android-9/include/EGL/eglplatform.h
+++ b/ndk/platforms/android-9/include/EGL/eglplatform.h
@@ -78,18 +78,7 @@
 typedef void *EGLNativeWindowType;
 typedef void *EGLNativePixmapType;
 
-#elif defined(__unix__) && !defined(__ANDROID__)
-
-/* X11 (tentative)  */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef Display *EGLNativeDisplayType;
-typedef Pixmap   EGLNativePixmapType;
-typedef Window   EGLNativeWindowType;
-
-
-#elif defined(__ANDROID__)
+#elif defined(__ANDROID__) || defined(ANDROID)
 
 #include <android/native_window.h>
 
@@ -99,6 +88,16 @@
 typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
 typedef void*                           EGLNativeDisplayType;
 
+#elif defined(__unix__)
+
+/* X11 (tentative)  */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap   EGLNativePixmapType;
+typedef Window   EGLNativeWindowType;
+
 #else
 #error "Platform not recognized"
 #endif
diff --git a/ndk/platforms/android-9/include/android/asset_manager.h b/ndk/platforms/android-9/include/android/asset_manager.h
index 3ad0f99..4fa0ef3 100644
--- a/ndk/platforms/android-9/include/android/asset_manager.h
+++ b/ndk/platforms/android-9/include/android/asset_manager.h
@@ -18,9 +18,9 @@
 #ifndef ANDROID_ASSET_MANAGER_H
 #define ANDROID_ASSET_MANAGER_H
 
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct AAssetManager;
 typedef struct AAssetManager AAssetManager;
@@ -130,6 +130,9 @@
 int AAsset_isAllocated(AAsset* asset);
 
 
-__END_DECLS
 
-#endif      /* ANDROID_ASSET_MANAGER_H */
+#ifdef __cplusplus
+};
+#endif
+
+#endif      // ANDROID_ASSET_MANAGER_H
diff --git a/ndk/platforms/android-9/include/android/asset_manager_jni.h b/ndk/platforms/android-9/include/android/asset_manager_jni.h
index 073434b..aec2d3c 100644
--- a/ndk/platforms/android-9/include/android/asset_manager_jni.h
+++ b/ndk/platforms/android-9/include/android/asset_manager_jni.h
@@ -21,7 +21,9 @@
 #include <android/asset_manager.h>
 #include <jni.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager
@@ -31,6 +33,8 @@
  */
 AAssetManager* AAssetManager_fromJava(JNIEnv* env, jobject assetManager);
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif      /* ANDROID_ASSET_MANAGER_JNI_H */
+#endif      // ANDROID_ASSET_MANAGER_JNI_H
diff --git a/ndk/platforms/android-9/include/android/configuration.h b/ndk/platforms/android-9/include/android/configuration.h
index 4c85b12..99e8f97 100644
--- a/ndk/platforms/android-9/include/android/configuration.h
+++ b/ndk/platforms/android-9/include/android/configuration.h
@@ -19,7 +19,9 @@
 
 #include <android/asset_manager.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct AConfiguration;
 typedef struct AConfiguration AConfiguration;
@@ -310,6 +312,8 @@
 int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test,
         AConfiguration* requested);
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_CONFIGURATION_H */
+#endif // ANDROID_CONFIGURATION_H
diff --git a/ndk/platforms/android-9/include/android/input.h b/ndk/platforms/android-9/include/android/input.h
index ae96c50..7df13c3 100644
--- a/ndk/platforms/android-9/include/android/input.h
+++ b/ndk/platforms/android-9/include/android/input.h
@@ -45,7 +45,9 @@
 #include <android/keycodes.h>
 #include <android/looper.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*
  * Key states (may be returned by queries about the current state of a
@@ -304,6 +306,8 @@
     AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,
     AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,
     AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,
+
+    AINPUT_SOURCE_ANY = 0xffffff00,
 };
 
 /*
@@ -675,6 +679,8 @@
  */
 void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled);
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
-#endif /* _ANDROID_INPUT_H */
+#endif // _ANDROID_INPUT_H
diff --git a/ndk/platforms/android-9/include/android/keycodes.h b/ndk/platforms/android-9/include/android/keycodes.h
index be0550a..496eccc 100644
--- a/ndk/platforms/android-9/include/android/keycodes.h
+++ b/ndk/platforms/android-9/include/android/keycodes.h
@@ -33,10 +33,11 @@
  *   - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*
  * Key codes.
@@ -158,6 +159,8 @@
     //       Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
 };
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
-#endif /* _ANDROID_KEYCODES_H */
+#endif // _ANDROID_KEYCODES_H
diff --git a/ndk/platforms/android-9/include/android/looper.h b/ndk/platforms/android-9/include/android/looper.h
index 9b7438b..a9d8426 100644
--- a/ndk/platforms/android-9/include/android/looper.h
+++ b/ndk/platforms/android-9/include/android/looper.h
@@ -18,9 +18,9 @@
 #ifndef ANDROID_LOOPER_H
 #define ANDROID_LOOPER_H
 
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * ALooper
@@ -248,6 +248,8 @@
  */
 int ALooper_removeFd(ALooper* looper, int fd);
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_NATIVE_WINDOW_H */
+#endif // ANDROID_NATIVE_WINDOW_H
diff --git a/ndk/platforms/android-9/include/android/native_activity.h b/ndk/platforms/android-9/include/android/native_activity.h
index 0bff86d..d89bc8b 100644
--- a/ndk/platforms/android-9/include/android/native_activity.h
+++ b/ndk/platforms/android-9/include/android/native_activity.h
@@ -19,7 +19,6 @@
 #define ANDROID_NATIVE_ACTIVITY_H
 
 #include <stdint.h>
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <jni.h>
@@ -28,7 +27,9 @@
 #include <android/input.h>
 #include <android/native_window.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct ANativeActivityCallbacks;
 
@@ -67,17 +68,17 @@
      * Path to this application's internal data directory.
      */
     const char* internalDataPath;
-
+    
     /**
      * Path to this application's external (removable/mountable) data directory.
      */
     const char* externalDataPath;
-
+    
     /**
      * The platform's SDK version code.
      */
     int32_t sdkVersion;
-
+    
     /**
      * This is the native instance of the application.  It is not used by
      * the framework, but can be set by the application to its own instance
@@ -104,13 +105,13 @@
      * for more information.
      */
     void (*onStart)(ANativeActivity* activity);
-
+    
     /**
      * NativeActivity has resumed.  See Java documentation for Activity.onResume()
      * for more information.
      */
     void (*onResume)(ANativeActivity* activity);
-
+    
     /**
      * Framework is asking NativeActivity to save its current instance state.
      * See Java documentation for Activity.onSaveInstanceState() for more
@@ -121,19 +122,19 @@
      * entities (pointers to memory, file descriptors, etc).
      */
     void* (*onSaveInstanceState)(ANativeActivity* activity, size_t* outSize);
-
+    
     /**
      * NativeActivity has paused.  See Java documentation for Activity.onPause()
      * for more information.
      */
     void (*onPause)(ANativeActivity* activity);
-
+    
     /**
      * NativeActivity has stopped.  See Java documentation for Activity.onStop()
      * for more information.
      */
     void (*onStop)(ANativeActivity* activity);
-
+    
     /**
      * NativeActivity is being destroyed.  See Java documentation for Activity.onDestroy()
      * for more information.
@@ -145,7 +146,7 @@
      * for example, to pause a game when it loses input focus.
      */
     void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus);
-
+    
     /**
      * The drawing window for this native activity has been created.  You
      * can use the given native window object to start drawing.
@@ -176,13 +177,13 @@
      * returning from here.
      */
     void (*onNativeWindowDestroyed)(ANativeActivity* activity, ANativeWindow* window);
-
+    
     /**
      * The input queue for this native activity's window has been created.
      * You can use the given input queue to start retrieving input events.
      */
     void (*onInputQueueCreated)(ANativeActivity* activity, AInputQueue* queue);
-
+    
     /**
      * The input queue for this native activity's window is being destroyed.
      * You should no longer try to reference this object upon returning from this
@@ -287,6 +288,9 @@
  */
 void ANativeActivity_hideSoftInput(ANativeActivity* activity, uint32_t flags);
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_NATIVE_ACTIVITY_H */
+#endif // ANDROID_NATIVE_ACTIVITY_H
+
diff --git a/ndk/platforms/android-9/include/android/native_window.h b/ndk/platforms/android-9/include/android/native_window.h
index 75e68c1..f3d7550 100644
--- a/ndk/platforms/android-9/include/android/native_window.h
+++ b/ndk/platforms/android-9/include/android/native_window.h
@@ -17,10 +17,11 @@
 #ifndef ANDROID_NATIVE_WINDOW_H
 #define ANDROID_NATIVE_WINDOW_H
 
-#include <sys/cdefs.h>
 #include <android/rect.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*
  * Pixel formats that a window can use.
@@ -50,7 +51,7 @@
 
     // The actual bits.
     void* bits;
-
+    
     // Do not touch.
     uint32_t reserved[6];
 } ANativeWindow_Buffer;
@@ -109,6 +110,8 @@
  */
 int32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_NATIVE_WINDOW_H */
+#endif // ANDROID_NATIVE_WINDOW_H
diff --git a/ndk/platforms/android-9/include/android/native_window_jni.h b/ndk/platforms/android-9/include/android/native_window_jni.h
index a44a5b1..b9e72ef 100644
--- a/ndk/platforms/android-9/include/android/native_window_jni.h
+++ b/ndk/platforms/android-9/include/android/native_window_jni.h
@@ -21,7 +21,9 @@
 
 #include <jni.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Return the ANativeWindow associated with a Java Surface object,
@@ -31,6 +33,8 @@
  */
 ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface);
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_NATIVE_WINDOW_H */
+#endif // ANDROID_NATIVE_WINDOW_H
diff --git a/ndk/platforms/android-9/include/android/obb.h b/ndk/platforms/android-9/include/android/obb.h
index 5670b1c..65e9b2a 100644
--- a/ndk/platforms/android-9/include/android/obb.h
+++ b/ndk/platforms/android-9/include/android/obb.h
@@ -18,10 +18,11 @@
 #ifndef ANDROID_OBB_H
 #define ANDROID_OBB_H
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct AObbInfo;
 typedef struct AObbInfo AObbInfo;
@@ -55,6 +56,8 @@
  */
 int32_t AObbInfo_getFlags(AObbInfo* obbInfo);
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif      /* ANDROID_OBB_H */
+#endif      // ANDROID_OBB_H
diff --git a/ndk/platforms/android-9/include/android/rect.h b/ndk/platforms/android-9/include/android/rect.h
index 161c2a7..3e81f53 100644
--- a/ndk/platforms/android-9/include/android/rect.h
+++ b/ndk/platforms/android-9/include/android/rect.h
@@ -18,9 +18,9 @@
 #ifndef ANDROID_RECT_H
 #define ANDROID_RECT_H
 
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 typedef struct ARect {
     int32_t left;
@@ -29,6 +29,8 @@
     int32_t bottom;
 } ARect;
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_RECT_H */
+#endif // ANDROID_RECT_H
diff --git a/ndk/platforms/android-9/include/android/sensor.h b/ndk/platforms/android-9/include/android/sensor.h
index eb46ef0..f163f18 100644
--- a/ndk/platforms/android-9/include/android/sensor.h
+++ b/ndk/platforms/android-9/include/android/sensor.h
@@ -39,12 +39,14 @@
  * native code.
  *
  */
-#include <sys/cdefs.h>
+
 #include <sys/types.h>
 
 #include <android/looper.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 /*
@@ -247,6 +249,8 @@
 int ASensor_getMinDelay(ASensor const* sensor);
 
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_SENSOR_H */
+#endif // ANDROID_SENSOR_H
diff --git a/ndk/platforms/android-9/include/android/storage_manager.h b/ndk/platforms/android-9/include/android/storage_manager.h
index f3b08dc..bad2491 100644
--- a/ndk/platforms/android-9/include/android/storage_manager.h
+++ b/ndk/platforms/android-9/include/android/storage_manager.h
@@ -18,10 +18,11 @@
 #ifndef ANDROID_STORAGE_MANAGER_H
 #define ANDROID_STORAGE_MANAGER_H
 
-#include <sys/cdefs.h>
 #include <stdint.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct AStorageManager;
 typedef struct AStorageManager AStorageManager;
@@ -119,6 +120,8 @@
 const char* AStorageManager_getMountedObbPath(AStorageManager* mgr, const char* filename);
 
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif      /* ANDROID_STORAGE_MANAGER_H */
+#endif      // ANDROID_STORAGE_MANAGER_H
diff --git a/ndk/platforms/android-9/include/android/window.h b/ndk/platforms/android-9/include/android/window.h
index 0633f89..2ab192b 100644
--- a/ndk/platforms/android-9/include/android/window.h
+++ b/ndk/platforms/android-9/include/android/window.h
@@ -18,9 +18,9 @@
 #ifndef ANDROID_WINDOW_H
 #define ANDROID_WINDOW_H
 
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Window flags, as per the Java API at android.view.WindowManager.LayoutParams.
@@ -51,6 +51,8 @@
     AWINDOW_FLAG_DISMISS_KEYGUARD           = 0x00400000,
 };
 
-__END_DECLS
+#ifdef __cplusplus
+};
+#endif
 
-#endif /* ANDROID_WINDOW_H */
+#endif // ANDROID_WINDOW_H