Commit Graph

9 Commits (dd8c64779b0074b31da0e092759eb3d3c73fecbe)

Author SHA1 Message Date
Sam Lantinga 5db002bb1e 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 33ed20fafa 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 c3186d5ee9 Android: Added deactivated intent filter for testing drop file support. 2015-06-05 19:40:50 +02:00
Philipp Wiesemann dbfd4fdd22 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 72a244da41 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 1968ff0471 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 f7ac02010f Android: Replaced logging tag strings with constant. 2015-05-16 21:15:59 +02:00
Reto Schneider e5f9c347ef Remove trailing spaces in Android source code. 2015-04-08 12:14:36 +02:00
Ryan C. Gordon b72938c861 Windows: Always set the system timer resolution to 1ms by default.
An existing hint lets apps that don't need the timer resolution changed avoid
this, to save battery, etc, but this fixes several problems in timing, audio
callbacks not firing fast enough, etc.

Fixes Bugzilla #2944.
2015-04-20 12:22:44 -04:00