Update touch mode regardless of mStopped
The very first state of touch mode is obtained from addToDisplay. It
should be applied in the first performTraversal regardless of mStopped.
In this way, when an app window is re-created at the background, the
touch mode state can still be up-to-date.
Fix: 227843343
Test: 1. Open Chrome and go to the homepage.
2. Change the theme via the 3-dot menu > Settings > Theme.
3. Go back to the homepage and see if any button is focused.
Expected behavior: no button looks focused.
Change-Id: I2681e2436dd265abe9cd9bdd56ee5799fa30d89b
This commit is contained in:
@@ -2767,17 +2767,16 @@ public final class ViewRootImpl implements ViewParent,
|
||||
dispatchApplyInsets(host);
|
||||
}
|
||||
|
||||
if (mFirst) {
|
||||
// make sure touch mode code executes by setting cached value
|
||||
// to opposite of the added touch mode.
|
||||
mAttachInfo.mInTouchMode = !mAddedTouchMode;
|
||||
ensureTouchModeLocally(mAddedTouchMode);
|
||||
}
|
||||
|
||||
boolean layoutRequested = mLayoutRequested && (!mStopped || mReportNextDraw);
|
||||
if (layoutRequested) {
|
||||
|
||||
final Resources res = mView.getContext().getResources();
|
||||
|
||||
if (mFirst) {
|
||||
// make sure touch mode code executes by setting cached value
|
||||
// to opposite of the added touch mode.
|
||||
mAttachInfo.mInTouchMode = !mAddedTouchMode;
|
||||
ensureTouchModeLocally(mAddedTouchMode);
|
||||
} else {
|
||||
if (!mFirst) {
|
||||
if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
|| lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
|
||||
windowSizeMayChange = true;
|
||||
@@ -2797,7 +2796,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
// Ask host how big it wants to be
|
||||
windowSizeMayChange |= measureHierarchy(host, lp, res,
|
||||
windowSizeMayChange |= measureHierarchy(host, lp, mView.getContext().getResources(),
|
||||
desiredWindowWidth, desiredWindowHeight);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user