Commit Graph

161 Commits

Author SHA1 Message Date
Sam Lantinga
19f7bccc32 Fixed bug 2949 - [Android] Virtual DPAD remote not registered
Sylvain

I have an android device to which I try to connect the google virtual remote application.
https://play.google.com/store/apps/details?id=com.google.android.tv.remote

The java method "pollInputDevices()" detects it as an input source 0x701 which is (SOURCE_KEYBOARD | SOURCE_GAMEPAD | SOURCE_DPAD).

It it not added because it does not AND-bitwise with "SOURCE_CLASS_JOYSTICK".
It's only a virtual DPAD and it works when checking also with SOURCE_CLASS_BUTTON
2015-06-16 23:58:09 -07:00
Sam Lantinga
c3f6296f6f Fixed bug 2774 - Android: screen distorted in Landscape after background/foreground
Sylvain

With a Landscape application.
Going to background with Home Key, then foreground.
The screen is distorted.

This has been reported by Samsung. It happens on S5 and Samsung Alpha, see the video attached.

I have captured the following logcat:

V/SDL     (20549): onResume()
V/SDL     (20549): surfaceCreated()
V/SDL     (20549): surfaceChanged()
V/SDL     (20549): pixel format RGB_565
V/SDL     (20549): Window size:1920x1080
I/SDL     (20549): SDL_Android_Init()
I/SDL     (20549): SDL_Android_Init() finished!
V/SDL     (20549): SDL audio: opening device
V/SDL     (20549): SDL audio: wanted stereo 16-bit 22.05kHz, 256 frames buffer
V/SDL     (20549): SDL audio: got stereo 16-bit 22.05kHz, 1764 frames buffer
V/SDL     (20549): onWindowFocusChanged(): true
V/SDL     (20549): onWindowFocusChanged(): false
V/SDL     (20549): onPause()
V/SDL     (20549): nativePause()
V/SDL     (20549): surfaceDestroyed()

Background / Foreground

V/SDL     (20549): onResume()
V/SDL     (20549): surfaceCreated()
V/SDL     (20549): surfaceChanged()
V/SDL     (20549): pixel format RGB_565
V/SDL     (20549): Window size:1080x1920
V/SDL     (20549): surfaceChanged()
V/SDL     (20549): pixel format RGB_565
V/SDL     (20549): Window size:1920x1080
V/SDL     (20549): onWindowFocusChanged(): true
V/SDL     (20549): nativeResume()



This seems to be related to the fact that I have in "AndroidManifest.xml":
android:configChanges="..."
Because of the fields: "orientation" and also "screenSize".


I have looked for another way to solve the issue. Discarding the "surfaceChanged" call, based on the "requestedOrientation" and the new Orientation. It seems to be better.


On my failing test case, the first "surfaceChanged()" is discarded. Sometimes the "focusChanged()" might appear between the two "surfaceChanged()", while the surface is not yet ready. Thus, discarding also the "nativeResume()".

So, for robustness, a call to "nativeResume()" is added at the end of "surfaceChanged()".

Some update:

1/ First I tried, to discard the surface using the current orientation (rather than width / heigh). -> that solve the issue sometimes, but not always.

2/ Samsung Certification now accepts my application that were previously failing.

3/ I personally now owns a Samsung S5, and was able to solve the issue on my side.

4/ I now use the patch and get no complaints from my users. (but I admit, nobody seemed to be complaining before neither...).

5/ I have added a v2 because of a new smart-phone called "Black Berry Passport" that has a square screen of 1440x1440. This screen has a "status bar" so the resolution is in fact : 1440x1308. (as reported by "surfaceChanged").

Problem is: the portrait resolution is in fact a Landscape!

So the "v1" patch is always discarding the "surface" of BlackBerry Passport. Which is terribly bad.


Hence, I added the "v2" patch not to discard the surface when aspect ratio is < 1.20. (BB 1440/1308 is : 1.1009). Which seems fair.
2015-06-16 22:16:35 -07:00
Philipp Wiesemann
2ff0535704 Android: Added deactivated intent filter for testing drop file support. 2015-06-05 19:40:50 +02:00
Philipp Wiesemann
1e002e220b Android: Added missing space in three log messages.
Also fixed a typo and changed tag string to constant.
2015-05-31 19:23:16 +02:00
Ryan C. Gordon
dcd8ca19be Android: Added basic drop file support (thanks, "noxalus"!).
This lets SDL-based apps respond to "Open With" commands properly, as they
can now obtain the requested path via a standard SDL dropfile event.

This is only checked on startup, so apps don't get drop events at any other
time, even if Android supports that, but this is still a definite
improvement.

