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

Commit 02d3a8ad authored by Yuncheol Heo's avatar Yuncheol Heo
Browse files

Notify the visibility change to update color views without control.

Previously, we've notified it only when we have the control.
But to update color views, we should notify it even when we have no control.

Bug: 154720832
Test: atest WindowInsetsPolicyTest
Test: make sure no regression on b/150195782, b/151425506
Change-Id: I44b88ddc206f36d8ef11dae9c1477739a185ff21
parent cdb1ce47
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -200,6 +200,15 @@ public class InsetsSourceConsumer {
    }

    boolean applyLocalVisibilityOverride() {
        return applyLocalVisibilityOverride(false /* notifyWithoutControl */);
    }

    /**
     * @param notifyWithoutControl set it true when the caller wants to notify the visibility
     *                             changes even if the consumer doesn't have the control.
     * @return true if it needs to notify the visibility changes to the controller
     */
    private boolean applyLocalVisibilityOverride(boolean notifyWithoutControl) {
        InsetsSource source = mState.peekSource(mType);
        final boolean isVisible = source != null && source.isVisible();
        final boolean hasControl = mSourceControl != null;
@@ -211,7 +220,7 @@ public class InsetsSourceConsumer {

        // If we don't have control, we are not able to change the visibility.
        if (!hasControl) {
            return false;
            return notifyWithoutControl;
        }
        if (isVisible == mRequestedVisible) {
            return false;
@@ -293,7 +302,9 @@ public class InsetsSourceConsumer {
            mRequestedVisible = requestedVisible;
            mIsAnimationPending = false;
        }
        if (applyLocalVisibilityOverride()) {
        // We need to notify the visibility changed even if we don't have mSourceControl in order
        // to update color views.
        if (applyLocalVisibilityOverride(true  /* notifyWithoutControl */)) {
            mController.notifyVisibilityChanged();
        }
    }