Merge "Aviod divider surface memory allocated after boot" into rvc-dev

This commit is contained in:
Tony Huang
2020-05-06 04:39:14 +00:00
committed by Android (Google) Code Review
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 final static String TAG = "WindowlessWindowManager";
private class State { private class State {
//TODO : b/150190730 we should create it when view show and release it when view invisible.
SurfaceControl mSurfaceControl; SurfaceControl mSurfaceControl;
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); WindowManager.LayoutParams mParams = new WindowManager.LayoutParams();
int mDisplayId; int mDisplayId;
@@ -239,21 +240,19 @@ public class WindowlessWindowManager implements IWindowSession {
} }
WindowManager.LayoutParams attrs = state.mParams; 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) { 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 { } else {
t.hide(sc); t.hide(sc).apply();
outSurfaceControl.release();
} }
t.apply();
outSurfaceControl.copyFrom(sc);
outFrame.set(0, 0, attrs.width, attrs.height); outFrame.set(0, 0, attrs.width, attrs.height);
mergedConfiguration.setConfiguration(mConfiguration, mConfiguration); mergedConfiguration.setConfiguration(mConfiguration, mConfiguration);

View File

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