DO NOT MERGE: Fix loss of focus after wakeup into incall screen

Because of the asynchronous behavior of keyguard, and incall explicitly
disabling keyguard, sometimes the window manager would wind up in a state in
which the "correct" app and activity window were shown, but focus was
recalculated "too soon," at a time when keyguard was just about gone but not
quite, and incall was not yet fully shown.  In this case there was no currently
valid event target, but the final show of the incall window would not prompt a
focus recalculation, so that "no current focus" state would incorrectly persist,
resulting in spurious ANRs until some other phone activity forced a focus
update.

We now detect the problematic case when windows are shown, and make sure to
recalculate focus explicitly thereafter.  This change does *not* fix the
underlying race conditions that have been resulting in mismatched state within
the window manager, but it does force a validation pass that puts things in
order so that normal operation can continue.

Change-Id: I8e7f5f0795f0042a0da074aeed385e3fbc210360
1 file changed