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

Commit 024a349f authored by Robert Carr's avatar Robert Carr
Browse files

DimLayer: More release fixes.

DimState and DimAnimatable are sharing ownership of the Dim layer with
either having the possibility to remove it. They aren't holding references
to eachother so its not clear where to consolidate ownership. We take the easy
way out and add some valid checks so they can safely share ownership.

Bug: 130315011
Test: Existing tests pass
Change-Id: Id473e40c58f1ca0f4a6a23284e220c6fd2ec36d2
parent 094171bc
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -102,7 +102,9 @@ class Dimmer {
        }

        void removeSurface() {
            if (mDimLayer != null && mDimLayer.isValid()) {
                getPendingTransaction().remove(mDimLayer);
            }
            mDimLayer = null;
        }
    }
@@ -305,7 +307,9 @@ class Dimmer {

        if (!mDimState.mDimming) {
            if (!mDimState.mAnimateExit) {
                if (mDimState.mDimLayer.isValid()) {
                    t.remove(mDimState.mDimLayer);
                }
            } else {
                startDimExit(mLastRequestedDimContainer, mDimState.mSurfaceAnimator, t);
            }
+4 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.when;

import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
@@ -78,7 +79,9 @@ public class DimmerTests extends WindowTestsBase {

            @Override
            public SurfaceControl build() {
                return mock(SurfaceControl.class);
                SurfaceControl mSc = mock(SurfaceControl.class);
                when(mSc.isValid()).thenReturn(true);
                return mSc;
            }
        }