Sylvain Becker
cfe2924d07
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();
2019-01-07 11:35:31 +01:00
Sylvain Becker
462e62e154
Android: better fix for bug 3186. Run those commands from SDL thread.
2019-01-06 20:25:54 +01:00
Sylvain Becker
9f23d1815f
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.
2019-01-06 17:35:42 +01:00
Sylvain Becker
35722b6423
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%..)
2019-01-05 22:27:25 +01:00
Sam Lantinga
5e13087b0f
Updated copyright for 2019
2019-01-04 22:01:14 -08:00
Sylvain Becker
2e19343df6
Android: use Mutex instead of Semphore for bug 4142
2019-01-03 20:18:29 +01:00
Sylvain Becker
cc8f1136b6
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. )
2019-01-03 14:18:06 +01:00
Sylvain Becker
5dc25fef3b
Android: preparation bug 4142, reduce usage of global variable Android_Window
2019-01-03 13:14:16 +01:00
Sylvain Becker
a95f91bcea
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.
2019-01-02 18:06:33 +01:00
Sylvain Becker
03b0e1dee0
Android: on rare occasion, prevent Android_JNI_GetNativeWindow() from crashing
...
If Java getNativeSurface() returns null, then ANativeWindow_fromSurface() would crash().
2018-12-30 22:44:25 +01:00
Sylvain Becker
1e22fc1513
Android: fixed comments and spaces
2018-12-30 15:41:28 +01:00
Sylvain Becker
2a412eb94c
Fixed bug 3186 - Android SW keyboard not restored when app becomes foreground.
2018-12-30 15:39:37 +01:00
Sylvain Becker
7468d1e096
Fix warnings detected on Android build
2018-12-06 15:46:40 +01:00
Sam Lantinga
47fb450beb
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.
2018-11-02 17:18:03 -07:00
Ryan C. Gordon
62494a2e27
Merge SDL-ryan-batching-renderer branch to default.
2018-10-31 15:03:41 -04:00
Ryan C. Gordon
b262b0ebc9
Small stack allocations fall back to malloc if they're unexpectedly large.
2018-10-22 20:50:32 -04:00
Sam Lantinga
09ab752aa3
Implement SDL_HapticStopEffect on Android (thanks Rachel!)
2018-08-24 10:41:57 -07:00
Sam Lantinga
a003fa0a05
Implemented SDL_GetDisplayOrientation() on Android (thanks Rachel!)
2018-08-23 14:05:25 -07:00
Sam Lantinga
b0c48dd9dd
Support vibration magnitude on Android 8.0 (thanks Rachel!)
2018-10-16 08:29:27 -07:00
Sam Lantinga
f5a21ebf0c
Added support for surround sound and float audio on Android
2018-10-09 20:12:43 -07:00
Sam Lantinga
6f758ad25f
Moved SDL_IsTablet() to a cross-platform API function
2018-08-21 20:03:54 -07:00
Sam Lantinga
109544ca04
Add SDL_IsTablet() to Android and iOS SDL.
2018-08-21 11:23:47 -07:00
Sam Lantinga
ff8c9538bc
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
2018-07-12 13:28:13 -07:00
Sam Lantinga
74638ea3c5
Ensure we wait on the surface resize before returning from setting fullscreen mode.
2018-09-28 20:39:57 -07:00
Sam Lantinga
7df0f4fdac
Fixed bug 4277 - warnings patch
...
Sylvain
Patch a few warnings when using:
-Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command
They are automatically enabled with -Wall
2018-09-27 14:56:29 -07:00
Sam Lantinga
e236e8435a
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);
}
2018-09-25 20:08:51 -07:00
Sam Lantinga
5febdfcece
Fixed whitespace
2018-09-24 11:49:25 -07:00
Sam Lantinga
a515853569
Added support for external mouse in Samsung DeX mode
...
relative mode doesn't work, but absolute coordinates are functional
2018-06-18 13:14:02 -07:00
Sam Lantinga
fe196db774
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.
2018-06-07 17:07:03 -07:00
Sam Lantinga
113801b790
Added SDL_IsChromebook() to determine if we're running on a Chromebook.
2018-06-05 12:46:13 -07:00
Sam Lantinga
2dedbc7262
Add Android support for relative mouse mode to SDL.
2018-06-05 12:46:11 -07:00
Sam Lantinga
f536fbea71
Reimplemented Android cursor API support using reflection so it builds with older SDKs
2018-03-16 11:08:53 -07:00
Sam Lantinga
e20d4173bf
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
2018-03-15 18:22:48 -07:00
Sam Lantinga
9e651b6915
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.
2018-03-06 14:51:50 -08:00
Sam Lantinga
6e01fbb763
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.
2018-02-11 18:23:37 -08:00
Sam Lantinga
6ed184ec69
Added SDL_IsAndroidTV()
2018-02-06 15:03:35 -08:00
Alex Szpakowski
3bfada2e02
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).
2018-01-10 19:56:51 -04:00
Sam Lantinga
e3cc5b2c6b
Updated copyright for 2018
2018-01-03 10:03:25 -08:00
Sam Lantinga
88e3562ba0
Use the included Khronos headers on Android so we can create Core OpenGL contexts when building with older SDK
2017-11-27 15:07:07 -08:00
Sam Lantinga
50e422adfe
Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable
...
Sylvain
What about getting some return code instead of creating another native function.
2017-11-04 22:03:28 -07:00
Sam Lantinga
758156a765
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.
2017-11-04 09:37:29 -07:00
Sam Lantinga
1475e6984a
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.
2017-11-01 19:19:21 -07:00
Sam Lantinga
9192c93e90
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.
2017-11-01 17:30:02 -07:00
Sam Lantinga
4478707b0a
Add SDL_GetDisplayDPI implementation on Android. (thanks Rachel!)
2017-10-31 13:49:59 -07:00
Sam Lantinga
213b249094
Added missing keyinfotable.h
2017-10-26 10:42:14 -07:00
Sam Lantinga
8e37bed3b6
android: Fix softkeyboard issue in SDL on Android.
2017-10-26 10:41:38 -07:00
Sam Lantinga
8fd0c22adc
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().
2017-10-24 00:17:07 -07:00
Sam Lantinga
53b2c91d26
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.
2017-09-22 08:30:46 -07:00
Sam Lantinga
aa85436ec7
Fixed compile warning
2017-08-28 14:45:19 -07:00
Sam Lantinga
da84c3bf6e
Added a log message for nativeRunMain()
2017-08-28 14:44:21 -07:00