kc3-lang/SDL/src/core/android

Branch :


Log

Author Commit Date CI Message
98a966d1 2021-04-22 18:06:17 Android: don't need to set the SurfaceHolder format from java code It's already set with ANativeWindow_setGeometry, and eventually set/changed also by eglCreateWindowSurface. - avoid issues with older device where SurfaceView cycle create/changed/destroy appears broken: calling create/changed/changed, and leading to "deuqueBuffer failed at server side, error: -19", with black screen. - re-read the format after egl window surface is created, to report the correct one (sometimes, changed from RGBA8888 to RGB24)
1a924bc0 2021-02-19 12:54:57 add SDL_AndroidShowToast for https://developer.android.com/reference/android/widget/Toast
9130f7c3 2021-01-02 10:25:38 Updated copyright for 2021
cb361896 2020-12-09 07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
2d82cf78 2020-10-05 13:59:03 url: put the Android bits in core/android
efd665e2 2020-10-05 13:56:45 Backed out changeset a43cb4e54949 Trying this a different way.
5f688122 2020-10-05 13:52:52 url: patched to compile on Android.
77c9d73b 2020-10-05 11:30:33 Removed SDL_AndroidOpenURL, added SDL_OpenURL. Still needs to be wired into Xcode and Visual Studio projects.
dd55bfe8 2020-10-01 14:41:09 Android: add helper function to open an URL/URI (see bug 2783)
97fad045 2020-09-02 19:38:03 Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!)
965b466e 2020-08-17 19:50:20 Fixed bug 4297 - Android StrictMode policy. Remove APK expansion support "In the second half of 2021, new apps will be required to publish with the Android App Bundle on Google Play" (see https://developer.android.com/guide/app-bundle) And "Android App Bundles don't support APK expansion (*.obb) files".
2491f16f 2020-05-08 21:40:28 Android: send SDL_LOCALECHANGED when locale changes
0059ace0 2020-05-08 11:00:51 Android: factorize asset manager code (bug 2131 and 4297)
fa23e3d0 2020-05-04 02:27:29 locale: Implemented SDL_GetPreferredLocales(). This was something I proposed a long time ago, Sylvain Becker did additional work on it, then back to me. Fixes Bugzilla #2131.
b6afbe63 2020-04-07 09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
b4312864 2020-02-13 10:19:05 Resolved conflict and added Android_JNI_RequestPermission()
4bb95e84 2020-02-11 16:14:02 Implemented OpenSL-ES audio recording on Android
005e2dff 2020-01-17 12:41:54 Android: prevents rare crashes when app goes to background or ends. Make sure the thread is actually paused, and context backep-up, before SurfaceView is destroyed (eg surfaceDestroyed() actually returns). Add a timeout when surfaceDestroyed() is called, and check 'backup_done' variable. It prevents crashes like: #00 pc 000000000000c0d0 /system/lib64/libutils.so (android::RefBase::incStrong(void const*) const+8) #01 pc 000000000000c7f4 /vendor/lib64/egl/eglSubDriverAndroid.so (EglAndroidWindowSurface::UpdateBufferList(ANativeWindowBuffer*)+284) #02 pc 000000000000c390 /vendor/lib64/egl/eglSubDriverAndroid.so (EglAndroidWindowSurface::DequeueBuffer()+240) #03 pc 000000000000bb10 /vendor/lib64/egl/eglSubDriverAndroid.so (EglAndroidWindowSurface::GetBuffer(EglSubResource*, EglMemoryDesc*)+64) #04 pc 000000000032732c /vendor/lib64/egl/libGLESv2_adreno.so (EglWindowSurface::UpdateResource(EsxContext*)+116) #05 pc 0000000000326dd0 /vendor/lib64/egl/libGLESv2_adreno.so (EglWindowSurface::GetResource(EsxContext*, EsxResource**, EsxResource**, int)+56) #06 pc 00000000002ae484 /vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::AcquireBackBuffer(int)+364) #07 pc 0000000000249680 /vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::Clear(unsigned int, unsigned int, unsigned int, EsxClearValues*)+1800) #08 pc 00000000002cb52c /vendor/lib64/egl/libGLESv2_adreno.so (EsxGlApiParamValidate::GlClear(EsxDispatch*, unsigned int)+132)
a8780c6a 2020-01-16 20:49:25 Updated copyright date for 2020
d004cc70 2019-12-21 22:40:33 Android: same way as in nativePause(), resume events are sent from SDL thread
45a9b5fa 2019-12-21 21:18:02 Android: fix call of glFinish without context. Message in the log, when going to background: "call to OpenGL ES API with no current context (logged once per thread)" Because of SDL_WINDOWEVENT_MINIMIZED is sent from the Java Activity thread. It calls SDL_RendererEventWatch(), _WindowEvent() and glFinish() without context. Solution is to move sending of SDL_WINDOWEVENT_MINIMIZED to the SDL thread.
13e10151 2019-12-12 20:33:11 Android: use SDL_arraysize()
210f6dda 2019-12-12 18:38:36 Android: use 'RegisterNatives' to export the native methods "The advantages of RegisterNatives are that you get up-front checking that the symbols exist, plus you can have smaller and faster shared libraries by not exporting anything but JNI_OnLoad" https://developer.android.com/training/articles/perf-jni#native-libraries
303646a6 2019-10-31 15:53:10 Android: some readability: redundant casts, deads stores, redundant control flow
9c8e403f 2019-08-30 11:35:20 use 'U' suffix on constants instead of (unsigned int) cast.
70dc8d16 2019-08-30 08:55:20 Android: fix corresponding warnings
63197c43 2019-08-02 17:19:50 Fix bug where the wrong button was the default in the old message box because buttons were added backwards, breaking the indexing used by GetButtonIndex. Add messagebox flags to explicilty request left-to-right button order or right-to-left. If neither is specified it'll be some platform default.
18bcafff 2019-07-27 20:21:42 Fixed bug 4739 - Android: loading native libs, generated by bundletool (Thanks akk0rd87)
22a2decf 2019-06-28 16:38:42 Android: concurrency issues, make sure Activity is in running State when calling functions like SDL_CreateWindow, SDL_CreateRenderer, Android_GLES_CreateContext Bugs 4694, 4681, 4142
ccba8d46 2019-06-24 18:08:11 Android: export Lock/Unlock activity API
a55c0e14 2019-06-18 10:23:19 Android: revert previous commit (Bug 4669) (Refs #1)
f2157b6c 2019-06-17 22:31:36 Fixed bug 4669: Android software renderer, black screen when window resizes Using the software SDL_Renderer on Android leads to GL errors & black screen when window resizes
f9a9193e 2019-06-10 21:58:03 Android: add MinimizeWindow function (Bug 4580, 4657) shouldMinimizeOnFocusLoss is un-activated (return false)
b1100ec1 2019-06-08 10:23:52 Fixed Android build warning
dce56ab9 2019-05-23 14:19:00 Added a function to get the current Android SDK version at runtime
8b57331e 2019-05-23 11:05:43 Fixed hiding the Android virtual keyboard when the return key is pressed
9950271b 2019-04-22 16:19:52 Fixed bug 4580 - Android 8: immersive fullscreen notification causes flickering between fullscreen and non-fullscreen and app is unresponsive Sylvain 2019-04-18 21:22:59 UTC Changes: - SDL_WINDOWEVENT_FOCUS_GAINED and SDL_WINDOWEVENT_FOCUS_LOST are sent when the java method onWindowFocusChanged() is called. - If we have support for MultiWindow (eg API >= 24), SDL event loop is blocked/un-blocked (or simply egl-backed-up or not), when java onStart()/onStop() are called. - If not, this behaves like now, SDL event loop is blocked/un-blocked when onPause()/onResume() are called. So if we have two app on screen and switch from one to the other, only FOCUS events are sent (and onPause()/onResume() are called but empty. onStart()/onStop() are not called). The SDL app, un-focused, would still continue to run and display frames (currently the App would be displayed, but paused). Like a video player app or a chronometer that would still be refreshed, even if the window hasn't the focus. It should work also on ChromeBooks (not tested), with two apps opened at the same time. I am not sure this fix Dan's issue. Because focus lost event triggers Minimize function (which BTW is not provided on android). https://hg.libsdl.org/SDL/file/bb41b3635c34/src/video/SDL_video.c#l2653 https://hg.libsdl.org/SDL/file/bb41b3635c34/src/video/SDL_video.c#l2634 So, in addition, it would need to add by default SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS to 0. So that the lost focus event doesn't try to minimize the window. And this should fix also the issue.
a46af76b 2019-04-05 08:15:01 Fixed bug 4579 - SDL_android.c s_active not being atomic Isaias Brunet This bug cause a false assert due to multiple threads modifying the same variable without any atomic operation.
bfdd0b22 2019-04-04 17:01:02 Android: remove SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH java layer runs as if separate mouse and touch was 1, Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS for generating synthetic touch/mouse events
063c0c2a 2019-03-13 09:39:30 Android: check SDL is initialized before sending the event Avoid error message: SDLActivity thread ends (error=Video subsystem has not been initialized)
d05eec72 2019-03-12 14:44:25 Fixed initial display orientation at Android app start
8ad4000c 2019-01-20 22:17:41 Android: some typos
b9aa3768 2019-01-20 22:11:56 Android: automatically attach to the JVM non-SDL threads It allows a thread created with pthread_create() to access the JNI Env
e5f8801f 2019-01-17 11:05:05 Android: prevent concurrency in Android_SetScreenResolution() when exiting by checking Android_Window validity - SDLThread: user application is exiting: SDL_VideoQuit() and clearing SDL_GetVideoDevice() - ActivityThread is changing orientation/size surfaceChanged() > Android_SetScreenResolution() > SDL_GetVideoDevice() - Separate function into Android_SetScreenResolution() and Android_SendResize(), formating, and mark Android_DeviceWidth/Heigh as static
8a19ff3e 2019-01-16 10:48:28 Android: add mutex protection to onNativeOrientationChanged it's possible receive try to send an event between the check first for SDL_GetVideoDevice and SDL_VideoQuit is called
e994be58 2019-01-16 10:31:51 Android: move static variable isPaused/isPausing to SDL_VideoData structure - remove unneed check to Android_Window->driverdata - add window check into context_backup/restore
dc263450 2019-01-14 23:33:48 Android: create Pause/ResumeSem semaphore at higher level than CreateWindow() - If you call onPause() before CreateWindow(), SDLThread will run in infinite loop in background. - If you call onPause() between a DestroyWindow() and a new CreateWindow(), semaphores are invalids. SDLActivity.java: the first resume() starts the SDLThread, don't call nativeResume() as it would post ResumeSem. And the first pause would automatically be resumed.
7b42f03f 2019-01-11 21:52:43 Android: move and group JNIEnv helper functions
7f347830 2019-01-11 21:42:52 Android: change the way JNIEnv is retrieved - Currently, it tries to Attach the JVM first and update the thread local storage, which are two operations. Now, it simply gives back the JNI Env stored for the thread. - Android_JNI_SetupThreadi() should only be used for external. For internal SDL thread, it's already called in RunThread() (SDL_systhread.c), and other thread are Java threads which don't need to be attached. i (even if it doesn't hurt to do it, since it's a no-op). - JNI_OnLoad is filled with pthread_create, GetEnv, AttachCurrentThread... It's called for all shared libraries which may don't want this setup, and loading libraries can be also modified to be done from a static context, or with relinker. So it's not really clear how, who and what it sets up. => Reduce this function to the minimal
dc10d96c 2019-01-11 15:36:16 Android: use the same naming for JNI env local variables
3cfd907d 2019-01-11 15:33:02 Android: Audio thread is already setup for the JVM In 'src/thread/pthread/SDL_systhread.c' RunThread() calls first 'Android_JNI_SetupThread()'
9d82f4e9 2019-01-11 15:27:53 Android: use pthread_once for creating thread key 'mThreadKey'
9a98e5af 2019-01-11 14:50:43 Android: don't call Android_JNI_ThreadDestroyed() for Java SDLThread SDLThread is a Java Thread, it's not needed to call 'Detach' from the JVM. Clear mThreadKey, so that the pthread_create destructor is not called for this thread.
b44a7aea 2019-01-10 21:49:00 Android: fix prototype of Android_JNI_InitTouch
7a1d1bae 2019-01-10 21:40:57 Android: add name for Touch devices and simplification, from bug 3958
d23c2f07 2019-01-10 18:05:56 Fixed bug 3930 - Android, set thread priorities and names SDLActivity thread priority is unchanged, by default -10 (THREAD_PRIORITY_VIDEO). SDLAudio thread priority was -4 (SDL_SetThreadPriority was ignored) and is now -16 (THREAD_PRIORITY_AUDIO). SDLThread thread priority was 0 (THREAD_PRIORITY_DEFAULT) and is -4 (THREAD_PRIORITY_DISPLAY).
66fbfe1d 2019-01-10 15:43:07 Android: nativeQuit for SDLActivity thread - destroy Android_ActivityMutex - display any SDL error message that may have occured in this thread, since SDL_GetError() is thread specific, and user has no access to it.
dad81611 2019-01-10 15:35:46 Android: only send Quit event to SDLThread if it's not already terminated And it avoids reporting errors using Android_Pause/ResumeSem that are NULL.
8dd91550 2019-01-09 23:19:26 Android: prevent a dummy error message sending SDL_DISPLAYEVENT_ORIENTATION In the usual case, first call to onNativeOrientationChanged() is done before SDL has been initialised and would just set an error message "Video subsystem has not been initialized" without sending the event.
68c0e69f 2019-01-09 22:41:52 Android: native_window validity is guaranteed between surfaceCreated and Destroyed It's currently still available after surfaceDestroyed(). And available (but invalid) between surfaceCreated() and surfaceChanged(). Which means ANativewindow_getWidth/Height/Format() fail in those cases. https://developer.android.com/reference/android/view/SurfaceHolder.html#getSurface()
cfe2924d 2019-01-07 11:35:31 Android: some robustness when quitting application from onDestroy() Make sure there is not pending Pause accumulated, so the the application doesn't remain paused and stucked in onDestroy(). Can be tested by adding: SDLActivity.nativePause(); SDLActivity.nativePause(); mSingleton.finish();
462e62e1 2019-01-06 20:25:54 Android: better fix for bug 3186. Run those commands from SDL thread.
9f23d181 2019-01-06 17:35:42 Android: allow multiple calls to nativeResume() Doesn't seem to happen manually, but symetrical to the pause handling. Can be tested by adding: mNextNativeState = SDLActivity.NativeState.PAUSED; handleNativeState(); mNextNativeState = SDLActivity.NativeState.RESUMED; handleNativeState(); mNextNativeState = SDLActivity.NativeState.PAUSED; handleNativeState(); mNextNativeState = SDLActivity.NativeState.RESUMED; handleNativeState(); Before, it ends in 'paused' state. Now, it ends in 'resumed' state.
35722b64 2019-01-05 22:27:25 Android: fix wrong state after immediate sequence pause() / resume() / pause() It may happen to have the sequence pause()/resume()/pause(), before polling any events. Before, it ends in 'resumed' state because as the check is greedy. Now, always increase the Pause semaphore, and stop at each pause. It ends in 'paused' state. Related to bug 3250: set up a reconfiguration of SurfaceView holder. Turn the screen off manually before the app starts (repro rate is not 100%..)
5e13087b 2019-01-04 22:01:14 Updated copyright for 2019
2e19343d 2019-01-03 20:18:29 Android: use Mutex instead of Semphore for bug 4142
cc8f1136 2019-01-03 14:18:06 Fixed bug 4142 - Concurrency issues in Android backend Use a semaphore to prevent concurrency issues between Java Activity and Native thread code, when using 'Android_Window'. (Eg. Java sending Touch events, while native code is destroying the main SDL_Window. )
5dc25fef 2019-01-03 13:14:16 Android: preparation bug 4142, reduce usage of global variable Android_Window
a95f91bc 2019-01-02 18:06:33 Fixed bug 3250 - Wrong backbuffer pixel format on Android, keep getting RGB_565 Use the egl format to reconfigure java SurfaceView holder format. If there is a change, it triggers a surfaceDestroyed/Created/Change sequence.
03b0e1de 2018-12-30 22:44:25 Android: on rare occasion, prevent Android_JNI_GetNativeWindow() from crashing If Java getNativeSurface() returns null, then ANativeWindow_fromSurface() would crash().
1e22fc15 2018-12-30 15:41:28 Android: fixed comments and spaces
2a412eb9 2018-12-30 15:39:37 Fixed bug 3186 - Android SW keyboard not restored when app becomes foreground.
7468d1e0 2018-12-06 15:46:40 Fix warnings detected on Android build
47fb450b 2018-11-02 17:18:03 Fixed bug 4315 - little Warning in Android_JNI_CaptureAudioBuffer Sylvain SDL_android.c src/core/android/SDL_android.c:1302:5: warning: variable 'br' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ src/core/android/SDL_android.c:1306:12: note: uninitialized use occurs here return br; ^~ src/core/android/SDL_android.c:1270:12: note: initialize the variable 'br' to silence this warning jint br; ^ Maybe we could add some basics warning flags, not to see all warnings, but so that new warnings are caught sooner. I would go for -Wall -Wextra, and some -Wno-warning for the allowed warnings.
62494a2e 2018-10-31 15:03:41 Merge SDL-ryan-batching-renderer branch to default.
b262b0eb 2018-10-22 20:50:32 Small stack allocations fall back to malloc if they're unexpectedly large.
b0c48dd9 2018-10-16 08:29:27 Support vibration magnitude on Android 8.0 (thanks Rachel!)
f5a21ebf 2018-10-09 20:12:43 Added support for surround sound and float audio on Android
74638ea3 2018-09-28 20:39:57 Ensure we wait on the surface resize before returning from setting fullscreen mode.
7df0f4fd 2018-09-27 14:56:29 Fixed bug 4277 - warnings patch Sylvain Patch a few warnings when using: -Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command They are automatically enabled with -Wall
e236e843 2018-09-25 20:08:51 Fixed bug 4268 - Android_JNI_OpenAudioDevice function has error alittle where iscapture == 1 1.param set error (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) param:audioBuffer16Bit need change to captureBuffer16Bit 2.logic error if (is16Bit) { // ALITTLE Modify the source code if (iscapture) { audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)captureBuffer); } else { audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer); } // if (!iscapture) { // audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); // } // audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer); } else { // ALITTLE Modify the source code if (iscapture) { audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)captureBuffer); } else { audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy); audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)audioBuffer); } // if (!iscapture) { // audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy); // } // audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)audioBuffer); }
5febdfce 2018-09-24 11:49:25 Fixed whitespace
09ab752a 2018-08-24 10:41:57 Implement SDL_HapticStopEffect on Android (thanks Rachel!)
a003fa0a 2018-08-23 14:05:25 Implemented SDL_GetDisplayOrientation() on Android (thanks Rachel!)
6f758ad2 2018-08-21 20:03:54 Moved SDL_IsTablet() to a cross-platform API function
109544ca 2018-08-21 11:23:47 Add SDL_IsTablet() to Android and iOS SDL.
ff8c9538 2018-07-12 13:28:13 Allow trapping the back button so right mouse click can work on some Android systems (thanks Rachel!) Also, added a function SDL_AndroidBackButton() so applications can respond to the back button directly
a5158535 2018-06-18 13:14:02 Added support for external mouse in Samsung DeX mode relative mode doesn't work, but absolute coordinates are functional
fe196db7 2018-06-07 17:07:03 Track android device panel width & height as well as window surface & height. Expand SDLActivity::SDLSurface::surfaceChanged() callback to grab the panel width and height at the same time and pass that along to the native code. Only works on API 17+. Duplicates surface dimensions whenever it fails. Add Android_DeviceWidth/Android_DeviceHeight globals to native code. Disambiguate Android_ScreenWidth/Android_ScreenHeight -> Android_SurfaceWidth/Android_SurfaceHeight Use device width/height for all display mode settings.
113801b7 2018-06-05 12:46:13 Added SDL_IsChromebook() to determine if we're running on a Chromebook.
2dedbc72 2018-06-05 12:46:11 Add Android support for relative mouse mode to SDL.
f536fbea 2018-03-16 11:08:53 Reimplemented Android cursor API support using reflection so it builds with older SDKs
e20d4173 2018-03-15 18:22:48 Added Android custom cursor implementation This is commented out in SDLActivity.java, with the note #CURSORIMPLEENTATION because it requires API 24, which is higher than the minimum required SDK
9e651b69 2018-03-06 14:51:50 Try to dynamically create a default Android game controller mapping based on the buttons and axes on the controller. Include the controller USB VID/PID in the GUID where possible, as we do on other platforms.
6e01fbb7 2018-02-11 18:23:37 On Android show the system UI when an SDL window is windowed, hide the system UI when it's fullscreen, like we do on iOS. We're increasing the Android SDK minimum version to API 19, this doesn't increase the minimum target API, which is API 14.
6ed184ec 2018-02-06 15:03:35 Added SDL_IsAndroidTV()
3bfada2e 2018-01-10 19:56:51 Android: resolve symlinks in SDL_AndroidGetInternalStoragePath (thanks Henrique Gemignani and cigumo!) Fixes issues on modern Android versions when the path is used in code that explicitly doesn't follow symlinks (such as PHYSFS_mkdir).
e3cc5b2c 2018-01-03 10:03:25 Updated copyright for 2018
88e3562b 2017-11-27 15:07:07 Use the included Khronos headers on Android so we can create Core OpenGL contexts when building with older SDK
50e422ad 2017-11-04 22:03:28 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable Sylvain What about getting some return code instead of creating another native function.