Commit Graph

339 Commits

Author SHA1 Message Date
Ryan C. Gordon 38f0214e8a audio: Refer to audio devices to "playback" and "recording".
Fixes #9619.
2024-06-15 01:08:12 -04:00
Anthony 3c5b1b52ac Update proguard-rules.pro for recent haptic changes 2024-06-05 14:54:42 -07:00
Sam Lantinga f879411627 Added support for gamepad rumble on Android
Tested with the DualSense controller over Bluetooth on Android 12

Fixes https://github.com/libsdl-org/SDL/issues/7847
2024-06-05 09:53:56 -07:00
mechakotik 8f88c32ca6 android: Default to custom theme in styles.xml
Custom theme file exists in project, but is not used by app, which is kinda unintuitive. Using it by default so people who not familiar with Android development won't spend lots of time troubleshooting.
2024-05-31 09:04:06 -07:00
Sam Lantinga 9259d532da isVRHeadset returns true for Pico headsets 2024-05-23 17:39:06 -07:00
Anonymous Maarten e10666397e ci: build simple Android SDL app using gradle 2024-05-22 20:19:18 +02:00
Sam Lantinga 9b7f88e512 Pass the VR controller "back" button to the application on the Oculus Quest 2024-05-13 21:01:04 -07:00
Miku AuahDark 86fada6faa Android: Implement open and save file dialog. 2024-05-06 09:33:48 -07:00
Miku AuahDark 33ae7e38d6
Android: Allow SDL_IOFromFile to open content:// URI. (#9696) 2024-05-06 09:05:49 -07:00
Sam Lantinga d95f5bad24 Updated to version 3.1.2 for the preview release 2024-05-01 09:34:25 -07:00
Susko3 5045680628 Override `onTrimMemory()` instead of `onLowMemory()`
https://developer.android.com/reference/android/content/ComponentCallbacks#onLowMemory()

> Preferably, you should implement ComponentCallbacks2#onTrimMemory from ComponentCallbacks2 [...].
> That API is available for API level 14 and higher, so you should only use this onLowMemory() method as a fallback for older versions.

Since the SDL3 min api level is 19, there's no need for `onLowMemory()` compat.
2024-04-30 08:54:19 -07:00
Sam Lantinga 17d4f8d699 Updated to version 3.1.1 for the preview release 2024-04-01 17:03:46 -07:00
Sam Lantinga 36e73bdda4 Updated to version 3.1.0 for the preview release 2024-03-24 06:16:02 -07:00
Sylvain 1855ce68af Fix bug #9331 - SDL3 Android crash getVibrator() == null 2024-03-23 16:31:21 -07:00
Frosty-J f9d018c808 Add flag to registerReceiver on Android 2024-03-10 09:01:07 -07:00
Sam Lantinga 1cae52bbac Added JNI native methods to proguard-rules.pro (thanks @AntTheAlchemist!)
Fixes https://github.com/libsdl-org/SDL/issues/3563
2024-02-25 08:40:47 -08:00
Ryan C. Gordon 2613e3da24 camera: Rewrote Android support.
This does something a little weird, in that it doesn't care what
`__ANDROID_API__` is set to, but will attempt to dlopen the system
libraries, like we do for many other platform-specific pieces of SDL.

This allows us to a) not bump the minimum required Android version, which is
extremely ancient but otherwise still working, doing the right thing on old
and new hardware in the field, and b) not require the app to link against
more libraries than it previously did before the feature was available.

The downside is that it's a little messy, but it's okay for now, I think.
2024-02-20 15:56:26 -05:00
Michał Janiszewski 631b05b211 Drop stray trailing whitespace for android-project 2024-02-16 09:22:23 -05:00
Sam Lantinga 9ce7fe2848 Removed SDL_HINT_ACCELEROMETER_AS_JOYSTICK
Sensors are a first-class object in SDL and we haven't gotten any feedback that this feature is useful these days.

Closes https://github.com/libsdl-org/SDL/pull/7879
2024-02-12 09:54:33 -08:00
Sam Lantinga a31dc6dfcb Switched SDL_TouchID and SDL_FingerID to be Uint64 with 0 being an invalid value 2024-01-18 10:55:24 -08:00
Amir Kadyrov dd2d809407 AndroidShowToast: make OneShotTask members private final 2024-01-01 08:31:34 -08:00
Sam Lantinga bb0e0ae080 Added a runtime check for BLUETOOTH_CONNECT in addition to BLUETOOTH (thanks @perepujal!)
Fixes https://github.com/libsdl-org/SDL/issues/8731
2023-12-24 06:50:42 -08:00
Sam Lantinga 9d13be743b Make sure we're rendering whenever the activity might be visible, even if we don't have focus.
This fixes rendering when a system dialog is over the application
2023-12-18 19:21:00 -08:00
Sam Lantinga 58a5f5cbe8 Allow sendCommand() to be overridden by derived classes
In this case it's used to prevent switching to windowed mode when destroying and recreating the main window
2023-12-13 10:13:17 -08:00
Sam Lantinga 3c5e9e6112 We can wait up to 500ms in onNativeSurfaceDestroyed(), so wait at least that long in onDestroy() 2023-12-07 14:30:44 -08:00
Zack Middleton 5e9b0820f3 Add cursors for X11/Wayland window resizing 2023-11-21 08:34:13 -08:00
Sam Lantinga 9302d7732d Fixed touch normalized coordinates
When converting normalized coordinates to pixel coordinates, the valid range is 0 to (width or height) - 1, and the pixel coordinate of width or height is past the edge of the window.

