Recover simpler WM lock in REPORT_FOCUS_CHANGE

This CL follows up previous CLs [1][2][3] to recover the original
simplicity regarding WM lock handling in REPORT_FOCUS_CHANGE handler.

What happened are:

 1. The first CL [1] introduced an IPC that can be issued while WM
    holds its global lock in the REPORT_FOCUS_CHANGE handler, which
    ended up causing dead lock between WM and ViewRootImpl.

 2. The second CL [2] addressed the above dead lock by temporarily
    releasing WM lock when issuing IPC from WM to ViewRootImpl.

 3. The third CL [3] simplified the logic and removed the code path in
    question but didn't revert the second CL [2].

In short, this CL logically reverts the second CL [2] since it's not
necessary any more.

 [1]: Ia46738a5da6dbc334bf937b0f6656a57523c28a7
      6f13d20b8e
 [2]: Ia30a279441def501e53eeee8913d19ac50a620cd
      52ef1bf893
 [3]: Ie030eed523599b217060887171710692d050e5d8
      51c5a1d042

Bug: 119658889
Test: atest CtsWindowManagerDeviceTestCases
Change-Id: Id081851f60d6a2f8f17e9e21408f3052ff1f2cea
This commit is contained in:
Yohei Yukawa
2019-06-21 13:33:14 -07:00
parent 564b6a1409
commit 7efc7748ba

View File

@@ -4556,12 +4556,10 @@ public class WindowManagerService extends IWindowManager.Stub
lastFocus = displayContent.mLastFocus;
newFocus = displayContent.mCurrentFocus;
}
if (lastFocus == newFocus) {
// Focus is not changing, so nothing to do.
return;
}
synchronized (mGlobalLock) {
if (lastFocus == newFocus) {
// Focus is not changing, so nothing to do.
return;
}
displayContent.mLastFocus = newFocus;
if (DEBUG_FOCUS_LIGHT) Slog.i(TAG_WM, "Focus moving from " + lastFocus +
" to " + newFocus + " displayId=" + displayContent.getDisplayId());