diff options
| author | Vishnu Nair <vishnun@google.com> | 2020-03-20 20:04:20 +0000 |
|---|---|---|
| committer | Vishnu Nair <vishnun@google.com> | 2020-03-20 20:16:47 +0000 |
| commit | ac0dfc1096d9f40b96c39748272eb378c873ec23 (patch) | |
| tree | 594e68eb4a690b5a3d74660c84832f6ca026f3d9 /core/java/android/view/ViewRootImpl.java | |
| parent | bc78be758b43da1732880557ac6ea9596f9277ba (diff) | |
Revert "Revert "RootViewImpl: Fix measure size hint for WRAP_CONTENT windows""
This reverts commit 4f6b8ec056dafd307450888064b29c915a1a1f5f.
Reason for revert: Can not repro memory regression in R, b/134695730
Test: atest google/perf/memory/memory-test
Bug: b/119839070, b/73813813
Change-Id: Ibe560942949d3b37cd6d43ab49148cbf401e0e39
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index dd34bcb018b9..218c9fb2fd4f 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2347,9 +2347,18 @@ public final class ViewRootImpl implements ViewParent, mDisplay.getRealSize(size); desiredWindowWidth = size.x; desiredWindowHeight = size.y; + } else if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT + || lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) { + // For wrap content, we have to remeasure later on anyways. Use size consistent with + // below so we get best use of the measure cache. + desiredWindowWidth = dipToPx(config.screenWidthDp); + desiredWindowHeight = dipToPx(config.screenHeightDp); } else { - desiredWindowWidth = mWinFrame.width(); - desiredWindowHeight = mWinFrame.height(); + // After addToDisplay, the frame contains the frameHint from window manager, which + // for most windows is going to be the same size as the result of relayoutWindow. + // Using this here allows us to avoid remeasuring after relayoutWindow + desiredWindowWidth = frame.width(); + desiredWindowHeight = frame.height(); } // We used to use the following condition to choose 32 bits drawing caches: |
