Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc468d55 authored by Tony Huang's avatar Tony Huang
Browse files

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
Test: Use forest to test cts/framework/gce-presubmit-wm-cloud-tf-3
Test: Use acloud to test cts/framework/gce-presubmit-wm-cloud-tf-3
Change-Id: I0aa4ad560eff6b64adc20cf2c04c3a61798c56ba
parent c266b039
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -253,8 +253,10 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
            mSplitLayout.mSecondary = new Rect(mRotateSplitLayout.mSecondary);
            mRotateSplitLayout = null;
        }
        if (isSplitActive()) {
            update(newConfig);
        }
    }

    Handler getHandler() {
        return mHandler;
@@ -328,11 +330,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) {
@@ -524,7 +521,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,

    void ensureMinimizedSplit() {
        setHomeMinimized(true /* minimized */, mHomeStackResizable);
        if (!isDividerVisible()) {
        if (mView != null && !isDividerVisible()) {
            // Wasn't in split-mode yet, so enter now.
            if (DEBUG) {
                Slog.d(TAG, " entering split mode with minimized=true");
@@ -535,7 +532,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,

    void ensureNormalSplit() {
        setHomeMinimized(false /* minimized */, mHomeStackResizable);
        if (!isDividerVisible()) {
        if (mView != null && !isDividerVisible()) {
            // Wasn't in split-mode, so enter now.
            if (DEBUG) {
                Slog.d(TAG, " enter split mode unminimized ");
+0 −2
Original line number Diff line number Diff line
@@ -113,8 +113,6 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
                t.setColor(mSecondaryDim, new float[]{0f, 0f, 0f});
                t.apply();
                releaseTransaction(t);

                mDivider.onTasksReady();
            }
        }
    }