'SDLActivity' terminated after a screen unlock

Hi to all,

I experience a weird behavior in my android SDL2 game.
I use the latest SDL2 code/drivers with Win7 64 and latest android NDK.

The game runs fine (without this behavior) on most android phones /
tablets.

However, on some models (Most of the time Samsung, like Galaxy S3):
It terminates the ‘SDLActivity’ of the game when the user comes back from
a screen lock (when locked during the game).
This does not happen when the user presses the android ‘home’ button and
then back on the game.
It only happens when the lock screen button (at the top of the phone) is
pressed during the game and then repressed and phone unlocked.
St that time most of the times the game is already closed and some times
the game shows a blank screen until its closed.
I don’t see any crash in the log files only these:

01-30 14:24:15.475 V/yamaha::media::VolumeCtrl( 1716):
VolumeCtrl::setVolume()
01-30 14:24:15.475 D/yamaha::media::VolumeCtrl( 1716):
VolumeCtrl::setVolume() FM Playback: Ready
01-30 14:24:15.475 D/yamaha::media::VolumeCtrl( 1716):
VolumeCtrl::setVolume() VoiceCall: Ready
01-30 14:24:15.475 I/ActivityManager( 1882): Process app.processName (pid
19091) has died.
01-30 14:24:15.475 W/ActivityManager( 1882): Force removing r: app died,
no saved state
01-30 14:24:15.480 I/SurfaceFlinger( 1713): id=1036(249) createSurface
(1600x1280),-1 flag=20000, BlackSurface
01-30 14:24:15.480 W/InputDispatcher( 1882): channel ~ Consumer closed
input channel or an error occurred.A events=0x8
01-30 14:24:15.480 E/InputDispatcher( 1882): channel ~ Channel is
unrecoverably broken and will be disposed!
01-30 14:24:15.495 I/SurfaceFlinger( 1713): id=1037(250) createSurface
(800x2560),-1 flag=20000, BlackSurface
01-30 14:24:15.510 I/SurfaceFlinger( 1713): id=1038(251) createSurface
(1600x1280),-1 flag=20000, BlackSurface
01-30 14:24:15.530 I/SurfaceFlinger( 1713): id=1039(252) createSurface
(800x2560),-1 flag=20000, BlackSurface
01-30 14:24:15.530 I/powerA A ( 1882): *** acquire_dvfs_lock : lockType :
1A freq : 1400000
01-30 14:24:15.530 I/SurfaceFlinger( 1713): id=1029 Removed SurfaceView
idx=0 Map Size=4
01-30 14:24:15.530 I/SurfaceFlinger( 1713): id=1029 Removed SurfaceView
idx=-2 Map Size=4
01-30 14:24:15.530 D/PowerManagerService( 1882): acquireDVFSLockLocked :
type : DVFS_MIN_LIMITA frequency : 1400000A uid : 1000A pid : 1882A
tag : ActivityManager
01-30 14:24:15.530 W/ActivityManager( 1882): mDVFSLock.acquire()
01-30 14:24:15.530 I/WindowManager( 1882): WIN DEATH: win
01-30 14:24:15.535 W/InputDispatcher( 1882): Attempted to unregister
already unregistered input channel
01-30 14:24:15.535 I/SurfaceFlinger( 1713): id=1028 Removed SDLActivity
idx=0 Map Size=3
01-30 14:24:15.535 I/SurfaceFlinger( 1713): id=1028 Removed SDLActivity
idx=-2 Map Size=3
01-30 14:24:15.535 I/SurfaceFlinger( 1713): id=1028 Removed SDLActivity
idx=-2 Map Size=3
01-30 14:24:15.535 I/SurfaceFlinger( 1713): id=1029 Removed SurfaceView
idx=-2 Map Size=3
01-30 14:24:15.535 I/WindowManager( 1882): WIN DEATH: win
01-30 14:24:15.535 I/WindowManager( 1882): WINDOW DIED windowState
01-30 14:24:15.545 D/Launcher( 2167): onRestart
01-30 14:24:15.545 D/Launcher( 2167): onStart
01-30 14:24:15.545 D/Launcher.HomeFragment( 2167): onStart
01-30 14:24:15.545 D/Launcher( 2167): onResume
01-30 14:24:15.545 E/Launcher( 2167): Error finding setting, default
accessibility to not found: accessibility_enabled
01-30 14:24:15.545 D/Launcher.HomeFragment( 2167): onResume
01-30 14:24:15.545 D/MenuAppsGridFragment( 2167): onResume
01-30 14:24:15.545 E/ActivityManager( 1882): MANGAL
broadcastIntent()INTENT—>1:Intent {
act=com.sec.android.intent.action.HOME_RESUME }
01-30 14:24:15.545 E/ActivityManager( 1882): MANGAL INTENT:Intent {
act=com.sec.android.intent.action.HOME_RESUME }
01-30 14:24:15.545 E/ActivityManager( 1882): MANGAL INTENT—>:Intent {
act=com.sec.android.intent.action.HOME_RESUME }
01-30 14:24:15.545 E/ActivityManager( 1882): MANGAL
broadcastIntent()INTENT—>2:Intent {
act=com.sec.android.intent.action.HOME_RESUME }
01-30 14:24:15.545 E/ActivityManager( 1882): MANGAL
broadcastIntent()callingPid:2167 callingUid:10067 origId:43237435770999
01-30 14:24:15.590 I/SurfaceFlinger( 1713): id=1040(61) createSurface
0x3f5fc (800x1232),1 flag=0, Launcher
01-30 14:24:15.630 I/powerA A ( 1882): *** release_dvfs_lock : lockType :
1

Anyone can help me out? Any ideas?

Thanks,
Giorgos

Hi Giorgos,

I had this problem too. Solution was to have:

android:configChanges=“keyboardHidden|orientation”

in my activity in AndroidManifest.xml.

Hope this helps,
Philip.

I already have this on my manifest!

Giorgos> ----- Original Message -----

Subject: Re: [SDL] ‘SDLActivity’ terminated after a screen unlock
From: pmacfarlane
To: sdl@lists.libsdl.org
Date: 04/02/2013 16:46

Hi Giorgos,

I had this problem too. Solution was to have:

android:configChanges=“keyboardHidden|orientation”

in my activity in AndroidManifest.xml.

Hope this helps,
Philip.


SDL mailing list
SDL@lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I found out that it does this bug/behavior in all android models every
time.

Reproduce:

  1. In manifest set only landscape: android:screenOrientation="landscape"
    android:configChanges=“keyboardHidden|orientation”
  2. Start the app.
  3. Lock the screen with the lock screen hard button (top left button most
    of the times).
  4. Wait a few seconds and press the activate hard button (lock/unlock
    screen button) and see the android unlock screen. (still in landscape)
  5. Before unlocking the screen, rotate device to portrait.
  6. When in portrait unlock the screen.

Then the app is already closed automatically.

All I get is this in the logs:
02-05 11:39:19.066: D/OpenGLRenderer(1031): Flushing caches (mode 0)

Thanks,> ----- Original Message -----

Subject: Re: [SDL] ‘SDLActivity’ terminated after a screen unlock
From: Giorgos Sarris
To: sdl@lists.libsdl.org
Date: 04/02/2013 18:08

I already have this on my manifest!

Giorgos

-------- Original Message --------
Subject: Re: [SDL] ‘SDLActivity’ terminated after a screen unlock
From: pmacfarlane
To: sdl@lists.libsdl.org
Date: 04/02/2013 16:46

Hi Giorgos,

I had this problem too. Solution was to have:

android:configChanges="keyboardHidden|orientation"

in my activity in AndroidManifest.xml.

Hope this helps,
Philip.

SDL mailing list
SDL@lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL@lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I found the solution.
Its an android bug:

It works if you change in manifest:
android:launchMode="singleTask"
android:configChanges="orientation|screenSize"
android:screenOrientation=“landscape”

This works only if your SDK is above 3.2.
But you can target android:minSdkVersion=“8” if you want.

Thanks.> ----- Original Message -----

Subject: Re: [SDL] ‘SDLActivity’ terminated after a screen unlock
From: Giorgos Sarris
To: SDL Development List , SDL Development List
Date: 05/02/2013 11:48

I found out that it does this bug/behavior in all android models every
time.

Reproduce:

  1. In manifest set only landscape: android:screenOrientation="landscape"
    android:configChanges=“keyboardHidden|orientation”
  2. Start the app.
  3. Lock the screen with the lock screen hard button (top left button
    most of the times).
  4. Wait a few seconds and press the activate hard button (lock/unlock
    screen button) and see the android unlock screen. (still in landscape)
  5. Before unlocking the screen, rotate device to portrait.
  6. When in portrait unlock the screen.

Then the app is already closed automatically.

All I get is this in the logs:
02-05 11:39:19.066: D/OpenGLRenderer(1031): Flushing caches (mode 0)

Thanks,

-------- Original Message --------
Subject: Re: [SDL] ‘SDLActivity’ terminated after a screen unlock
From: Giorgos Sarris
To: sdl@lists.libsdl.org
Date: 04/02/2013 18:08

I already have this on my manifest!

Giorgos

-------- Original Message --------
Subject: Re: [SDL] 'SDLActivity' terminated after a screen unlock
From: pmacfarlane
To: sdl@lists.libsdl.org
Date: 04/02/2013 16:46

  Hi Giorgos,

  I had this problem too. Solution was to have:

  android:configChanges="keyboardHidden|orientation"

  in my activity in AndroidManifest.xml.

  Hope this helps,
  Philip.

SDL mailing list
SDL@lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL@lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL@lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Giorgos,

Thanks for posting the solution. I’ll make this change too, since I’m presumably vulnerable to this bug.

Cheers,
Philip.