Closed Bug 730145 Opened 12 years ago Closed 12 years ago

Fennec does not stop running if app window is closed when VKB is open

Categories

(Firefox for Android Graveyard :: Keyboards and IME, defect, P2)

ARM
Android
defect

Tracking

(firefox13 affected, firefox14 verified, blocking-fennec1.0 +)

VERIFIED FIXED
Firefox 14
Tracking Status
firefox13 --- affected
firefox14 --- verified
blocking-fennec1.0 --- +

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

(Keywords: perf)

STR:
1. Load google.com
2. Touch text input form to open VKB
3. Press Home button to close app window and return to home screen

ER:
Fennec should stop running.

AR:
adb logcat and top report that Fennec is still running in the background, logging "endDrawing" forever:

...
I/GeckoSoftwareLayerClient( 4561): zerdatime 202492620 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202493121 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202493619 - endDrawing
I/ActivityManager(  197): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 197
D/cp      ( 4561): GeckoApp: onPause
I/GeckoApp( 4561): pause
I/WindowManager(  197): createSurface Window{421255d0 com.android.launcher/com.android.launcher2.Launcher paused=false}: DRAW NOW PENDING
I/GeckoSoftwareLayerClient( 4561): zerdatime 202494116 - endDrawing
D/GeckoInputConnection( 4561): IME: handleCreateInputConnection called
D/GeckoInputConnection( 4561): IME: reset
W/IInputConnectionWrapper( 4561): showStatusIcon on inactive InputConnection
I/LatinIME(  413): InputType.TYPE_NULL is specified
W/LatinIME(  413): Unexpected input class: inputType=0x00000000 imeOptions=0x00000000
I/GeckoSoftwareLayerClient( 4561): zerdatime 202494626 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202495122 - endDrawing
D/cp      ( 4561): GeckoApp: onStop
I/GeckoApp( 4561): stop
I/GeckoSoftwareLayerClient( 4561): zerdatime 202495607 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202496105 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202496603 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202497099 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202497599 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202498100 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202498598 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202499099 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202499598 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202500098 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202500593 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202501092 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202501596 - endDrawing
I/GeckoSoftwareLayerClient( 4561): zerdatime 202502096 - endDrawing
...
Keywords: perf
Reproduced on 3-8-2012 build.  endDrawing is infinite!
blocking-fennec1.0: --- → ?
The endDrawing is probably coming from the redraws happening as the cursor blinks on and off. For some reason the pause event isn't preventing that from happening, but I don't know enough about that code to know why.
Assignee: nobody → cpeterson
Triage, this bug needs a priority.
What I understand from bug 733411, comment 6 is that Fennec is supposed to stay running after closing the app window after tapping on the Android Home button.
When an Android activity is backgrounded BUT STILL VISIBLE on screen, onPause() is called and the activity should stop animations and other things that may be consuming CPU.

When an activity is backgrounded AND NO LONGER VISIBLE, onStop() is called and the activity should stop everything.

https://developer.android.com/guide/topics/fundamentals/activities.html#ImplementingLifecycleCallbacks
blocking-fennec1.0: ? → +
Priority: -- → P2
Component: General → IME
ajuma, blassey suspects this "IME won't stop redrawing" bug may be related to a gfx bug you are working on. Does that sound familiar?

Or does this bug sound more like the "timers are not suspended when app is backgrounded" problem described in bug 735246?
Assignee: cpeterson → ajuma
(In reply to Chris Peterson (:cpeterson) from comment #6)
> ajuma, blassey suspects this "IME won't stop redrawing" bug may be related
> to a gfx bug you are working on. Does that sound familiar?

The gfx bug (Bug 735230) is related to this one in the sense that this bug is one of the causes of the gfx bug (that is, this bug causes us to continue to draw, which, until Bug 735230 is fixed, leads to a texture upload). 

Preventing the draw events from occurring at all in this situation, while still allowing Gecko to run in the background (which, according to the comments in Bug 735246, is actually the desired behaviour), could be accomplished by, say, hiding the VKB before Gecko goes into the background. But that would just be a band-aid fix for this particular problem (since, for example, it wouldn't solve the problem of the currently displayed page executing a script that repeatedly triggers drawing even when the app is in the background).
Assignee: ajuma → cpeterson
A better solution (which might end up being part of the fix for Bug 735320) would be for nsWindow to simply abort draw events while we're in the background. This, of course, still won't stop whatever is triggering the drawing in the first place from running, but would fix all instances of draw events actually being executed while in the background.
(In reply to Ali Juma [:ajuma] from comment #8)
> A better solution (which might end up being part of the fix for Bug 735320)

That should be Bug 735230.
I believe bug 735230 (which landed on m-c just 3 hours ago) fixed this problem. I can reproduce this on m-a, but I am no longer able to reproduce this problem on m-c.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Verified/fixed on:
Nightly Fennec 14.0a1 (2012-04-01)
Device: Samsung Nexus S
OS: Android 2.3.6
Status: RESOLVED → VERIFIED
Depends on: 735230
Target Milestone: --- → Firefox 14
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.