Merge "Aviod divider surface memory allocated after boot" into rvc-dev am: e13e2229ce am: 38c1cbce50

Change-Id: I6151254676c1cd3ada2c65d5532c832c6759a86e
This commit is contained in:
Tony Huang
2020-05-06 05:02:51 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 14 deletions

View File

@@ -41,6 +41,7 @@ public class WindowlessWindowManager implements IWindowSession {
private final static String TAG = "WindowlessWindowManager";
private class State {
//TODO : b/150190730 we should create it when view show and release it when view invisible.
SurfaceControl mSurfaceControl;
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams();
int mDisplayId;
@@ -239,21 +240,19 @@ public class WindowlessWindowManager implements IWindowSession {
}
WindowManager.LayoutParams attrs = state.mParams;
final Rect surfaceInsets = attrs.surfaceInsets;
int width = surfaceInsets != null ?
attrs.width + surfaceInsets.left + surfaceInsets.right : attrs.width;
int height = surfaceInsets != null ?
attrs.height + surfaceInsets.top + surfaceInsets.bottom : attrs.height;
t.setBufferSize(sc, width, height)
.setOpaque(sc, isOpaque(attrs));
if (viewFlags == View.VISIBLE) {
t.show(sc);
final Rect surfaceInsets = attrs.surfaceInsets;
int width = surfaceInsets != null
? attrs.width + surfaceInsets.left + surfaceInsets.right : attrs.width;
int height = surfaceInsets != null
? attrs.height + surfaceInsets.top + surfaceInsets.bottom : attrs.height;
t.setBufferSize(sc, width, height).setOpaque(sc, isOpaque(attrs)).show(sc).apply();
outSurfaceControl.copyFrom(sc);
} else {
t.hide(sc);
t.hide(sc).apply();
outSurfaceControl.release();
}
t.apply();
outSurfaceControl.copyFrom(sc);
outFrame.set(0, 0, attrs.width, attrs.height);
mergedConfiguration.setConfiguration(mConfiguration, mConfiguration);

View File

@@ -189,8 +189,8 @@ public class SystemWindows {
public SurfaceControl getViewSurface(View rootView) {
for (int i = 0; i < mPerDisplay.size(); ++i) {
for (int iWm = 0; iWm < mPerDisplay.valueAt(i).mWwms.size(); ++iWm) {
SurfaceControl out =
mPerDisplay.valueAt(i).mWwms.get(iWm).getSurfaceControlForWindow(rootView);
SurfaceControl out = mPerDisplay.valueAt(i).mWwms.valueAt(iWm)
.getSurfaceControlForWindow(rootView);
if (out != null) {
return out;
}