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

Commit 8b9c15bd authored by Mateusz Cicheński's avatar Mateusz Cicheński
Browse files

Pass the keep clear areas through proper implementation. The PipController is...

Pass the keep clear areas through proper implementation. The PipController is not registered as DisplayWindowListener, but this inner implementation is.

Bug: 183746978
Test: atest PipControllerTest, manually via extra log statement I noticed it's not being receiving the keep clear areas changes
Change-Id: Iaae4aad3dfd1dd5a5dbab79f91efab3d52b94f80
parent eae7fba6
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ import java.util.function.Consumer;
 * Manages the picture-in-picture (PIP) UI and states for Phones.
 */
public class PipController implements PipTransitionController.PipTransitionCallback,
        RemoteCallable<PipController>, DisplayController.OnDisplaysChangedListener {
        RemoteCallable<PipController> {
    private static final String TAG = "PipController";

    private Context mContext;
@@ -234,6 +234,14 @@ public class PipController implements PipTransitionController.PipTransitionCallb
                    onDisplayChanged(mDisplayController.getDisplayLayout(displayId),
                            true /* saveRestoreSnapFraction */);
                }

                @Override
                public void onKeepClearAreasChanged(int displayId, Set<Rect> restricted,
                        Set<Rect> unrestricted) {
                    if (mPipBoundsState.getDisplayId() == displayId) {
                        mPipBoundsState.setKeepClearAreas(restricted, unrestricted);
                    }
                }
            };

    /**
@@ -463,14 +471,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb
        return mMainExecutor;
    }

    @Override
    public void onKeepClearAreasChanged(int displayId, Set<Rect> restricted,
            Set<Rect> unrestricted) {
        if (mPipBoundsState.getDisplayId() == displayId) {
            mPipBoundsState.setKeepClearAreas(restricted, unrestricted);
        }
    }

    private void onConfigurationChanged(Configuration newConfig) {
        mPipBoundsAlgorithm.onConfigurationChanged(mContext);
        mTouchHandler.onConfigurationChanged();
+2 −1
Original line number Diff line number Diff line
@@ -217,7 +217,8 @@ public class PipControllerTest extends ShellTestCase {
        final Rect keepClearArea = new Rect(0, 0, 10, 10);
        when(mMockPipBoundsState.getDisplayId()).thenReturn(displayId);

        mPipController.onKeepClearAreasChanged(displayId, Set.of(keepClearArea), Set.of());
        mPipController.mDisplaysChangedListener.onKeepClearAreasChanged(
                displayId, Set.of(keepClearArea), Set.of());

        verify(mMockPipBoundsState).setKeepClearAreas(Set.of(keepClearArea), Set.of());
    }