android-project


Log

Author Commit Date CI Message
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.
Philipp Wiesemann 242c3480 2016-07-27T20:46:18 Android: Replaced deprecated AbsoluteLayout with RelativeLayout. Fixes Bugzilla #2211.
Cole Campbell 8f17b203 2016-07-04T10:39:32 Commit KEYCODE_SPACE as text input on Android
Philipp Wiesemann bb9dcf57 2016-04-25T22:17:38 Android: Updated name of README file.
Philipp Wiesemann 88f51937 2016-01-26T22:20:05 Android: Fixed ignoring a return value while handling motion events. This should not have caused problems yet because the return value was identical.
Philipp Wiesemann 2191abb2 2016-01-13T19:31:03 Android: Fixed finishing Activity on some devices if right mouse button pressed. Partially fixes Bugzilla #3227.
Philipp Wiesemann 46cb8510 2016-01-12T22:22:24 Android: Fixed a comment.
Philipp Wiesemann 2a4855f9 2015-10-15T22:26:00 Android: Added missing import statement. It did not compile without.
Ryan C. Gordon 82603b60 2015-10-15T12:52:00 Fix some Android keyboards that didn't work properly. This conversation came from Joshua Granick on Twitter, starting here: https://twitter.com/singmajesty/status/653640543675641857 "We found an issue where certain Android keyboards (like the S6 with predictive text) wouldn't work ... Certain keyboards use a predictive text mode that does not dispatch a traditional onKey events, which is troublesome ... but telling the OS to use a "visible password" keyboard helps deal with this problem ... perhaps there's some other way (onKeyPreIme?) to do "textediting" events, but for now, this should be a fast fix ... I hear it affects the Galaxy Tab A 8.0", Galaxy S6, Asus ZenPhone 2, maybe others"
Philipp Wiesemann 5bc93cc5 2015-10-07T21:16:40 Android: Added a new method in SDLSurface.
Philipp Wiesemann 10daf1f4 2015-09-27T20:12:47 Android: Removed three internal functions not used by SDL. They were not needed internally since the switch to the common EGL backend. Thanks to the SDL mailing list for pointing out that the functions seem unused.
Philipp Wiesemann 40364541 2015-09-18T21:26:28 Android: Improved last error message for failed APK expansion file use.
Philipp Wiesemann 625d39b1 2015-09-17T22:36:11 Android: Added additional error messages for APK expansion file use.
Philipp Wiesemann 6e7c479e 2015-09-17T22:30:24 Android: Fixed trying to read from APK expansion files without version hint set. This also fixed overwriting the asset error message which is more useful if no APK expansion files are available and the requested file was not found.
Philipp Wiesemann 92ca42d9 2015-09-17T22:24:54 Android: Renamed SDLActivity's Java method used for APK expansion files. The name was not correct.
Philipp Wiesemann 68b3b542 2015-09-17T22:14:37 Android: Removed empty onDraw() override method from SDLActivity. It was redundant because SDLActivity already inherits an empty method from the base class SurfaceView (which does not implement it but inherits it from View). Visibility of onDraw() in SDLActivity is now protected again instead of public.
Philipp Wiesemann a4a5483f 2015-09-05T20:21:35 Android: Fixed unused variable warning.
Philipp Wiesemann 2b6f6422 2015-09-05T20:21:06 Android: Fixed missing break warning.
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().