We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3554 - Android sensorLandscape|sensorPortrait mode and Power Button
Summary: Android sensorLandscape|sensorPortrait mode and Power Button
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: All Android (All)
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-11 10:17 UTC by dmuratshin
Modified: 2017-01-18 15:49 UTC (History)
1 user (show)

See Also:


Attachments
fix patch (1.43 KB, application/mbox)
2017-01-11 10:17 UTC, dmuratshin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dmuratshin 2017-01-11 10:17:47 UTC
Created attachment 2673 [details]
fix patch

I attached fix for Android


bug could be reproduced if you use SENSER_* mode in AndroidManifest.xml
when you press Power Button -> app pauses and then immediately resumes

logcat:

01-11 14:25:50.273: V/SDL(18690): onPause()
01-11 14:25:50.273: V/SDL(18690): nativePause()

01-11 14:25:50.863: D/ViewRootImpl(18690): MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
01-11 14:25:50.903: D/mali_winsys(18690): EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1440x2560]-format:1

01-11 14:25:50.933: V/SDL(18690): surfaceChanged()
01-11 14:25:50.933: V/SDL(18690): pixel format RGB_565
01-11 14:25:50.933: V/SDL(18690): Window size: 1440x2560
01-11 14:25:50.943: V/SDL(18690): nativeResume()
01-11 14:25:50.993: V/SDL(18690): onWindowFocusChanged(): false
Comment 1 Sylvain 2017-01-11 17:24:45 UTC
Hi, can you tell how you use "SENSOR_* mode in AndroidManifest.xml" ?
And which device you use.
Comment 2 dmuratshin 2017-01-11 17:37:12 UTC
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="......"
      android:versionCode="9999"
      android:versionName="0.9.999"
      android:installLocation="auto">

    <application android:label="@string/app_name"
                 android:icon="@drawable/ic_launcher"
                 android:allowBackup="true"
                 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                 android:hardwareAccelerated="true" >

        <activity android:name="com.alisagaming.slots.MainActivity"
                  android:label="@string/app_name"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                  android:screenOrientation="sensorLandscape">



Galaxy S7
Comment 3 Sylvain 2017-01-11 18:45:02 UTC
Thanks for the fast answer.

For the record, the code you modified comes from Bug #2774.
Because sometimes the onSurfaceChanged() is called with inversed width/height.
and it produced (for me) some screen distortion.


I also have a S7, but see no crash. (I tried with no screen lock and with sensor_landscape, I only see a screen glitch)

Though, I think your patch is relevant and could be applied !
Comment 4 dmuratshin 2017-01-11 18:49:17 UTC
it is not  crashing, application wakeups and works even with turned off display
Comment 5 Sylvain 2017-01-11 18:54:07 UTC
ok, sorry! your patch makes sense anyway!
Comment 6 Sam Lantinga 2017-01-12 18:59:19 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/ba1da2658d76
Comment 7 Sylvain 2017-01-18 15:49:29 UTC
Just to want to let you know that I have looked again at the issue because I wanted to remove the "skip" portion of java code which seems device-dependant, but I couldn't, this is really needed.

Though, I found out a new issue: there is a screen glitch when resuming a landscape application, after un-locking the phone. See bug #3562.
Maybe you could test with your android application! Thanks.