Aviod divider surface memory allocated after boot
The divider surface buffer will be allocated even if the user does not enter split mode. Avoid it by only copy surface when it show and release it when it hidden. Bug: 150190730 Test: reboot and check adb shell dumpsys SurfaceFlinger Change-Id: Id70a2626b2a921cff6243d992c6b053e329ef92b
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user