Remove divider view when exiting splitscreen

Remove and re add divider view as needed so we do not allocate memory
while split screen is not active. Also release surface reference from
server when we are done with the SurfaceControl so we don't have to rely
on GC to remove the last reference.

Fixes: 150190730
Test: test split screen manually, check for offscreen or onscreen
divider layers in winscope

Change-Id: I1a6a1c1d4346aafeae85aaf61ec4df23722e75ab
This commit is contained in:
Vishnu Nair
2020-05-08 11:05:58 -07:00
parent 0b17a06762
commit 4880a30fe0
5 changed files with 11 additions and 17 deletions

View File

@@ -275,12 +275,4 @@ public class SurfaceControlViewHost {
// ViewRoot will release mSurfaceControl for us.
mViewRoot.die(false /* immediate */);
}
/**
* Tell this viewroot to clean itself up.
* @hide
*/
public void die() {
mViewRoot.die(false /* immediate */);
}
}

View File

@@ -58,7 +58,7 @@ public class SurfaceViewRequestReceiver {
*/
public void onReceive(Context context, Bundle bundle, View view, Size viewSize) {
if (mSurfaceControlViewHost != null) {
mSurfaceControlViewHost.die();
mSurfaceControlViewHost.release();
}
SurfaceControl surfaceControl = SurfaceViewRequestUtils.getSurfaceControl(bundle);

View File

@@ -592,13 +592,11 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
removeDivider();
addDivider(configuration);
if (mView != null) {
if (mMinimized) {
mView.setMinimizedDockStack(true, mHomeStackResizable);
updateTouchable();
}
mView.setHidden(isDividerHidden);
if (mMinimized) {
mView.setMinimizedDockStack(true, mHomeStackResizable);
updateTouchable();
}
mView.setHidden(isDividerHidden);
}
void onTaskVanished() {
@@ -610,7 +608,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
mContext.getDisplayId()).getResources().getConfiguration()));
}
void updateVisibility(final boolean visible) {
private void updateVisibility(final boolean visible) {
if (DEBUG) Slog.d(TAG, "Updating visibility " + mVisible + "->" + visible);
if (mVisible != visible) {
mVisible = visible;
@@ -639,6 +637,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
void onSplitDismissed() {
mMinimized = false;
updateVisibility(false /* visible */);
removeDivider();
}
/** Switch to minimized state if appropriate */
@@ -788,6 +787,8 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
}
void startEnterSplit() {
update(mDisplayController.getDisplayContext(
mContext.getDisplayId()).getResources().getConfiguration());
// Set resizable directly here because applyEnterSplit already resizes home stack.
mHomeStackResizable = WindowManagerProxy.applyEnterSplit(mSplits, mSplitLayout);
}

View File

@@ -125,7 +125,7 @@ public class SystemWindows {
*/
public void removeView(View view) {
SurfaceControlViewHost root = mViewRoots.remove(view);
root.die();
root.release();
}
/**

View File

@@ -8082,6 +8082,7 @@ public class WindowManagerService extends IWindowManager.Stub
t.setInputWindowInfo(surface, h);
t.apply();
t.close();
surface.release();
}
/**