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

Commit 444f200f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix flickers when changing control" into rvc-dev am: c322ed21 am: 162040e3

Change-Id: Id54a95cfda897b0c88c02959ada4997ec4b69308
parents ca6a8479 162040e3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -456,6 +456,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        return mState;
    }

    @Override
    public boolean isRequestedVisible(int type) {
        return getSourceConsumer(type).isRequestedVisible();
    }

    public InsetsState getLastDispatchedState() {
        return mLastDispachedState;
    }
+6 −6
Original line number Diff line number Diff line
@@ -116,10 +116,10 @@ public class InsetsSourceConsumer {
                // However make sure that the leash visibility is still up to date.
                if (applyLocalVisibilityOverride()) {
                    mController.notifyVisibilityChanged();
              }
                    applyHiddenToControl();
                }
            }
        }
        if (lastControl != null) {
            lastControl.release(mController::releaseSurfaceControlFromRt);
        }
+8 −0
Original line number Diff line number Diff line
@@ -107,6 +107,14 @@ public class PendingInsetsController implements WindowInsetsController {
        return mDummyState;
    }

    @Override
    public boolean isRequestedVisible(int type) {

        // Method is only used once real insets controller is attached, so no need to traverse
        // requests here.
        return InsetsState.getDefaultVisibility(type);
    }

    @Override
    public void addOnControllableInsetsChangedListener(
            OnControllableInsetsChangedListener listener) {
+8 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.Nullable;
import android.graphics.Insets;
import android.inputmethodservice.InputMethodService;
import android.os.CancellationSignal;
import android.view.InsetsState.InternalInsetsType;
import android.view.WindowInsets.Type;
import android.view.WindowInsets.Type.InsetsType;
import android.view.animation.Interpolator;
@@ -225,6 +226,13 @@ public interface WindowInsetsController {
     */
    InsetsState getState();

    /**
     * @return Whether the specified insets source is currently requested to be visible by the
     *         application.
     * @hide
     */
    boolean isRequestedVisible(@InternalInsetsType int type);

    /**
     * Adds a {@link OnControllableInsetsChangedListener} to the window insets controller.
     *
+13 −10
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ import com.android.internal.widget.DecorCaptionView;
import com.android.internal.widget.FloatingToolbar;

import java.util.List;
import java.util.function.Function;

/** @hide */
public class DecorView extends FrameLayout implements RootViewSurfaceTaker, WindowCallbacks {
@@ -1101,7 +1102,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        int sysUiVisibility = attrs.systemUiVisibility | getWindowSystemUiVisibility();

        final WindowInsetsController controller = getWindowInsetsController();
        final InsetsState state = controller != null ? controller.getState() : null;

        // IME is an exceptional floating window that requires color view.
        final boolean isImeWindow =
@@ -1151,7 +1151,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                    calculateNavigationBarColor(), mWindow.mNavigationBarDividerColor, navBarSize,
                    navBarToRightEdge || navBarToLeftEdge, navBarToLeftEdge,
                    0 /* sideInset */, animate && !disallowAnimate,
                    mForceWindowDrawsBarBackgrounds, state);
                    mForceWindowDrawsBarBackgrounds, controller);
            boolean oldDrawLegacy = mDrawLegacyNavigationBarBackground;
            mDrawLegacyNavigationBarBackground = mNavigationColorViewState.visible
                    && (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0;
@@ -1172,7 +1172,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                    calculateStatusBarColor(), 0, mLastTopInset,
                    false /* matchVertical */, statusBarNeedsLeftInset, statusBarSideInset,
                    animate && !disallowAnimate,
                    mForceWindowDrawsBarBackgrounds, state);
                    mForceWindowDrawsBarBackgrounds, controller);

            if (mHasCaption) {
                final int captionColor = calculateStatusBarColor();
@@ -1193,7 +1193,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        // SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION to indicate whether the app wants to handle it by
        // themselves.
        boolean hideNavigation = (sysUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0
                || !(state == null || state.getSource(ITYPE_NAVIGATION_BAR).isVisible());
                || !(controller == null || controller.isRequestedVisible(ITYPE_NAVIGATION_BAR));
        boolean forceConsumingNavBar = (mForceWindowDrawsBarBackgrounds
                        && (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0
                        && (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0
@@ -1214,7 +1214,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        // fullscreen, as othrewise we can expect the app to handle it.
        boolean fullscreen = (sysUiVisibility & SYSTEM_UI_FLAG_FULLSCREEN) != 0
                || (attrs.flags & FLAG_FULLSCREEN) != 0
                || !(state == null || state.getSource(ITYPE_STATUS_BAR).isVisible());
                || !(controller == null || controller.isRequestedVisible(ITYPE_STATUS_BAR));
        boolean consumingStatusBar = (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == 0
                && (attrs.flags & FLAG_LAYOUT_IN_SCREEN) == 0
                && (attrs.flags & FLAG_LAYOUT_INSET_DECOR) == 0
@@ -1354,10 +1354,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
     */
    private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
            int dividerColor, int size, boolean verticalBar, boolean seascape, int sideMargin,
            boolean animate, boolean force, InsetsState insetsState) {
            boolean animate, boolean force, WindowInsetsController controller) {
        state.present = ViewRootImpl.sNewInsetsMode != ViewRootImpl.NEW_INSETS_MODE_FULL
                ? state.attributes.isPresent(sysUiVis, mWindow.getAttributes().flags, force)
                : state.attributes.isPresent(insetsState, mWindow.getAttributes().flags, force);
                : state.attributes.isPresent(
                        controller.isRequestedVisible(state.attributes.insetsType),
                        mWindow.getAttributes().flags, force);
        boolean show = state.attributes.isVisible(state.present, color,
                mWindow.getAttributes().flags, force);
        boolean showView = show && !isResizing() && !mHasCaption && size > 0;
@@ -2624,8 +2626,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                    || force);
        }

        public boolean isPresent(InsetsState state, int windowFlags, boolean force) {
            return (state == null || state.getSource(insetsType).isVisible())
        public boolean isPresent(boolean requestedVisible, int windowFlags, boolean force) {
            return requestedVisible
                    && ((windowFlags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 || force);
        }

@@ -2642,7 +2644,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        }

        public boolean isVisible(InsetsState state, int color, int windowFlags, boolean force) {
            final boolean present = isPresent(state, windowFlags, force);
            final boolean present = isPresent(state.getSource(insetsType).isVisible(), windowFlags,
                    force);
            return isVisible(present, color, windowFlags, force);
        }
    }
Loading