# Host functions guest libraries can call (libandroid, ...). One per line: [!] <result> <name>(<arguments>)
# Types: v void, I 32-bit int, J 64-bit int, f float, P guest pointer (passed through: guest memory is host memory),
# H host pointer handle (ANativeWindow*, ...: a 32-bit handle on the guest side), A ANativeActivity*, E JNIEnv*
# (the guest's -> the thread's own), O jobject (handle). Results also: S string (copied into guest memory).
# "!" = written by hand in host/android.c or host/input.c (input events) as imp_<name>(a32_cpu *c, argreader *R).
# The host functions are weak references: one the system lacks logs its name and returns 0.
! v ANativeActivity_finish(A)
v ANativeActivity_setWindowFormat(AI)
v ANativeActivity_setWindowFlags(AII)
v ANativeActivity_showSoftInput(AI)
v ANativeActivity_hideSoftInput(AI)
v ANativeWindow_acquire(H)
v ANativeWindow_release(H)
I ANativeWindow_getWidth(H)
I ANativeWindow_getHeight(H)
I ANativeWindow_getFormat(H)
I ANativeWindow_setBuffersGeometry(HIII)
H ANativeWindow_fromSurface(EO)
H AAssetManager_fromJava(EO)
! I AInputEvent_getType(H)
! I AInputEvent_getDeviceId(H)
! I AInputEvent_getSource(H)
! I AKeyEvent_getAction(H)
! I AKeyEvent_getKeyCode(H)
! I AKeyEvent_getMetaState(H)
! I AKeyEvent_getRepeatCount(H)
! I AKeyEvent_getFlags(H)
H ALooper_forThread()
H ALooper_prepare(I)
H ASensorManager_getInstance()
H ASensorManager_getInstanceForPackage(P)
H ASensorManager_getDefaultSensor(HI)
! I ASensorManager_getSensorList(HP)
! H ASensorManager_createEventQueue(HHIPP)
I ASensorManager_destroyEventQueue(HH)
I ASensorEventQueue_enableSensor(HH)
I ASensorEventQueue_disableSensor(HH)
I ASensorEventQueue_setEventRate(HHI)
I ASensorEventQueue_hasEvents(H)
I ASensorEventQueue_getEvents(HPI)
I ASensor_getMinDelay(H)
S ASensor_getName(H)
S ASensor_getVendor(H)
I ASensor_getType(H)
f ASensor_getResolution(H)
# VrApi 1.x (Gear VR era: vrapi_SubmitFrame/ovrFrameParms), translated to the 64-bit VrApi bridge (host/vrapi.c)
! I vrapi_Initialize(P)
! v vrapi_Shutdown()
! S vrapi_GetVersionString()
! v vrapi_GetTimeInSeconds()
! I vrapi_GetSystemPropertyInt(PI)
! f vrapi_GetSystemPropertyFloat(PI)
! S vrapi_GetSystemPropertyString(PI)
! I vrapi_GetSystemStatusInt(PI)
! f vrapi_GetSystemStatusFloat(PI)
! H vrapi_EnterVrMode(P)
! v vrapi_LeaveVrMode(H)
! v vrapi_GetPredictedDisplayTime(HJ)
! v vrapi_GetPredictedTracking(PH)
! v vrapi_RecenterPose(H)
! H vrapi_CreateTextureSwapChain(IIIIII)
! H vrapi_CreateTextureSwapChain2(IIIIII)
! v vrapi_DestroyTextureSwapChain(H)
! I vrapi_GetTextureSwapChainLength(H)
! I vrapi_GetTextureSwapChainHandle(HI)
! v vrapi_SetTextureSwapChainHandle(HII)
! v vrapi_SubmitFrame(HP)
! I vrapi_EnumerateInputDevices(HIP)
! I vrapi_GetInputDeviceCapabilities(HP)
! I vrapi_GetCurrentInputState(HIP)
! I vrapi_GetInputTrackingState(HIJP)
! v vrapi_RecenterInputPose(HI)
! I vrapi_SetRemoteEmulation(HI)
! v vrapi_SetPropertyInt(PII)
! v vrapi_SetPropertyFloat(PIf)
! I vrapi_GetPropertyInt(PI)
! I vrapi_ShowSystemUI(PI)
! I vrapi_ShowSystemUIWithExtra(PIP)
! v vrapi_ShowFatalError(PPPP)
! v vrapi_ReturnToHome(P)
! P ovr_GetLocalPreferenceValueForKey(PP)
! v ovr_SetLocalPreferenceValueForKey(PP)
# audio output for guest/opensles.c (AAudio)
! H a32_audio_open(III)
! I a32_audio_write(HPI)
! v a32_audio_start(H)
! v a32_audio_pause(H)
! v a32_audio_close(H)
# VrApi 1.2x-1.4x (Go/Quest era: vrapi_SubmitFrame2, WaitFrame/BeginFrame), same translation (host/vrapi.c)
! H vrapi_CreateTextureSwapChain3(IJIIII)
! v vrapi_GetPredictedTracking2(PHD)
! I vrapi_SubmitFrame2(HP)
! I vrapi_WaitFrame(HJ)
! I vrapi_BeginFrame(HJ)
! I vrapi_SetDisplayRefreshRate(Hf)
! I vrapi_PollEvent(P)
! I vrapi_GetSystemPropertyFloatArray(PIPI)
! I vrapi_SetTrackingSpace(HI)
! I vrapi_GetTrackingSpace(H)
! v vrapi_LocateTrackingSpace(PHI)
! v vrapi_GetTrackingTransform(PHI)
! v vrapi_SetTrackingTransform(Hfffffff)
! I vrapi_GetBoundaryGeometry(HIPP)
! I vrapi_GetBoundaryOrientedBoundingBox(HPP)
! I vrapi_TestPointIsInBoundary(HPPP)
! I vrapi_GetBoundaryTriggerState(HIP)
! I vrapi_RequestBoundaryVisible(HI)
! I vrapi_GetBoundaryVisible(HP)
! I vrapi_SetHapticVibrationSimple(HIf)
! I vrapi_SetHapticVibrationBuffer(HIP)
! I vrapi_SetClockLevels(HII)
! I vrapi_SetPerfThread(HII)
! I vrapi_SetExtraLatencyMode(HI)
! H vrapi_CreateAndroidSurfaceSwapChain(II)
! H vrapi_CreateAndroidSurfaceSwapChain2(IIIP)
! H vrapi_GetTextureSwapChainAndroidSurface(H)
! I vrapi_CreateSystemVulkan(P)
! v vrapi_DestroySystemVulkan()
! I vrapi_GetInstanceExtensionsVulkan(PP)
! I vrapi_GetDeviceExtensionsVulkan(PP)
! I vrapi_GetTextureSwapChainBufferVulkan(HI)
! I vrapi_GetTextureSwapChainBufferFoveationVulkan(HIPP)

