hushaojie04 / libgdx

Automatically exported from code.google.com/p/libgdx
0 stars 0 forks source link

LiveWallpaper Backend Lifecycle Broken (onVisibilityChanged) #1110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Overview: When setting the wallpaper, it seems to create 2 engines (as 
expected) but the engine now running on the homescreen never receives a call to 
onVisibilityChanged so never pauses when it should (i.e. when you open an app). 

How to recreate: Preview wallpaper, set wallpaper. Now try triggering a 
visibilityChange (open another app) which should pause the engine. There is no 
call to onVisibilityChanged so the engine continues running.

If you turn the screen off, it sends a broadcast intent to the 
WallpaperService, the system detects ANR and restarts the wallpaper service, 
creates only 1 engine and works fully as expected.

On ICS, behavior is similar, but after you set wallpaper you just get a black 
homescreen and an IllegalArgumentException from the windowmanager. Works fine 
after the screen off/ANR/restart cycle as with gingerbread.

I've attached logs for GB and JB (ICS has the same problem as JB)

This code is probably what catches the rogue engine under ICS+
http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/an
droid/4.1.1_r1/android/service/wallpaper/WallpaperService.java/?v=diff&id2=2.3_r
1#713

Could this be because the second engine gets created before the first is paused?

Original issue reported on code.google.com by opotech...@gmail.com on 1 Nov 2012 at 8:32

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the report, i'm able to reproduce this on my Galaxy Nexus with 4.1. 
I'll try to find a fix for it.

Original comment by badlogicgames on 2 Nov 2012 at 12:53

GoogleCodeExporter commented 9 years ago
I fixed a couple of things, and tested on ICS and GB. Everything seems to work 
as expected now! Please give it a try, if you run into related issues i'll 
reopen this issue.

Original comment by badlogicgames on 3 Nov 2012 at 1:33