Only add divider when it need to show

By previous memory patch, the divider will always call update when
enter split when means it always add divider view when showing. So
we can reduce some update call to avoid any unnecessary surface
memory allocate.

Fix: 150190730
Test: Check split mode rotate normally and dump SF to check divider
      memory status
Change-Id: Ibccd0b998d299968ee6d68127c801fae656d2127
This commit is contained in:
Tony Huang
2020-05-15 13:51:03 +08:00
parent 2cdbcea8ba
commit 91bba497c3
3 changed files with 4 additions and 9 deletions

View File

@@ -41,7 +41,6 @@ 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;

View File

@@ -238,7 +238,10 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
mSplitLayout.mSecondary = new Rect(mRotateSplitLayout.mSecondary);
mRotateSplitLayout = null;
}
update(newConfig);
if (isSplitActive()) {
update(newConfig);
}
}
Handler getHandler() {
@@ -313,11 +316,6 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
mHandler.post(this::removeDivider);
}
void onTasksReady() {
mHandler.post(() -> update(mDisplayController.getDisplayContext(
mContext.getDisplayId()).getResources().getConfiguration()));
}
private void updateVisibility(final boolean visible) {
if (DEBUG) Slog.d(TAG, "Updating visibility " + mVisible + "->" + visible);
if (mVisible != visible) {

View File

@@ -113,8 +113,6 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
t.setColor(mSecondaryDim, new float[]{0f, 0f, 0f});
t.apply();
releaseTransaction(t);
mDivider.onTasksReady();
}
}
}