Fixes https://github.com/libsdl-org/SDL/issues/2913
2023-11-05 06:55:39 -08:00
Sam Lantinga 5dce4bc716 Makes SDLInputConnection and DummyEdit public classes (thanks Cole!)
I've added an additional patch that expands on the same basic idea as the first one; it makes SDLInputConnection and DummyEdit into public classes so that they can be overridden from the Xamarin end if their functionality needs to be extended. (In my case, I need to change the type of software keyboard that's displayed.)

Fixes https://github.com/libsdl-org/SDL/issues/2785
2023-11-04 23:22:55 -07:00
Sam Lantinga 3a482ebae0 Add createSDLMainRunnable() to SDLActivity (thanks Cole!)
This patch adds a new createSDLMainRunnable() method to SDLActivity.

Currently, SDL on Android expects to find SDL_main somewhere in native code. When using SDL in a Xamarin application, however, what we really want to do is write our entrypoint in managed code. The easiest way to do this is to allow subclasses of SDLActivity to provide their own Runnable to the SDL thread, as in the attached patch.

Fixes https://github.com/libsdl-org/SDL/issues/2785
2023-11-04 21:18:16 -07:00
Sam Lantinga f52b330ed8 Added support for the HP HyperX Clutch Gladiate controller 2023-10-25 09:00:26 -07:00
Sam Lantinga 7c2669c9d9 Accept key events from any source
This allows TV remotes to navigate SDL applications (with source HDMI)

Fixes https://github.com/libsdl-org/SDL/issues/8137
2023-08-24 10:09:02 -07:00
Sam Lantinga 1e9d314482 Updated to Android minSdkVersion 19 and targetSdkVersion 34
This is updated to meet the latest requirements for apps on the Google Play store
2023-08-24 08:23:06 -07:00
Ryan C. Gordon 1c074e8d97
android: Fixed audio device detection. 2023-07-30 11:56:42 -04:00
Ryan C. Gordon 5ff87c6d4a
android: Reworked audio backends for SDL3 audio API.
This involved moving an `#ifdef` out of SDL_audio.c for thread priority,
so the default ThreadInit now does the usual stuff for non-Android platforms,
the Android platforms provide an implementatin of ThreadInit with their
side of the `#ifdef` and other platforms that implement ThreadInit
incorporated the appropriate code...which is why WASAPI is touched in here.

The Android bits compile, but have not been tested, and there was some
reworkings in the Java bits, so this might need some further fixes still.
2023-07-30 11:56:41 -04:00
Sam Lantinga 8cf5dc9963 Build on Android targeting the arm64-v8a architecture by default
This speeds up iteration time and covers most customer devices
2023-06-20 09:18:19 -07:00
Sam Lantinga e6d1ba2a17 Added the concept of display natural orientation
Also renamed SDL_GetDisplayOrientation() SDL_GetDisplayCurrentOrientation()

The natural orientation of the primary display is the frame of reference for accelerometer and gyro sensor readings.
2023-06-17 07:42:16 -07:00
Sylvain 4e0f94ea7d Android: add timeout when waiting the SDL thread to finish
C SDLmain() thread might have started (mSDLThread.start() called)
while the SDL_Init() might not have been called yet,
and so the previous QUIT event will be discarded by SDL_Init() and app is running, not exiting.

This is reprocible by adding instrumentation code in the SDLActivity.

And hopefully, this could fix an ANR, where SDLActivity is in WAITING state (in thread.join()):
  at java.lang.Thread.join (Thread.java:1519)
  at org.libsdl.app.SDLActivity.onDestroy (SDLActivity.java)

while SDLThread seems to be running
2023-06-12 11:53:09 +02:00
Sylvain 8096f7269b Android: add robustness. check that the native code is run for the first time. 2023-06-09 10:13:58 +02:00
Sam Lantinga bb12c6e03e Added Android hidapi 0.14.0 support 2023-05-26 08:19:04 -07:00
Sam Lantinga b48b1ce500 Document the Android SDK versions checked in Java code 2023-05-23 08:44:49 -07:00
Sam Lantinga c971795954 Fixed reporting backspace key if there is no text in the edit buffer (thanks @312937!)
This workaround isn't necessary at API 30 and above.

Fixes https://github.com/libsdl-org/SDL/issues/7039
2023-05-22 11:54:46 -07:00
Sam Lantinga 3f6b2d1a61 Use numeric codes for Android versions, to avoid SDK dependencies 2023-05-22 11:51:32 -07:00
Sylvain dfd80f3d76 Android: control activity re-creation 2023-05-12 07:48:33 -07:00
Sam Lantinga 2e6c48dcb4 Added support for the GameSir-G7 Controller for Xbox 2023-05-11 17:44:56 -07:00
Sam Lantinga a4b4dff4a2 Added support for the Astro C40 in Xbox 360 mode 2023-04-27 17:10:44 -07:00
Sam Lantinga b701ac0266 Fixed building with Java 1.7 2023-04-26 14:14:59 -07:00
Sylvain f38cb0d06f Android: don't add telephony device, as it cannot be opened 2023-04-14 11:31:27 +02:00
Rudolf Polzer de3909a190 Android: indicate gamepaddb entries where axis order changed.
Axis order was changed in 6f1f586086 to improve
default mappings.
2023-03-11 12:43:48 -08:00
Sam Lantinga 8994878767 Added SDL_GetSystemTheme() to return whether the system is using a dark or light color theme, and SDL_EVENT_SYSTEM_THEME_CHANGED is sent when this changes
Fixes https://github.com/libsdl-org/SDL/issues/5334
Fixes https://github.com/libsdl-org/SDL/issues/6958
Closes https://github.com/libsdl-org/SDL/pull/6440
2023-03-09 03:25:20 -08:00
divVerent 6f1f586086
Fix Xbox One gamepad axis assignment on SDL_JOYSTICK_ANDROID API (#7405) 2023-03-06 15:33:18 -08:00