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

Commit d7ebb325 authored by Tiger Huang's avatar Tiger Huang Committed by Automerger Merge Worker
Browse files

Merge "Dispatch the requested visibility if the client has the control" into...

Merge "Dispatch the requested visibility if the client has the control" into rvc-dev am: 090ee6ff am: 9fd3d0aa

Change-Id: I618e06ba517fda250ce9ed60e6e1eef00e5ab073
parents a0789979 9fd3d0aa
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -568,15 +568,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
    private void updateState(InsetsState newState) {
        mState.setDisplayFrame(newState.getDisplayFrame());
        for (int i = newState.getSourcesCount() - 1; i >= 0; i--) {
            final InsetsSource source = newState.sourceAt(i);
            final int type = source.getType();
            final InsetsSourceConsumer consumer = getSourceConsumer(type);
            consumer.updateSource(source);
            mHost.updateCompatSysUiVisibility(type, source.isVisible(),
                    consumer.getControl() != null);
            InsetsSource source = newState.sourceAt(i);
            getSourceConsumer(source.getType()).updateSource(source);
        }
        for (int i = mState.getSourcesCount() - 1; i >= 0; i--) {
            final InsetsSource source = mState.sourceAt(i);
            InsetsSource source = mState.sourceAt(i);
            if (newState.peekSource(source.getType()) == null) {
                mState.removeSource(source.getType());
            }
@@ -1010,6 +1006,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        updateRequestedState();
    }

    /**
     * @see ViewRootImpl#updateCompatSysUiVisibility(int, boolean, boolean)
     */
    public void updateCompatSysUiVisibility(@InternalInsetsType int type, boolean visible,
            boolean hasControl) {
        mHost.updateCompatSysUiVisibility(type, visible, hasControl);
    }

    /**
     * Called when current window gains focus.
     */
+12 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.view;

import static android.view.InsetsController.ANIMATION_TYPE_NONE;
import static android.view.InsetsController.AnimationType;
import static android.view.InsetsState.getDefaultVisibility;
import static android.view.InsetsState.toPublicType;

import android.annotation.IntDef;
@@ -82,7 +83,7 @@ public class InsetsSourceConsumer {
        mState = state;
        mTransactionSupplier = transactionSupplier;
        mController = controller;
        mRequestedVisible = InsetsState.getDefaultVisibility(type);
        mRequestedVisible = getDefaultVisibility(type);
    }

    /**
@@ -200,12 +201,20 @@ public class InsetsSourceConsumer {
    }

    boolean applyLocalVisibilityOverride() {
        final InsetsSource source = mState.peekSource(mType);
        final boolean isVisible = source != null ? source.isVisible() : getDefaultVisibility(mType);
        final boolean hasControl = mSourceControl != null;

        // We still need to let the legacy app know the visibility change even if we don't have the
        // control.
        mController.updateCompatSysUiVisibility(
                mType, hasControl ? mRequestedVisible : isVisible, hasControl);

        // If we don't have control, we are not able to change the visibility.
        if (mSourceControl == null) {
        if (!hasControl) {
            return false;
        }
        if (mState.getSource(mType).isVisible() == mRequestedVisible) {
        if (isVisible == mRequestedVisible) {
            return false;
        }
        mState.getSource(mType).setVisible(mRequestedVisible);
+3 −0
Original line number Diff line number Diff line
@@ -1977,6 +1977,7 @@ public final class ViewRootImpl implements ViewParent,
                    (mCompatibleVisibilityInfo.globalVisibility & ~View.SYSTEM_UI_FLAG_LOW_PROFILE)
                            | (mAttachInfo.mSystemUiVisibility & View.SYSTEM_UI_FLAG_LOW_PROFILE);
            if (mDispatchedSystemUiVisibility != mCompatibleVisibilityInfo.globalVisibility) {
                mHandler.removeMessages(MSG_DISPATCH_SYSTEM_UI_VISIBILITY);
                mHandler.sendMessage(mHandler.obtainMessage(
                        MSG_DISPATCH_SYSTEM_UI_VISIBILITY, mCompatibleVisibilityInfo));
            }
@@ -2031,8 +2032,10 @@ public final class ViewRootImpl implements ViewParent,
            }
        } else {
            info.globalVisibility |= systemUiFlag;
            info.localChanges &= ~systemUiFlag;
        }
        if (mDispatchedSystemUiVisibility != info.globalVisibility) {
            mHandler.removeMessages(MSG_DISPATCH_SYSTEM_UI_VISIBILITY);
            mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_SYSTEM_UI_VISIBILITY, info));
        }
    }