Fixes Bugzilla #2762.
2015-05-26 20:36:45 -04:00
Philipp Wiesemann
3e0d9b02d6 Android: Fixed touch pressure being out of range.
According to the documentation of Android's MotionEvent, the getPressure() may
return values higher than 1 on some devices. To prevent passing such values into
SDL they are now corrected to 1 in Java before the JNI call (where it is assumed
to be correct).

Currently SDL only sends SDL_FINGERMOTION events if the touch state (position or
pressure) changed. By correcting pressure down to 1 some events may get dropped
in the rare case that only the pressure was changed but was out of range and the
position did not change.
2015-05-22 22:34:08 +02:00
Philipp Wiesemann
c239a3abee Android: Replaced logging tag strings with constant. 2015-05-16 21:15:59 +02:00
Reto Schneider
a81dd20654 Remove trailing spaces in Android source code. 2015-04-08 12:14:36 +02:00
Philipp Wiesemann
6d57df4eb0 Android: Fixed lint warning about order of elements in AndroidManifest.xml. 2015-04-13 20:52:38 +02:00
Philipp Wiesemann
98aaddbdde Android: Fixed calling a getter method twice. 2015-04-08 22:24:33 +02:00
Ryan C. Gordon
b0ad5c3e78 Log Android hardware at startup (thanks, rettichschnidi!).
Fixes Bugzilla #2653.
2015-04-08 01:37:17 -04:00
Joseba García Etxebarria
a00125c9be Cast the result of calling getButtonState to an Integer 2015-04-02 00:55:45 +02:00
Ryan C. Gordon
244550f0d7 Android: more separate-mouse-and-touch work.
This avoids a hint lookup for each mouse event we get by setting a static Java
variable from native code during our hint watcher callback.

Also attempts to do the right thing with mouse buttons if you happen to be
on an API14 (Ice Cream Sandwich, Android 4.0) or later device. We still
target API12 (Honeycomb MR1, Android 3.1) for SDL 2.0.4 though.

This isn't tested, so I'm pushing to see what the Android buildbot says. Stand
back, I'm a professional!
2015-04-01 12:14:56 -04:00
Joseba García Etxebarria
fe4155e517 Renamed SDLGenericMotionListener back to SDLGenericMotionListener_API12 2015-03-27 18:09:51 -04:00
Philipp Wiesemann
728db68685 Android: Removed outdated comment from source. 2015-03-25 22:47:22 +01:00
Joseba García Etxebarria
648ac3e582 * More Android patch work 2015-03-24 21:02:28 +01:00
Joseba García Etxebarria
b1c3794e4b * Improve mouse support in Android. These changes require Android API v12 to compile 2015-03-24 20:45:29 +01:00
Philipp Wiesemann
65ef074256 Fixed wrong comment in implementation for Android. 2015-01-31 10:32:45 +01:00
Philipp Wiesemann
0770f17f4f Fixed bug 2816 - [patch] Android: Expose screen refresh rate
Jonas Kulla

Display::getRefreshRate() is available on all API levels.
2015-01-23 20:29:08 +01:00
Philipp Wiesemann
7758e7c831 Added name for second Java Thread on Android. 2014-11-23 20:35:51 +01:00
Philipp Wiesemann
e97261d145 Fixed bug 2759 - Android findLibrary() returns NULL
Sylvain

extra patch with minor modifications:
- typo
- cancel-able set to false
- add the error message, so that the user can report it.
2014-10-24 11:53:34 +02:00
Philipp Wiesemann
d37316fe5d Added an option to define libraries to be loaded on Android in a derived class.
This way it is no more needed to modify SDLActivity.java to add own libraries.
2014-10-23 16:45:18 +02:00
Philipp Wiesemann
5a0a4d6f56 Fixed alert dialog for not loaded libraries on Android being cancelable.
If the alert dialog could be canceled the Activity would not be finished here.
Also setting the property to "true" would be redundant because that is default.
2014-10-23 16:41:01 +02:00
Philipp Wiesemann
fc4c480457 Fixed missing @Override annotation warning in source for Android. 2014-10-23 16:39:15 +02:00
Philipp Wiesemann
39d104f5f6 Fixed upper case button in alert dialog for not loaded libraries on Android.
This is more consistent with the buttons of other dialogs on Android.
2014-10-23 16:38:03 +02:00
Philipp Wiesemann
45abe97d21 Fixed typo in message of alert dialog for not loaded libraries on Android. 2014-10-23 16:34:48 +02:00
Philipp Wiesemann
402661665d Fixed writing new errors to standard output instead of error output on Android. 2014-10-23 16:33:27 +02:00
Philipp Wiesemann
28e6e9079b Fixed documentation in source for Android. 2014-10-23 16:31:02 +02:00
Gabriel Jacobo
ec40387505 [Android] #2759: Show a message on failure to load a .so library (by Sylvain) 2014-10-21 11:44:35 -03:00
Philipp Wiesemann
ab7bcfc0a3 Fixed setting of screen saver state crashing on some version of Android.
Setting Window flags seems to affect Views and must be handled on UI thread.
2014-10-20 22:19:09 +02:00
Gabriel Jacobo
32120029aa Bug 2739 - [Android] No support for SDL_DisableScreenSaver by Martin Gerhardy 2014-10-20 10:10:39 -03:00
Philipp Wiesemann
fa7abca4ec Fixed bug 2476 - Allow custom main() arguments
rettichschnidi

