Commit graph

300 commits

Author SHA1 Message Date
Sylvain Becker
f1e0772b21 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.
2019-01-10 15:43:07 +01:00
Sylvain Becker
50d8a0f65c 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.
2019-01-10 15:35:46 +01:00
Sylvain Becker
1d7d7bdea4 Android: un-needed transition to Pause state.
- Don't need to go into Pause state, since onPause() has been called before.
- Don't need to call nativePause is SDLThread is already ended
2019-01-10 15:29:37 +01:00
Sylvain Becker
78896bb303 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.
2019-01-09 23:19:26 +01:00
Sylvain Becker
e9811c689e 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()
2019-01-09 22:41:52 +01:00
Sylvain Becker
37737cf2ba Android: don't allow multiple instance of SDLActivity
Default launch mode (standard) allows multiple instances of the SDLActivity.
( https://developer.android.com/guide/topics/manifest/activity-element#lmode )

Not sure this is intended in SDL as this doesn't work. There are static
 variables in Java, in C code which make this impossible (allow one android_window) and
 also Audio print errors.

There is also some code added in onDestroy as if it would be able to
re-initialize: https://hg.libsdl.org/SDL/rev/56e9c709db7e

Bug Android activity life-cycle seems to show there is not transition to get out
of onDestroy()
https://developer.android.com/reference/android/app/Activity#ActivityLifecycle

( can be tested with "adb shell am start  my.package.org/.MainActivity"
  and "adb shell am start -n  my.package.org/.MainActivity" )

Send me a message if there are real use-case for this !
2019-01-07 17:06:50 +01:00
Sylvain Becker
0c8e81d10e Android: remove SURFACE_TYPE_GPU, deprecated in API level 5.
https://developer.android.com/reference/android/view/SurfaceHolder

This constant was deprecated in API level 5. this is ignored, this value is set automatically when needed.
2019-01-05 22:49:50 +01:00
Sylvain Becker
d793997d62 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
2e4e3d974e Android: make sure surfaceChanged try to enter into 'resumed' state. 2019-01-02 17:41:33 +01:00
Sylvain Becker
2eef9b9e2f Fixed bug 4424 - Android windowed mode is broken (Thanks Jonas Thiem!) 2019-01-02 17:08:01 +01:00
Sam Lantinga
688cb2b847 Fixed bug 4320 - Android remove reflection for HIDDeviceBLESteamController
Sylvain

Uneeded use of reflection to access connectGatt method in HIDDeviceBLESteamController.java

The method is API 23

https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#connectGatt(android.content.Context,%20boolean,%20android.bluetooth.BluetoothGattCallback,%20int)
2018-11-02 17:25:00 -07:00
Sam Lantinga
ceee262245 Fixed bug 4319 - Android remove reflection for PointerIcon
Sylvain

Since SDL2 min requirement is Android SDK 26, and PointerIcon is 24. We don't need reflection to access it.
2018-11-02 17:22:15 -07:00
Sam Lantinga
925eba4300 Updated Android project files and documentation 2018-10-28 10:31:06 -07:00
Sam Lantinga
1880564264 Fixed reinitializing the SDL joystick subsystem on Android 2018-10-23 12:40:25 -07:00
Sam Lantinga
9198904285 Change our fullscreen wait logic to only wait if we need to. (thanks Rachel!) 2018-10-22 14:55:47 -07:00
Sam Lantinga
cb0aa75cfe Handle failure to load hidapi gracefully 2018-10-22 14:55:45 -07:00
Sam Lantinga
afeced9c72 Fixed bug 4318 - Android move Haptic code to API26 class
Sylvain

- Create SDLHapticHandler_API26
- No need of reflection since SDL2 compile with Android 26 as a min requirement.
- remove spaces
2018-10-16 15:00:43 -07:00
Sam Lantinga
b940c2ed0d Support vibration magnitude on Android 8.0 (thanks Rachel!) 2018-10-16 08:29:27 -07:00
Sam Lantinga
31490ce318 Added support for surround sound and float audio on Android 2018-10-09 20:12:43 -07:00
Sam Lantinga
223bea8f0e Removed unneeded variable qualifiers 2018-10-09 20:12:40 -07:00
Sam Lantinga
c34c6e1474 Fixed life-cycle issues with two activities sharing HIDDeviceManager 2018-10-08 12:49:30 -07:00
Sam Lantinga
d6cb11d8cc Close on shutdown, for consistency 2018-10-08 12:49:28 -07:00
Sam Lantinga
1faa0d69ec Trying to track down NullPointerException in USB input thread 2018-10-08 12:49:26 -07:00
Sam Lantinga
cfefb1c1ed Allow SDL to use ReLinker if present.
This fixes issues for applications that have a large number of shared libraries
For more information, see https://github.com/KeepSafe/ReLinker for ReLinker's repository.
2018-10-04 16:29:17 -07:00
Sam Lantinga
4b50a017c6 The Amlogic X96 is a set-top box 2018-10-02 13:17:31 -07:00
Sam Lantinga
ebc8d2ffb2 Fixed UnsatisfiedLinkError when initializing the HIDDeviceManager in some cases 2018-10-01 14:52:28 -07:00
Sam Lantinga
88aa4120ba Fixed tablet detection on Android 2018-09-29 02:14:46 -07:00
Sam Lantinga
6911c8ca79 Ensure we wait on the surface resize before returning from setting fullscreen mode. 2018-09-28 20:39:57 -07:00
Sam Lantinga
675c561fef Fixed bug 4270 - Android HIDDeviceManager function needs to be public
Sylvain

Can't run an android app without declaring the JNI interface function as public.
2018-09-25 20:11:52 -07:00
Sam Lantinga
2e6df0aaba Fixed rare null pointer dereference 2018-09-24 20:31:24 -07:00
Sam Lantinga
7aff227a2d Support relative mouse for Samsung DeX on Samsung Experience 9.5 or later (Android 8.1 or later) 2018-09-24 11:53:04 -07:00
Sam Lantinga
dc60849e53 Fixed NullPointerException if there's no singleton 2018-09-17 12:08:05 -07:00
Sam Lantinga
534639b3f0 Guard against Steam Controller input when we're shutting down. 2018-09-14 18:31:03 -07:00
Sam Lantinga
1e90b4fa70 Fixed bug 4002 - Android, nativeRunMain() fails on some phone with arm64-v8a
Sylvain

The issue is totally reproducible on P8 Lite.

"The dlopen() call doesn't include the app's native library directory. The behavior of  dlopen() by Android is not guaranteed".

Workaround in getMainSharedObject()

Just replace
    return library;
with
    return getContext().getApplicationInfo().nativeLibraryDir + "/" + library;
2018-09-05 15:54:46 -07:00
Sam Lantinga
8dab95ee3d Implement SDL_HapticStopEffect on Android (thanks Rachel!) 2018-08-24 10:41:57 -07:00
Sam Lantinga
4ab7b3d88b Implemented SDL_GetDisplayOrientation() on Android (thanks Rachel!) 2018-08-23 14:05:25 -07:00
Sam Lantinga
16ffa91778 Updated required Android SDK to API 26, to match Google's new App Store requirements 2018-08-21 20:46:25 -07:00
Sam Lantinga
ea0f29374b Don't crash if the app doesn't have Bluetooth permissions 2018-08-21 11:59:13 -07:00
Sam Lantinga
50719c8609 By default just build for 32-bit ARM and x86 2018-08-21 11:44:08 -07:00
Sam Lantinga
776fafab15 Add SDL_IsTablet() to Android and iOS SDL. 2018-08-21 11:23:47 -07:00
Sam Lantinga
abfa8df22d Don't crash if the app doesn't have Bluetooth permissions 2018-08-21 11:07:56 -07:00
Sam Lantinga
8a76b57970 Fixed Android build error 2018-08-21 10:37:26 -07:00
Sam Lantinga
a33cd77b54 The MINIX NEO-U1 is now being reported as Android TV 2018-08-09 16:04:25 -07:00
Sam Lantinga
db39b4811f Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.
Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
2018-08-09 16:00:17 -07:00
Sam Lantinga
abfd37842e Clean up captured pointer code to avoid logcat clutter on pre-8.0 systems (thanks Rachel!) 2018-07-13 12:55:50 -07:00
Sam Lantinga
bbc117137c 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
7d843b752b 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
d8cdfc2a4b Make certain we only hide system UI when we're fullscreen for real. (thanks Rachel!) 2018-06-18 13:14:00 -07:00
Sam Lantinga
90fc4490bc Deal with situations where the system UI is shown when the keyboard pops up (thanks Rachel!) 2018-06-18 13:13:58 -07:00
Sam Lantinga
fd0a45865f SDL Android fullscreen code extensively tested on Steam Link with no issues reported 2018-06-13 14:24:30 -07:00