diff options
| author | Dianne Hackborn <hackbod@google.com> | 2017-12-15 15:44:55 -0800 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2017-12-15 15:50:27 -0800 |
| commit | 011944c7598ea9524b0d38e7806ee2de1db3a04a (patch) | |
| tree | 518dbf69323487bb200e15430e2f050cff8e5b14 /core/java/android/view/ViewRootImpl.java | |
| parent | 50a716b03e2847f04e824a925167fc6b48410b0a (diff) | |
Fix issue #70722141: Fix broken WindowTest.testSetLocalFocus
We need to make sure to dispatch every focus change, even if
the focus itself doesn't actually change.
Bug: 70722141
Test: bit CtsViewTestCases:WindowTest\#testSetLocalFocus
Change-Id: I12f4b18b93516f3bf03fb0d4a897a968cda65f41
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 3f8da093487b..2c82ac49c84e 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -327,6 +327,8 @@ public final class ViewRootImpl implements ViewParent, // This is used to reduce the race between window focus changes being dispatched from // the window manager and input events coming through the input system. @GuardedBy("this") + boolean mWindowFocusChanged; + @GuardedBy("this") boolean mUpcomingWindowFocus; @GuardedBy("this") boolean mUpcomingInTouchMode; @@ -2472,14 +2474,14 @@ public final class ViewRootImpl implements ViewParent, final boolean hasWindowFocus; final boolean inTouchMode; synchronized (this) { + if (!mWindowFocusChanged) { + return; + } + mWindowFocusChanged = false; hasWindowFocus = mUpcomingWindowFocus; inTouchMode = mUpcomingInTouchMode; } - if (mAttachInfo.mHasWindowFocus == hasWindowFocus) { - return; - } - if (mAdded) { profileRendering(hasWindowFocus); @@ -7181,6 +7183,7 @@ public final class ViewRootImpl implements ViewParent, public void windowFocusChanged(boolean hasFocus, boolean inTouchMode) { synchronized (this) { + mWindowFocusChanged = true; mUpcomingWindowFocus = hasFocus; mUpcomingInTouchMode = inTouchMode; } |