I would like to pass custom arguments from my Java code (subclass of SDLActivity) to the native SDL2 binary.
2014-10-17 23:36:45 +02:00
Philipp Wiesemann
a992769e0a Fixed broken layout for buttons with configured color in messagebox on Android. 2014-09-25 20:56:27 +02:00
Philipp Wiesemann
87dede4f00 Added setting configured color to button texts for messagebox on Android. 2014-09-24 23:46:46 +02:00
Gabriel Jacobo
c8bc78fd0f [Android] Fixes #2679 - Crash resuming from screen off
Before destroying the static Java-side data, wait for the SDL native thread,
*and* the listener thread that waits on it to trigger a clean up.
2014-09-17 08:59:43 -03:00
Philipp Wiesemann
e13a86c874 Fixed key down closing messagebox dialog instead of key up on Android.
This fixed sending key up event to SDL a dialog closed by down did not consume.
2014-09-14 19:44:53 +02:00
Sam Lantinga
f8f74bdd97 Fixed bug 2415 - Message Boxes aren't implemented on Android
Philipp Wiesemann

I attached a patch for an incomplete implementation of the messagebox parts.

It was not tested on lots of devices yet and features a very fragile workaround to block the calling SDL thread while the dialog is handled on Android's UI thread. Although it works for testmessage.c I assume there are lot of situations were it may fail (standby, device rotation and other changes). Also not all flags and colors are implemented.

On the other hand most uses of the messagebox are to show an error on start and fragility (or working at all) may not matter there.
2014-09-13 02:15:18 -07:00
Philipp Wiesemann
039f06d731 Fixed warning about implicit boxing to Java Object. 2014-08-12 23:33:16 +02:00
Philipp Wiesemann
50b5d62934 Added javadoc comment for consistency. 2014-08-11 23:16:47 +02:00
Sam Lantinga
b69ed39252 Merged changes from Alexey Petruchik to support Android obb files
http://developer.android.com/google/play/expansion-files.html
2014-06-21 20:35:36 -07:00
Sam Lantinga
d2163b6749 Fixed bug 2558 - Missing FINGERUP in Android
Sylvain

If you play with the TouchScreen with +3 fingers randomly / pressing simultaneously all fingers.

You triggers FINGER DOWN events, but not always all the associated FINGER UP events.

So, after a while SDL_GetNumFingers() can report a wrong number of fingers pressed !


The explanation is hidden there : http://developer.android.com/reference/android/view/MotionEvent.html

Each pointer has a unique id that is assigned when it first goes down (indicated by ACTION_DOWN or ACTION_POINTER_DOWN).
A pointer id remains valid until the pointer eventually goes up (indicated by ACTION_UP or ACTION_POINTER_UP) or when the gesture is canceled (indicated by ACTION_CANCEL).

in ACTION_CANCEL :

The current gesture has been aborted. You will not receive any more points in it. You should treat this as an up event, but not perform any action that you normally would.
Constant Value: 3 (0x00000003)
2014-06-15 19:32:39 -07:00
Philipp Wiesemann
3674fe380b Changed two Java nested classes into static nested classes.
Both do not need an implicitly created reference to enclosing class.
2014-06-08 13:14:20 +02:00
Philipp Wiesemann
16a52c4987 Added javadoc comments to document methods used by JNI. 2014-05-29 23:05:18 +02:00
Philipp Wiesemann
98abcdc843 Added javadoc comments to prevent unused parameter warning. 2014-05-29 22:58:06 +02:00
Philipp Wiesemann
d9b9067e85 Fixed implicit boxing and unboxing of Java Objects warning. 2014-05-29 22:53:53 +02:00
stopiccot
09ed1dc424 added comment
--HG--
branch : apk
2014-04-30 23:05:05 +03:00
stopiccot
1e528e6976 access google apk library through reflection
--HG--
branch : apk
2014-04-30 22:51:29 +03:00
stopiccot
17b9ef82d9 Fixing issues discovered by Philipp Wiesemann
--HG--
branch : apk
2014-04-23 03:42:32 +03:00
stopiccot
df6159bfef inital apk extension support
--HG--
branch : apk
2014-04-07 21:20:39 +03:00
Philipp Wiesemann
bb9a20954a Fixed unused local variable warning. 2014-04-05 23:24:33 +02:00