As for calling finish() in onStop() -- you can call finish() at any time. (Well, not after onDestroy().) And in fact it would be hard for doing this in onStop() to directly cause an ANR, since by this time the activity that is executing onStop() no longer has input focus so *can't* ANR because of something happening then.
mKeyWaiter.waitForNextEventTarget not returning... well, yeah, that is what happens when there is an ANR. The window manager has dispatched an event, is waiting for the application to process it, and ends up waiting for more than 5 seconds. ANR. That's what that function is doing.
--
Dianne Hackborn
Android framework engineer
hackbod@android.com
Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them.
-- On Sat, Jul 31, 2010 at 7:30 PM, James Wang <jameswangcnln@gmail.com> wrote:
@TreKing
Thanks for your replies. We do have some reasons to call finish
because Android did not finish one when another is shown before it.
>Probably, but with your code, not Android.Document does not say finish is not allowed to be called at onStop.
How to explain there is no problem with calling finish just after
startActivity.
@Dianne
Thanks for your replies. We do believe it is a problem with framework.
WindowManagerService.java:
private int dispatchPointer(QueuedEvent qev, MotionEvent ev, int
pid, int uid) {
if (DEBUG_INPUT || WindowManagerPolicy.WATCH_POINTER)
Log.v(TAG,
"dispatchPointer " + ev);
if (MEASURE_LATENCY) {
lt.sample("3 Wait for last dispatch ", System.nanoTime() -
qev.whenNano);
}
Object targetObj = mKeyWaiter.waitForNextEventTarget(null,
qev,
ev, true, false, pid, uid);
When calling finish() after startActivity,
mKeyWaiter.waitForNextEventTarge returns activity A. And after
checking A.isVisibleLW(), the key up event is discarded successfully.
When calling finish() at onStop, ANR happens in
mKeyWaiter.waitForNextEventTarge and it is seems never get out.
James
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Dianne Hackborn
Android framework engineer
hackbod@android.com
Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them.
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment