Make input dispatcher only ANR for foreground windows.

Redesigned the input dispatcher's ANR timeout mechanism so it is much
closer to Froyo's policy.  ANR is only ever signalled if the dispatcher
is waiting on a window to finish processing its previous event(s) and
there is new pending input.

In the old code, we tracked the dispatch timeout separately for each
input channel.  This was somewhat complicated and also resulted in the
situation where applications could ANR long after the user had pushed
them into the background.

Change-Id: I666ecada0952d4b95f1d67b9f733842b745c7f4b
This commit is contained in:
Jeff Brown
2010-09-15 15:18:56 -07:00
parent 3fd5fa4ca9
commit 519e024d1e
6 changed files with 387 additions and 660 deletions

View File

@@ -27,6 +27,9 @@ public final class InputWindow {
// The input channel associated with the window.
public InputChannel inputChannel;
// The window name.
public String name;
// Window layout params attributes. (WindowManager.LayoutParams)
public int layoutParamsFlags;
public int layoutParamsType;
@@ -55,6 +58,9 @@ public final class InputWindow {
// Window is visible.
public boolean visible;
// Window can receive keys.
public boolean canReceiveKeys;
// Window has focus.
public boolean hasFocus;
@@ -64,6 +70,9 @@ public final class InputWindow {
// Input event dispatching is paused.
public boolean paused;
// Window layer.
public int layer;
// Id of process and user that owns the window.
public int ownerPid;
public int ownerUid;