Author Topic: Lifecycle Bugfixes and Improvements  (Read 38587 times)

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Lifecycle Bugfixes and Improvements
« on: September 07, 2013, 08:08:08 AM »
Littleguy has done another great series of updates to improve the app lifecycle and fix a long-standing bug that was preventing collection of useful logs from the game activity in the crash report system in cases where the app doesn't crash in the game activity.  This round of testing will need to include a variety of devices and Android versions:

Lifecycle Test #4

What needs to be tested:

Basically any scenario of leaving and returning to the app you can think of.  The following have been tested by Littleguy so far on Android 2.3.3 Xperia Play and Android 4.3 Nexus 7:

1) User exits game activity from menu, then relaunches the game activity from the play menu

2) User presses home button, then relaunches the app (should return to the game activity, right where they left off). This should be equivalent to receiving a phone call then resuming.

3) User presses power button, then wakes and unlocks the phone (should return to the game activity, right where they left off)

All three scenarios work fine on the Play. The last scenario doesn't quite work properly on the Nexus 7 -- graphics are frozen while the audio/input/core resume and continue running.  I'll be testing on my devices and posting the results later today.
« Last Edit: October 06, 2013, 04:28:48 PM by Paul »
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline xperia64

  • Moderator
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: Lifecycle Bugfixes and Improvements
« Reply #1 on: September 07, 2013, 10:08:22 AM »
Galaxy S2 4.2.2: Scenarios 1&2 work. After unlocking scenario 3 causes the on screen controls to disappear, followed by a crash. (Log included)
Get the same behavior on my 2013 Nexus 7 4.3 as the previous test. (log2). Switching very quickly between pause and play may still cause a crash.
Motorola Droid (2.2.2): All 3 scenarios work.
« Last Edit: September 07, 2013, 10:35:02 AM by xperia64 »

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #2 on: September 07, 2013, 12:20:13 PM »
Thanks xperia64!  Both crashes are related to the input-android plugin.  Looks like it had problems calling the init methods a second time through.  I didn't see this on any of my devices, but one of the things on my todo list will probably solve it as a side-effect.

Code: [Select]
I/GameLifecycleTracker(15759): onStart
I/ae-bridge(15759): Loading native libraries
I/GameLifecycleTracker(15759): onResume
I/GameLifecycleTracker(15759): onWindowFocusChanged: true
D/dalvikvm(15759): Trying to load lib /data/data/paulscode.android.mupen64plusae/lib/libinput-android.so 0x411570b0
D/dalvikvm(15759): Shared lib '/data/data/paulscode.android.mupen64plusae/lib/libinput-android.so' already loaded in same CL 0x411570b0 (not a problem)
I/input-android(15759): jniInitInput()
F/libc    (15759): Fatal signal 11 (SIGSEGV) at 0x58b8cde0 (code=1), thread 15852 (CoreThread)
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Tom.K

  • Green Team
  • long
  • *
  • Posts: 130
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #3 on: September 07, 2013, 08:03:42 PM »
X10 Mini Pro 2.3.7: All 3 scenarios work normal for me. However, second scenario might cause either a game reset or blank screen in case that process is killed due to low RAM in my case. There is no scenario to test resuming the game if process gets killed, so that's not really important.

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #4 on: September 07, 2013, 09:10:37 PM »
Thanks Tom for checking and making the point about the process kill.  I can probably simulate the process kill through the developer tools to at least get some validation on a few devices.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Lifecycle Bugfixes and Improvements
« Reply #5 on: September 07, 2013, 09:33:28 PM »
On my Galaxy Nexus with Android 4.2.2, and my wife's Droid Razr with Android 4.1.2 it behaves flawlessly.  I tried multiple scenareos, including actual phone call, alarm clock, switching windows, pressing home and returning, and pressing power then unlocking.  I didn't have a chance to play around with the OUYA yet, so I'll do that tomorrow.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #6 on: September 07, 2013, 09:43:39 PM »
Cool.

Started looking at xperia64's issue tonight.  Actually it's a head scratcher, came out of left field.  Especially surprising considering we are both running Android 4.3.  Possibly a race condition, possibly some other things.

2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #7 on: September 07, 2013, 09:55:34 PM »
Just posted a simple test-fix for xperia64's case.  Might not solve the problem, but would be good to eliminate some obvious stuff first.

You mind posting another build Paul, and testing again xperia?  Thanks...
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Lifecycle Bugfixes and Improvements
« Reply #8 on: September 08, 2013, 08:05:34 AM »
Here you go:

Lifecycle Test #2
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline xperia64

  • Moderator
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: Lifecycle Bugfixes and Improvements
« Reply #9 on: September 08, 2013, 09:40:20 AM »
On my N7 with scenario 3, sometimes it crashes, sometimes it hangs.
Hang:
Code: [Select]
I/Core    ( 2662): Setting video mode: 1200x900
I/GameSurface( 2662): Creating GL context
V/GameSurface( 2662): Found EGL display connection
V/GameSurface( 2662): Initialized EGL display connection
V/GameSurface( 2662): Found compatible EGL frame buffer configuration
V/GameSurface( 2662): Created EGL rendering context
E/BufferQueue(  194): [SurfaceView] connect: already connected (cur=1, req=1)
E/libEGL  ( 2662): EGLNativeWindowType 0x743f3338 already connected to another A
PI
E/libEGL  ( 2662): eglCreateWindowSurface:376 error 300b (EGL_BAD_NATIVE_WINDOW)

