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

Commit a02ab705 authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Bring insets fields back to AttachInfo"

parents 9bfd4840 cbfa72a4
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -29022,6 +29022,33 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
         */
        boolean mUse32BitDrawingCache;
        /**
         * For windows that are full-screen but using insets to layout inside
         * of the screen decorations, these are the current insets for the
         * content of the window.
         */
        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
                publicAlternatives = "Use {@link WindowInsets#getInsets(int)}")
        final Rect mContentInsets = new Rect();
        /**
         * For windows that are full-screen but using insets to layout inside
         * of the screen decorations, these are the current insets for the
         * actual visible parts of the window.
         */
        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
                publicAlternatives = "Use {@link WindowInsets#getInsets(int)}")
        final Rect mVisibleInsets = new Rect();
        /**
         * For windows that are full-screen but using insets to layout inside
         * of the screen decorations, these are the current insets for the
         * stable system windows.
         */
        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
                publicAlternatives = "Use {@link WindowInsets#getInsets(int)}")
        final Rect mStableInsets = new Rect();
        /**
         * Current caption insets to the display coordinate.
         */
+8 −11
Original line number Diff line number Diff line
@@ -582,9 +582,6 @@ public final class ViewRootImpl implements ViewParent,
            = new ViewTreeObserver.InternalInsetsInfo();

    private WindowInsets mLastWindowInsets;
    private final Rect mSystemInsetsCache = new Rect();
    private final Rect mVisibleInsetsCache = new Rect();
    private final Rect mStableInsetsCache = new Rect();

    // Insets types hidden by legacy window flags or system UI flags.
    private @InsetsType int mTypesHiddenByFlags = 0;
@@ -2341,9 +2338,9 @@ public final class ViewRootImpl implements ViewParent,
                    (mWindowAttributes.systemUiVisibility
                            | mWindowAttributes.subtreeSystemUiVisibility));

            mSystemInsetsCache.set(mLastWindowInsets.getSystemWindowInsets().toRect());
            mStableInsetsCache.set(mLastWindowInsets.getStableInsets().toRect());
            mVisibleInsetsCache.set(mInsetsController.calculateVisibleInsets(
            mAttachInfo.mContentInsets.set(mLastWindowInsets.getSystemWindowInsets().toRect());
            mAttachInfo.mStableInsets.set(mLastWindowInsets.getStableInsets().toRect());
            mAttachInfo.mVisibleInsets.set(mInsetsController.calculateVisibleInsets(
                    mWindowAttributes.softInputMode));
        }
        return mLastWindowInsets;
@@ -2846,7 +2843,7 @@ public final class ViewRootImpl implements ViewParent,
                                        && mWinFrame.height() == mPendingBackDropFrame.height();
                        // TODO: Need cutout?
                        startDragResizing(mPendingBackDropFrame, !backdropSizeMatchesFrame,
                                mSystemInsetsCache, mStableInsetsCache, mResizeMode);
                                mAttachInfo.mContentInsets, mAttachInfo.mStableInsets, mResizeMode);
                    } else {
                        // We shouldn't come here, but if we come we should end the resize.
                        endDragResizing();
@@ -4478,8 +4475,8 @@ public final class ViewRootImpl implements ViewParent,
    }

    boolean scrollToRectOrFocus(Rect rectangle, boolean immediate) {
        final Rect ci = mSystemInsetsCache;
        final Rect vi = mVisibleInsetsCache;
        final Rect ci = mAttachInfo.mContentInsets;
        final Rect vi = mAttachInfo.mVisibleInsets;
        int scrollY = 0;
        boolean handled = false;

@@ -7575,7 +7572,7 @@ public final class ViewRootImpl implements ViewParent,
        // XXX This is really broken, and probably all needs to be done
        // in the window manager, and we need to know more about whether
        // we want the area behind or in front of the IME.
        final Rect insets = mVisibleInsetsCache;
        final Rect insets = mAttachInfo.mVisibleInsets;
        outFrame.left += insets.left;
        outFrame.top += insets.top;
        outFrame.right -= insets.right;
@@ -7913,7 +7910,7 @@ public final class ViewRootImpl implements ViewParent,
            synchronized (mWindowCallbacks) {
                for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
                    mWindowCallbacks.get(i).onWindowSizeIsChanging(backDropFrame, fullscreen,
                            mVisibleInsetsCache, mStableInsetsCache);
                            mAttachInfo.mVisibleInsets, mAttachInfo.mStableInsets);
                }
            }
        }