android-project


Log

Author Commit Date CI Message
Sam Lantinga e4c9806f 2018-10-08T12:49:26 Trying to track down NullPointerException in USB input thread
Sam Lantinga a0c53668 2018-10-04T16:29:17 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.
Sam Lantinga ae5317e8 2018-10-02T13:17:31 The Amlogic X96 is a set-top box
Sam Lantinga 679d3553 2018-10-01T14:52:28 Fixed UnsatisfiedLinkError when initializing the HIDDeviceManager in some cases
Sam Lantinga e77ec889 2018-09-29T02:14:46 Fixed tablet detection 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 d40657bf 2018-09-25T20:11:52 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.
Sam Lantinga da89b81c 2018-09-24T20:31:24 Fixed rare null pointer dereference
Sam Lantinga e0fe8f3c 2018-09-24T11:53:04 Support relative mouse for Samsung DeX on Samsung Experience 9.5 or later (Android 8.1 or later)
Sam Lantinga c179d394 2018-09-17T12:08:05 Fixed NullPointerException if there's no singleton
Sam Lantinga 66294d31 2018-09-14T18:31:03 Guard against Steam Controller input when we're shutting down.
Sam Lantinga a0b3dcc2 2018-09-05T15:54:46 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;
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 38ae4988 2018-08-21T20:46:25 Updated required Android SDK to API 26, to match Google's new App Store requirements
Sam Lantinga c2791fc6 2018-08-21T11:59:13 Don't crash if the app doesn't have Bluetooth permissions
Sam Lantinga 2a4999b4 2018-08-21T11:44:08 By default just build for 32-bit ARM and x86
Sam Lantinga 109544ca 2018-08-21T11:23:47 Add SDL_IsTablet() to Android and iOS SDL.
Sam Lantinga b09b25f6 2018-08-21T11:07:56 Don't crash if the app doesn't have Bluetooth permissions
Sam Lantinga ad1e3c2a 2018-08-21T10:37:26 Fixed Android build error
Sam Lantinga cf823094 2018-08-09T16:04:25 The MINIX NEO-U1 is now being reported as Android TV
Sam Lantinga d2042e1e 2018-08-09T16:00:17 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
Sam Lantinga fd8e8f9f 2018-07-13T12:55:50 Clean up captured pointer code to avoid logcat clutter on pre-8.0 systems (thanks Rachel!)
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 f1d8f5f7 2018-06-18T13:14:00 Make certain we only hide system UI when we're fullscreen for real. (thanks Rachel!)
Sam Lantinga 8b574dc4 2018-06-18T13:13:58 Deal with situations where the system UI is shown when the keyboard pops up (thanks Rachel!)
Sam Lantinga 12ff19c0 2018-06-13T14:24:30 SDL Android fullscreen code extensively tested on Steam Link with no issues reported
Sam Lantinga 63317dfb 2018-06-07T17:07:05 Don't crash on exit from SDLActivity if we don't have a singleton for some reason. (Thanks Rachel!)
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 77709aec 2018-06-06T09:42:12 Added Android hardware feature support to the default manifest
Sam Lantinga 7c5f3cf3 2018-06-05T14:08:39 Added improved mouse pointer capture under API 26. (Thanks Rachel!)
Sam Lantinga 113801b7 2018-06-05T12:46:13 Added SDL_IsChromebook() to determine if we're running on a Chromebook.
Sam Lantinga 03ff7dcf 2018-05-29T11:18:01 Added support for Android relative mouse mode on API 24 and above
Sam Lantinga 5d1d0357 2018-05-23T17:15:35 Better fix for axis sorting with some Android controllers
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 0df7fe84 2018-03-01T08:22:56 Temporarily disabled fullscreen switching code on Android, until we can resolve bug 4096 - Enabling fullscreen on Android causes the app to toggle fullscreen mode continuously in a loop
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 54340ab9 2018-02-07T15:10:50 Fixed bug 4021 - Android, hard-coded Keycode value Sylvain There is an hard-coded keycode value in SDLActivity.java
Sam Lantinga 6ed184ec 2018-02-06T15:03:35 Added SDL_IsAndroidTV()
Sam Lantinga fab2e246 2018-01-27T12:07:05 Removed armeabi from the SDL build API list, since it's not supported by the latest Android SDK
Cole Campbell b401cfd9 2018-01-09T19:11:34 Allow Android Java shim to be built as an AAR
Sam Lantinga 616827ae 2017-12-19T11:19:10 Fixed bug 4001 - Android, prevent error message box to crash Sylvain Prevent the error message box to crash after being clicked. Because of "SDLActivity.mSingleton.finish();"
Sam Lantinga b92e2f02 2017-12-19T10:57:21 Fixed bug 4004 - iOS: don't hide keyboard on RETURN Dominik Reichardt As discussed in 2012 the iOS onscreen keyboard hides when you hit RETURN (see https://discourse.libsdl.org/t/on-screen-keyboard-change/19216). IMO this is a bad idea to not be able to influence this behavior and just recently this was fixed for Android by adding the hint SDL_HINT_ANDROID_RETURN_HIDES_IME in changeset 11768 6ce3bb5e38a5.
Sam Lantinga 2afc0b7f 2017-12-12T12:52:23 Add the ability to set SDL to handle Return as 'hide IME' on Android softkeyboard. (thanks Rachel!)
Sam Lantinga c317ab97 2017-11-12T10:59:05 Fixed Android build error on 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 bb8c3a9c 2017-11-02T10:41:55 Make SDL fullscreen windows on Android actually fullscreen
Sam Lantinga 522901b8 2017-11-02T08:46:14 Fixed bug 3933 - Android, no need of the listener thread Sylvain A listener thread has been added to know when the native thread would end. But now, it is more easy to only check that after the main function has returned. It's one thread less.
Sam Lantinga 8c465802 2017-11-01T18:41:11 Allow the activity to persist through connecting or disconnecting a keyboard
Sam Lantinga 62c3acaf 2017-11-01T18:40:11 Moved the meta-data into the right section
Sam Lantinga a90be440 2017-11-01T10:06:58 Added controller mapping for Android TV remotes Also fixed the back button on the remote exiting the application
Sam Lantinga 4478707b 2017-10-31T13:49:59 Add SDL_GetDisplayDPI implementation on Android. (thanks Rachel!)
Sam Lantinga 6d23ea4b 2017-10-29T21:09:09 Fixed Java string comparison with ""
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 45536710 2017-10-24T00:04:40 Fixed crash if mSurface isn't set up when we pause the application
Sam Lantinga 81f7e0c1 2017-10-23T23:35:04 Removed unneeded file automatically generated by Android Studio
Sam Lantinga b8d8a1f1 2017-10-23T23:26:40 Updated the minimum and target SDK versions in AndroidManifest.xml
Sam Lantinga edf0fae1 2017-10-23T23:23:47 Updated Android build tools version, which bumped minimum deployment target to API 14 Also added native code to the Android gradle project, which allows using gradle or Android Studio to build the entire SDL application without a separate ndk-build step.
Sam Lantinga 76cdce44 2017-10-23T23:23:34 Fixed build with older Android SDK
Sam Lantinga f08480af 2017-10-23T15:23:43 Switched to new style gradle Android application build process
Sam Lantinga c339d9ed 2017-10-20T10:29:22 Reverted changes 6acdea394736 and 1448a2ac30fe I don't want to introduce any regressions with Android TV remote support
Sam Lantinga 2001898d 2017-10-19T15:37:52 Fixed Android joystick detection
Sam Lantinga 9d9be456 2017-10-19T13:54:56 Don't use DPAD devices as joystick input on Android
Sam Lantinga dff56c34 2017-10-13T19:55:07 Android Studio code analyzer fixes
Sam Lantinga 14ed0d24 2017-09-23T12:37:09 Fixed bug 3843 - Android missing some code in SDLHapticHandler Sylvain Some check for android SDK version are missing from https://hg.libsdl.org/SDL/rev/3d7a29a369a0 here's a patch
Sam Lantinga 82557750 2017-09-22T08:31:56 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 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 6c38c900 2017-08-31T15:12:08 Update Android SDK required to API level 16 Sylvain Some API 16 methods are used (InputDevice: getDescriptor(), getVibrator()), so we need to compile at least with SDK API 16. Hence default.properties and project.properties have been modified to use android-16. There are also some modification to SDLActivity.java not to use getVibrator() if we run under API 16. And not to check to presence of hasVibrator() if we are under API 11. -some hard-coded constant can be expandend. - rename a local variable (hasVibrator to hasVibratorService)
Sam Lantinga 347fe704 2017-08-30T14:25:01 Fixed bug 3789 - Android : small clean up Sylvain Since https://hg.libsdl.org/SDL/rev/6546daa45a02 SDL_android_main.c is empty and then produce a warning nativeInit does not exist and dont need to be mark undefined
Sam Lantinga c684eb2c 2017-08-28T23:04:47 Add a way to set the context when other activities are active so many SDL API functions still work.
Sam Lantinga 60182eb7 2017-08-28T14:40:21 Allow overriding the main entry point on Android
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 c45932ba 2017-08-28T09:54:16 Fixed bug 2277 - Hardware keyboard control key sequences don't get reported chw Control key sequences from hardware keyboards (wireless/USB/bluetooth) get not properly reported on Android devices. The attached patch uses the idea from http://stackoverflow.com/questions/12337117/capture-all-ctrl-under-android to make control key sequences appear as normal SDL_KEYDOWN events instead of cooked text input.
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 6885bc88 2017-08-27T18:36:54 Fixed bug 2265 - Voice to text feature on Android repeats some text via SDL_TEXTINPUT Sylvain Small patch for this issue. I tested it and it seems to work. - it can send several backspaces (instead of only 1). - it calls directly "sendKeyEvent()" instead of "super.sendKeyEvent()". otherwise, it would go through the android internals, calling again "onKey()". and then the "backspace" would arrive after the next "commitText()".
Sam Lantinga d03409e1 2017-08-14T06:18:08 Fixed bug 3191 - haptic system on android? Sylvain - add vibrator service in the list of haptic devices. I use an hard-coded device_id for it ...
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 0a52db54 2017-08-12T08:15:09 Fixed bug 3191 - haptic system on android? Patch provided by jintiao and Milan Nikolic, thanks!
Sam Lantinga df5898b0 2017-08-11T13:37:40 Fixed bug 3464 - Fix for Android hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH ny00 According to the current documentation in SDL_hints.h, if SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH is set to "0" (or not set at all) then mouse input should lead to touch events, along with corresponding *fake* mouse events with mouse id SDL_TOUCH_MOUSEID. However, while moving a mouse around (actually using a trackpad identified as a mouse), I get SDL mouse motion events with differing mouse ids, as follows: - If the mouse is moved while a mouse button is pressed, the mouse id is SDL_TOUCH_MOUSEID. - Otherwise, the mouse id for mouse motion events is 0. I've attached sample code for reference, which includes logs of the various mouse events (the "which" field is covered). I believe that no actual mouse event should arrive, if the hint is unset. In particular, no mouse motion event should arrive while no mouse button is pressed. I'm going to attach a patch which resolves this, while also disabling mouse wheel motion events.
Sam Lantinga a47bf374 2017-08-09T20:23:48 Fixed bug 3728 - [Android] crash when shared libraries are no loaded Sylvain On Android, when shared libraries are not correctly loaded (eg SDLActivity.mBrokenLibraries is true), there is a pop-up with an error message. After user dismisses the pop-up, application crashes: - because the native function "nativePause()" may no be loaded (if libSDL2.so is not loaded). - because mSurface is null.
Ryan C. Gordon a9c7bc85 2017-05-19T15:06:05 android: add screenSize to AndroidManifest's configChanges (thanks, Daniel!). Fixes Bugzilla #3448. "Starting with Android API 13, another configuration change must be declared to be handled by the app if it is desired to not let the system handle rotation itself: https://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange This will have effect if either a developer or SDL per default will set target API > 12. Currently it is set to 12, but this might change in the future, like when applying this patch: https://bugzilla.libsdl.org/show_bug.cgi?id=3445 The effect of not having this change applied is that the SDL app is destroyed upon rotation. Even when the manifest has an additional entry to e.g. always stay in landscape mode, the onDestroy() call will happen on devices that are portrait per default, when switching off screen due to power save. The device will then (at least try to) rotate into portrait to show the portrait screen lock after resume. I believe it is safe to apply this patch even with target API still set to 12, the additional parameter is simply ignored."
Ryan C. Gordon 366adae3 2017-04-07T20:17:30 android: More robust fix for screen locking in landscape (thanks, Sylvain!). Fixes Bugzilla #3562. From Sylvain: "With an android landscape application, if you quickly lock, then unlock your device, you can see sometimes a quick glitch: screen badly draws in portrait, then it correctly displays in landscape. Not talking of a smooth rotation, it's a drawing glitch. And you need to have a plain lock screen, with no model nor passphrase. I think it happens because the call to "nativeResume()" occurs sometimes too early. It should be done once you have *all* those three things (in any sequence): - onWindowsFocusChanged() set to true - onResume() called - a valid call to onSurfaceChanged() Currently, this is not the case: you don't need to have onResume() called. Just need to have isPaused, (eg onPaused()). So "isPaused" should be renamed as "isResumedCalled". But you also need some kind of isPaused state to make sure to don't call nativePause() twice (and deadlocks...). There are also redundant checks to "mHasFocus" and some creation of the initialisation thread code from onSurfaceChanged() that could me moved. So here's this patch: - add some states, so we have cleaner transitions. - make sure "onResume()" is called. - some clean up - it also goes faster in pause state (focus changed, onPause, without requiring isSurfaceReady which does seems to be needed). Tested on a few devices and it removes the glitch. But I haven't tested when the activity goes back to "init" state."
Ryan C. Gordon 2092a883 2017-03-31T23:43:53 android: fix wrong events when locking device in landscape (thanks, Joshua!). "Using an application in portrait orientation, turning off the device would dispatch SDL_APP_WILLENTERBACKGROUND, then SDL_APP_DIDENTERBACKGROUND then lock the screen. However, rotating the application the application to landscape, then turning off the device would incorrectly dispatch SDL_APP_WILLENTERBACKGROUND, SDL_APP_WILLENTERBACKGROUND, SDL_APP_WILLENTERFOREGROUND and then SDL_APP_DIDENTERFOREGROUND before locking the screen. You can imagine how this created trouble :) It appears this occurs because (on this application) turning off a device when in landscape is triggering a resize. The resize logic in SDLActivity triggers a resume. This patch has resolved the issue on my device: It prevents the dispatch of (improper) FOREGROUND events when locking the device, but we get still events when the device is turned back on and unlocked."
dmuratshin 01f66613 2017-01-12T10:58:35 fixed SENSOR_LANDSCAPE and SENSOR_PORTRAIT mode false nativeResume bug
Sam Lantinga ae8ca7c5 2016-10-17T22:09:22 Fixed bug 3444 - Android-TV: no more handling of back button on remote ny00 Unfortunately, simply checking the return codes of "onNativePadDown/Up" as previously done has its own issue: If an SDL joystick is connected *and* opened, then a proper KeyEvent, say with keycode KEYCODE_BUTTON_1, should lead to an SDL joystick button event as expected. If, however, the joystick was *not* opened, then "onNativePadDown/Up" will return a negative value, so before the commit from bug 3426, you could unexpectedly get a keyboard event. (In practice, you'll just get a log message, since KEYCODE_BUTTON_1 has no mapping to a proper SDL_ScanCode value, but it's still an problem). What should still be done, though, is checking the key code itself. We do have the KeyEvent.isGamepadButton method, but according my test, it returns "true" exactly (and only) for the KEYCODE_BUTTON* values, and not for KEYCODE_DPAD* or any other key code. Here is a possible solution: - Do check the return codes of "onNativePadDown/Up" as previously done. - In addition, in "Android_OnPadDown/Up" from src/joystick/android/SDL_sysjoystick.c, 0 should *always* be returned in case the key code can be translated to an SDL_joystick button; Even if no matching joystick can be found.
Sam Lantinga 83cb2b63 2016-10-14T06:57:55 Fixed bug 2758 - Android issues with NDK r10c and API-21 Sylvain After a long time, I found out more clearly what was going wrong. The native libraries should be built with a "APP_PLATFORM" as low as possible. Ideally, APP_PLATFORM should be equals to the minSdkVersion of the AndroidManifest.xml So that the application never runs on a lower APP_PLATFORM than it has been built for. An additional good patch would be to write explicitly in "jni/Application.mk": APP_PLATFORM=android-10 (If no APP_PLATFORM is set, the "targetSdkVersion" of the AndroidManifest.xml is applied as an APP_PLATFORM to the native libraries. And currently, this is bad, because targetSdkVersion is 12, whereas minSdkLevel is 10. And in fact, there is a warning from ndk: "Android NDK: WARNING: APP_PLATFORM android-12 is larger than android:minSdkVersion 10 in ./AndroidManifest.xml".) to precise what happened in the initial reported test-case: Let say the "c" code contains a call to "srand()". with APP_PLATFORM=android-21, libSDL2.so contains a undef reference to "srand()". with APP_PLATFORM=android-10, libSDL2.so contains a undef reference to "srand48()". but srand() is missing on devices with APP_PLATFORM=android-10 (it was in fact replaced by srand48()). So, if you build for android-21 (where srand() is available), you will really have a call to "srand()" and it will fail on android-10. That was the issue. The path tried to fix this by in fact always calling srand48(). SDL patches that were applied are beneficial anyway, there are implicitly allowing they backward compatibility of using android-21 on a android-10 platform. It can be helpful in case you want to target a higher APP_PLATFORM than minSdkVersion to have potentially access to more functions. Eg you want to have access to GLES3 functions (or other) of "android-21". But, if dlopen() fails (on android-10), you do a fall-back to GLES2.
Philipp Wiesemann 05ca784e 2016-10-02T22:32:50 Android: Fixed compile error.
Sam Lantinga 4e6f2199 2016-10-01T15:14:48 Fixed bug 3065 - Screen is flickering during closing on-screen keyboard on Android Deve When I'm trying to close on-screen keyboard using SDL_StopTextInput() function by touching the screen (SDL_FINGERUP or SDL_FINGERDOWN event), the screen is flickering. It is white for a while. Note that it usually works without problems when I use phone's "back" button. I noticed flickering occasionally too, but not that often. Philipp Wiesemann The attached patch maybe fixes the flicker but not the actual fault causing it.
Sam Lantinga 257c8972 2016-09-29T16:52:48 Fixed bug 3426 - Fixes for joystick related issues ny00 This report is going to cover three issues, with a suggestion for fixes. For reference, tests were done using an installation of android-x86-5.1-rc1.iso within a VirtualBox session. I've actually used an adapter that accepts up to two Playstation 1/2 controllers. A ZIP file should be attached, with the following contents: - The patch file itself. - Outputs of joysticks lists from testjoystick with different orders (before fixing bug). - Game controllers database entries (for reference). --- Different outputs for different platforms may stem from different tools being used; The Android mapping was manually constructed using a previously available mapping as a base. --- Note that it turns out the Linux mapping is already out there in some form: https://github.com/gabomdq/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt And so, let's begin listing the issues: 1. While changeset https://hg.libsdl.org/SDL/rev/9b540bea3cf1 has good intentions, it appears to make various input devices being mistakenly detected as SDL joysticks. I got lists of the devices from joysticktest, given in the ZIP file. "badordering.txt" is what I get if the device has been plugged since a reboot of the virtual machine, while I've gotten "goodordering.txt" after hot-plugging the USB adapter. As expected, only in the latter case I could use the controller in the test program (assuming it isn't modified). To take care of this, I updated pollInputDevices and added the function SDLActivity.isDeviceSDLJoystick, in order to have a better filter. Note that it also checks that the device id is non-negative, since VIRTUAL_KEYBOARD appears to include a SOURCE_DPAD, and I should probably keep accepting it as an SDL_joystick (good if you want, say, to support multiple independent d-pad devices). I hope the device id filter does not break support for the virtual remote (mentioned in the changeset above). 2. So there's a weird glitch here, where the game controller is reported to have SOURCE_KEYBOARD and SOURCE_JOYSTICK, while each controller button press/release emits a KeyEvent with SOURCE_KEYBOARD only. So obviously any test going over the event's own sources is expected to fail. It is possible to try and filter by the key code, but then there are the dpad key codes, which can also be emitted by actual PC keyboard's key presses/releases (the arrow keys). So instead, I just call the newly added isDeviceSDLJoystick function again and check if the input device (not the event) has any source considered to be a joystick/gamepad for us. 3. Finally, if SDL2 properly detects an SDL_Joystick being connected, but it is not opened, then whenever a KeyEvent is received after a button press/release from the same controller, SDLActivity.onNativePadDown/onNativePadUp returns a negative value. In such a case, the onKey handler continues to check for SOURCE_KEYBOARD (and possibly also SOURCE_MOUSE), which is clearly not desired. And so, in the given patch, the return values of onNativePadDown and onNativePadUp are ignored and "true" is returned either way. (Note: Maybe the native functions should be modified to have the return value of "void".) Finally, as another side-note, I've noticed that the various bitwise tests for sources are wrong. For instance, to check if an InputDevice 'device' has source SOURCE_JOYSTICK, the value (device.getSources() & SOURCE_JOYSTICK) should be compared to SOURCE_JOYSTICK, not 0. However, I think there's enough that this patch covers. At the least, isDeviceSDLJoystick partially solves this.
Sam Lantinga f369d165 2016-09-29T16:40:34 Fixed bug 3427 - Android accelerometer z-axis incorrect Alex Szpakowski As seen here https://bitbucket.org/rude/love/issues/1202/accelerometer-z-axis , the Java code for sending accelerometer data to SDL's C code has an incorrect Z-axis calculation.
Philipp Wiesemann 379a4304 2016-08-30T21:15:46 Android: Removed unused internal function.
Ryan C. Gordon 8f0af773 2016-08-11T22:04:49 android: implement audio capture support.
Philipp Wiesemann 3853f7cd 2016-07-27T20:47:08 Android: Updated a comment.