src/core/android


Log

Author Commit Date CI Message
Sylvain Becker 303646a6 2019-10-31T15:53:10 Android: some readability: redundant casts, deads stores, redundant control flow
Ozkan Sezer 9c8e403f 2019-08-30T11:35:20 use 'U' suffix on constants instead of (unsigned int) cast.
Sylvain Becker 70dc8d16 2019-08-30T08:55:20 Android: fix corresponding warnings
Sam Lantinga 63197c43 2019-08-02T17: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.
Sylvain Becker 18bcafff 2019-07-27T20:21:42 Fixed bug 4739 - Android: loading native libs, generated by bundletool (Thanks akk0rd87)
Sylvain Becker 22a2decf 2019-06-28T16: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
Sylvain Becker ccba8d46 2019-06-24T18:08:11 Android: export Lock/Unlock activity API
Sylvain Becker a55c0e14 2019-06-18T10:23:19 Android: revert previous commit (Bug 4669) (Refs #1)
Sylvain Becker f2157b6c 2019-06-17T22: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
Sylvain Becker f9a9193e 2019-06-10T21:58:03 Android: add MinimizeWindow function (Bug 4580, 4657) shouldMinimizeOnFocusLoss is un-activated (return false)
Sam Lantinga b1100ec1 2019-06-08T10:23:52 Fixed Android build warning
Sam Lantinga dce56ab9 2019-05-23T14:19:00 Added a function to get the current Android SDK version at runtime
Sam Lantinga 8b57331e 2019-05-23T11:05:43 Fixed hiding the Android virtual keyboard when the return key is pressed
Sam Lantinga 9950271b 2019-04-22T16: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.
Sam Lantinga a46af76b 2019-04-05T08: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.
Sylvain Becker bfdd0b22 2019-04-04T17: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
Sylvain Becker 063c0c2a 2019-03-13T09:39:30 Android: check SDL is initialized before sending the event Avoid error message: SDLActivity thread ends (error=Video subsystem has not been initialized)
Sam Lantinga d05eec72 2019-03-12T14:44:25 Fixed initial display orientation at Android app start
Sylvain Becker 8ad4000c 2019-01-20T22:17:41 Android: some typos
Sylvain Becker b9aa3768 2019-01-20T22:11:56 Android: automatically attach to the JVM non-SDL threads It allows a thread created with pthread_create() to access the JNI Env
Sylvain Becker e5f8801f 2019-01-17T11: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
Sylvain Becker 8a19ff3e 2019-01-16T10: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
Sylvain Becker e994be58 2019-01-16T10: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
Sylvain Becker dc263450 2019-01-14T23: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.
Sylvain Becker 7b42f03f 2019-01-11T21:52:43 Android: move and group JNIEnv helper functions
Sylvain Becker 7f347830 2019-01-11T21: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
Sylvain Becker dc10d96c 2019-01-11T15:36:16 Android: use the same naming for JNI env local variables
Sylvain Becker 3cfd907d 2019-01-11T15:33:02 Android: Audio thread is already setup for the JVM In 'src/thread/pthread/SDL_systhread.c' RunThread() calls first 'Android_JNI_SetupThread()'
Sylvain Becker 9d82f4e9 2019-01-11T15:27:53 Android: use pthread_once for creating thread key 'mThreadKey'
Sylvain Becker 9a98e5af 2019-01-11T14: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.
Sylvain Becker b44a7aea 2019-01-10T21:49:00 Android: fix prototype of Android_JNI_InitTouch
Sylvain Becker 7a1d1bae 2019-01-10T21:40:57 Android: add name for Touch devices and simplification, from bug 3958
Sylvain Becker d23c2f07 2019-01-10T18: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).
Sylvain Becker 66fbfe1d 2019-01-10T15: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.
Sylvain Becker dad81611 2019-01-10T15: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.
Sylvain Becker 8dd91550 2019-01-09T23: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.
Sylvain Becker 68c0e69f 2019-01-09T22: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()
Sylvain Becker cfe2924d 2019-01-07T11: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();
Sylvain Becker 462e62e1 2019-01-06T20:25:54 Android: better fix for bug 3186. Run those commands from SDL thread.
Sylvain Becker 9f23d181 2019-01-06T17: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.
Sylvain Becker 35722b64 2019-01-05T22: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%..)
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sylvain Becker 2e19343d 2019-01-03T20:18:29 Android: use Mutex instead of Semphore for bug 4142
Sylvain Becker cc8f1136 2019-01-03T14: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. )
Sylvain Becker 5dc25fef 2019-01-03T13:14:16 Android: preparation bug 4142, reduce usage of global variable Android_Window
Sylvain Becker a95f91bc 2019-01-02T18: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.
Sylvain Becker 03b0e1de 2018-12-30T22:44:25 Android: on rare occasion, prevent Android_JNI_GetNativeWindow() from crashing If Java getNativeSurface() returns null, then ANativeWindow_fromSurface() would crash().
Sylvain Becker 1e22fc15 2018-12-30T15:41:28 Android: fixed comments and spaces
Sylvain Becker 2a412eb9 2018-12-30T15:39:37 Fixed bug 3186 - Android SW keyboard not restored when app becomes foreground.
Sylvain Becker 7468d1e0 2018-12-06T15:46:40 Fix warnings detected on Android build
Sam Lantinga 47fb450b 2018-11-02T17: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.
Ryan C. Gordon 62494a2e 2018-10-31T15:03:41 Merge SDL-ryan-batching-renderer branch to default.
Ryan C. Gordon b262b0eb 2018-10-22T20:50:32 Small stack allocations fall back to malloc if they're unexpectedly large.
Sam Lantinga b0c48dd9 2018-10-16T08:29:27 Support vibration magnitude on Android 8.0 (thanks Rachel!)
Sam Lantinga f5a21ebf 2018-10-09T20:12:43 Added support for surround sound and float audio on Android
Sam Lantinga 74638ea3 2018-09-28T20:39:57 Ensure we wait on the surface resize before returning from setting fullscreen mode.
Sam Lantinga 7df0f4fd 2018-09-27T14: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
Sam Lantinga e236e843 2018-09-25T20: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); }
Sam Lantinga 5febdfce 2018-09-24T11:49:25 Fixed whitespace
Sam Lantinga 09ab752a 2018-08-24T10:41:57 Implement SDL_HapticStopEffect on Android (thanks Rachel!)
Sam Lantinga a003fa0a 2018-08-23T14:05:25 Implemented SDL_GetDisplayOrientation() on Android (thanks Rachel!)
Sam Lantinga 6f758ad2 2018-08-21T20:03:54 Moved SDL_IsTablet() to a cross-platform API function
Sam Lantinga 109544ca 2018-08-21T11:23:47 Add SDL_IsTablet() to Android and iOS SDL.
Sam Lantinga ff8c9538 2018-07-12T13: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
Sam Lantinga a5158535 2018-06-18T13:14:02 Added support for external mouse in Samsung DeX mode relative mode doesn't work, but absolute coordinates are functional
Sam Lantinga fe196db7 2018-06-07T17: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.
Sam Lantinga 113801b7 2018-06-05T12:46:13 Added SDL_IsChromebook() to determine if we're running on a Chromebook.
Sam Lantinga 2dedbc72 2018-06-05T12:46:11 Add Android support for relative mouse mode to SDL.
Sam Lantinga f536fbea 2018-03-16T11:08:53 Reimplemented Android cursor API support using reflection so it builds with older SDKs
Sam Lantinga e20d4173 2018-03-15T18: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
Sam Lantinga 9e651b69 2018-03-06T14: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.
Sam Lantinga 6e01fbb7 2018-02-11T18: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.
Sam Lantinga 6ed184ec 2018-02-06T15:03:35 Added SDL_IsAndroidTV()
Alex Szpakowski 3bfada2e 2018-01-10T19: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).
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 88e3562b 2017-11-27T15:07:07 Use the included Khronos headers on Android so we can create Core OpenGL contexts when building with older SDK
Sam Lantinga 50e422ad 2017-11-04T22:03:28 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable Sylvain What about getting some return code instead of creating another native function.
Sam Lantinga 758156a7 2017-11-04T09:37:29 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable We're going to push the manifest environment variables from the Java side instead of continually querying for them from the native side.
Sam Lantinga 1475e698 2017-11-01T19:19:21 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable Sylvain Some issue with this commit: https://hg.libsdl.org/SDL/rev/97387a8b88d3 There is a memory allocation missing.
Sam Lantinga 9192c93e 2017-11-01T17:30:02 Fixed bug 3932 - Android, GetDisplayDPI release local reference Sylvain When writing JNI code, one has to make sure all local references are released otherwise the app end up crashing.
Sam Lantinga 4478707b 2017-10-31T13:49:59 Add SDL_GetDisplayDPI implementation on Android. (thanks Rachel!)
Sam Lantinga 213b2490 2017-10-26T10:42:14 Added missing keyinfotable.h
Sam Lantinga 8e37bed3 2017-10-26T10:41:38 android: Fix softkeyboard issue in SDL on Android.
Sam Lantinga 8fd0c22a 2017-10-24T00:17:07 Added the ability to set SDL hints from AndroidManifest.xml (thanks Rachel!) This is especially useful for things like the accelerometer hint which could be needed before application main().
Sam Lantinga 53b2c91d 2017-09-22T08:30:46 Separated out SDL Android java code so audio, controller, and filesystem APIs can be used independently of the SDL activity, in Qt apps for example.
Sam Lantinga aa85436e 2017-08-28T14:45:19 Fixed compile warning
Sam Lantinga da84c3bf 2017-08-28T14:44:21 Added a log message for nativeRunMain()
Sam Lantinga dbb0a2aa 2017-08-28T14:34:15 Removed the need for libSDL2main.a on Android, and separated JNI initialization out for other integrations
Sam Lantinga 2a945b44 2017-08-28T10:03:39 Fixed bug 2361 - [Android] Joysticks do not have unique IDs David Brady When I attempted to make a mapping file for Android gamepads, I quickly discovered that most of the ones that I have here show up as the same device (Broadcom Bluetooth HID), meaning that it was impossible to make mappings on Android, since every device looked the same. This patch will check for the existence of the getDescriptor function added in Jelly Bean, and use it if it's there. The Android Dashboard says that the majority of Android phones should support this function, and doing it this way will not force us to bump up our API version.
Sam Lantinga fe21a747 2017-08-27T18:43:52 Fixed bug 2266 - please add notifications for clipboard updates on Android Sylvain Hi! here's a patch for that with two class loaded regarding API level. Test both case : before API 11 and after. I also remove now unused GetSystemServiceFromUIThread() and minor clean-up (haptic warning prototype).
Sam Lantinga e9d4e310 2017-08-14T14:14:45 Fixed bug 3753 - Android : load methodID during initialization Sylvain Small patch to load some java methodID at start-up (and avoid a potential crash at run-time).
Sam Lantinga e54eede2 2017-08-13T21:05:15 Provide the correct state of the on-screen keyboard to the API (patch from Sylvain)
Sam Lantinga 6ee66139 2017-08-13T20:55:59 Fixed bug 3235 - Make the Android window creation similar to iOS' window creation Sylvain Here's a patch. It tries to get the hint first. Resizable will allow any orientation. Otherwise it uses width/height window. setOrientation method is splitted in static and non-static, so that it can be overloaded in a user subclass. Some artefact observed : surfaceChanged() can be called twice at the beginning. When the phone starts in portrait and run a landscape application.
Sam Lantinga c0862512 2017-08-12T12:24:59 Fixed bug 3128 - Removing all the static variables from android SDLActivity and accompanying JNI calls. owen I removed all the static variables from SDLActivity.java Updated all the SDL_android.c jni calls as well I added a new function to SDL_android.c/ h void Android_JNI_SeparateEventsHint(const char* c); This is called by SDL_androidtouch.c so that this TU doesn't need to call any JNI functions.
Sam Lantinga 0a52db54 2017-08-12T08:15:09 Fixed bug 3191 - haptic system on android? Patch provided by jintiao and Milan Nikolic, thanks!
Philipp Wiesemann 4b47fa38 2017-06-04T23:15:47 Removed duplicate includes.
Philipp Wiesemann fc436a3a 2017-06-03T23:00:40 android: Moved internal function to new position. It was grouped with functions for the public system header.
Philipp Wiesemann 189b5851 2017-05-25T23:01:16 android: Fixed parameter list in function definitions.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 26f05ecb 2016-12-02T02:25:12 Fixed missing prototypes on Android, patch from Sylvain