E/GameSurface( 2662): Failed to create EGL window surface
V/GameSurface( 2662): Already destroyed EGL window surface
V/GameSurface( 2662): Destroyed EGL rendering context
V/GameSurface( 2662): Terminated EGL display connection
E/GameSurface( 2662): Failed to create GL context
W/CoreInterfaceNative( 2662): Retrying GL context creation without EGL_BUFFER_SI
ZE=16
I/GameSurface( 2662): Creating GL context
V/GameSurface( 2662): Found EGL display connection
V/GameSurface( 2662): Initialized EGL display connection
V/GameSurface( 2662): Found compatible EGL frame buffer configuration
V/GameSurface( 2662): Created EGL rendering context
E/BufferQueue(  194): [SurfaceView] connect: already connected (cur=1, req=1)
E/libEGL  ( 2662): EGLNativeWindowType 0x743f3338 already connected to another A
PI
E/libEGL  ( 2662): eglCreateWindowSurface:376 error 300b (EGL_BAD_NATIVE_WINDOW)

E/GameSurface( 2662): Failed to create EGL window surface
V/GameSurface( 2662): Already destroyed EGL window surface
V/GameSurface( 2662): Destroyed EGL rendering context
V/GameSurface( 2662): Terminated EGL display connection
E/GameSurface( 2662): Failed to create GL context
W/CoreInterfaceNative( 2662): Retrying GL context creation using legacy settings

I/GameSurface( 2662): Creating GL context
V/GameSurface( 2662): Found EGL display connection
V/GameSurface( 2662): Initialized EGL display connection
V/GameSurface( 2662): Found compatible EGL frame buffer configuration
V/GameSurface( 2662): Created EGL rendering context
E/BufferQueue(  194): [SurfaceView] connect: already connected (cur=1, req=1)
E/libEGL  ( 2662): EGLNativeWindowType 0x743f3338 already connected to another A
PI
E/libEGL  ( 2662): eglCreateWindowSurface:376 error 300b (EGL_BAD_NATIVE_WINDOW)

E/GameSurface( 2662): Failed to create EGL window surface
V/GameSurface( 2662): Already destroyed EGL window surface
V/GameSurface( 2662): Destroyed EGL rendering context
V/GameSurface( 2662): Terminated EGL display connection
E/GameSurface( 2662): Failed to create GL context
E/Core    ( 2662): SDL_SetVideoMode failed: Couldn't create OpenGL context - see
 Android log for details
E/Video   ( 2662): Error setting display mode
I/Audio   ( 2662): Initializing SDL audio subsystem...
V/SDL     ( 2662): SDL audio: opening device
W/InputMethodManagerService(  568): Window already focused, ignoring focus gain
of: com.android.internal.view.IInputMethodClient$Stub$Proxy@422c9408 attribute=a
ndroid.view.inputmethod.EditorInfo@424ddeb8, token = android.os.BinderProxy@425e
6d58
I/Core    ( 2662): Starting R4300 emulator: Dynamic Recompiler
I/Core    ( 2662): Init new dynarec
V/TAG     (  568): bug 7643792: fitSystemWindows([0,0][0,0])
D/dalvikvm( 2662): threadid=17: thread exiting, not yet detached (count=0)
V/SDL     ( 2662): SDL audio: opening device
D/Core    ( 2662): State loaded from: Super Mario 64.z64.sav

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #10 on: September 08, 2013, 09:46:49 AM »
Ok, that matches the issue I see in my 2012 Nexus 7.

No more issues with the JNI input initialization then?
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline xperia64

  • Moderator
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: Lifecycle Bugfixes and Improvements
« Reply #11 on: September 08, 2013, 09:51:52 AM »
Not sure. With SM64 it would hang but with banjo-kazooie it would crash (see log2.txt.bz2 in the previous post)

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #12 on: September 08, 2013, 07:15:16 PM »
Ah, I see.  Maybe I can replicate the problem then.  I was just using SM64.

The problem with the sleep cycle on 4.3 seems to be that the gl context isn't getting destroyed properly.  On 2.3.3 it's fine.  Android lifecycle differences or something, will have to look closely.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Vincentmrl

  • Cyan Team
  • long
  • *
  • Posts: 121
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #13 on: September 11, 2013, 04:25:02 AM »
On Xperia U depends what game, the emu crashes or not in scenario 3
SM64: Scenario 3 works all fine, game continues where I left it
SSB: Scenario 3 crashes, some milliseconds before I see the controls on the left side of the screen in portrait mode (even if I was in landscape mode) and sends me back to resume/restart screen.

I did only that test for now, I will do the others on this and my old optimus one. My phone is running 4.0.4, CM9 (freexperia)
Device: Lg Optimus One
CPU: 600 Mhz ARMv6 (Overclocked to 748Mhz ondemand governor)
GPU: Qualcomm Adreno 200
RAM: 512 MB
Resolution: 320 x 480
Rom: Unofficial Cyanogenmod 9

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Lifecycle Bugfixes and Improvements
« Reply #14 on: September 11, 2013, 06:25:00 AM »
Thanks Vincent :)

Was doing some more testing last night and discovered some differences in the shutdown process between the different video plugins.  Running gles2n64, I was able to correctly pass scenario 3 on my Nexus 7, whereas the other two plugins I could not.  So I still have a bit of digging left to fully uncover the right solution.

Also found some more ways to streamline the interface between the Java and native sides, so the bridge and Java functions are tightening up.  Once the remaining bugs are worked out I think this will make it quite a bit easier to develop the version 3 front-end... more modularity, less complexity.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version