# NativeActivity games built on android_native_app_glue (e.g. Unreal 4.10 Gear VR games): looper, input queue,
# configuration and assets
H AConfiguration_new()
v AConfiguration_delete(H)
v AConfiguration_fromAssetManager(HH)
v AConfiguration_getLanguage(HP)
v AConfiguration_getCountry(HP)
I AConfiguration_getOrientation(H)
I AConfiguration_getDensity(H)
I AConfiguration_getSdkVersion(H)
I AConfiguration_getMcc(H)
I AConfiguration_getMnc(H)
I AConfiguration_getTouchscreen(H)
I AConfiguration_getKeyboard(H)
I AConfiguration_getNavigation(H)
I AConfiguration_getKeysHidden(H)
I AConfiguration_getNavHidden(H)
I AConfiguration_getScreenSize(H)
I AConfiguration_getScreenLong(H)
I AConfiguration_getUiModeType(H)
I AConfiguration_getUiModeNight(H)
! I AMotionEvent_getAction(H)
! I AMotionEvent_getPointerCount(H)
! I AMotionEvent_getPointerId(HI)
! f AMotionEvent_getX(HI)
! f AMotionEvent_getY(HI)
! f AMotionEvent_getRawX(HI)
! f AMotionEvent_getRawY(HI)
! f AMotionEvent_getAxisValue(HII)
! I AMotionEvent_getButtonState(H)
! v AInputQueue_attachLooper(HHIPP)
! v AInputQueue_detachLooper(H)
! I AInputQueue_hasEvents(H)
! I AInputQueue_getEvent(HP)
! I AInputQueue_preDispatchEvent(HH)
! v AInputQueue_finishEvent(HHI)
! I ALooper_addFd(HIIIPP)
I ALooper_removeFd(HI)
! I ALooper_pollAll(IPPP)
! I ALooper_pollOnce(IPPP)
v ALooper_wake(H)
v ALooper_acquire(H)
v ALooper_release(H)
H AAssetManager_open(HPI)
H AAssetManager_openDir(HP)
! S AAssetDir_getNextFileName(H)
v AAssetDir_rewind(H)
v AAssetDir_close(H)
! v AAsset_close(H)
! P AAsset_getBuffer(H)
I AAsset_read(HPI)
I AAsset_seek(HII)
J AAsset_seek64(HJI)
I AAsset_getLength(H)
J AAsset_getLength64(H)
I AAsset_getRemainingLength(H)
J AAsset_getRemainingLength64(H)
! I AAsset_openFileDescriptor(HPP)
! I AAsset_openFileDescriptor64(HPP)
I AAsset_isAllocated(H)
