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

Commit 923f8d03 authored by Adrian Roos's avatar Adrian Roos Committed by android-build-merger
Browse files

Merge "Window: Provide frame size hint to ViewRootImpl" into pi-dev

am: b8d85373

Change-Id: I1382753d3e7fd1104b9e31e1b358413e3fc8f5dd
parents da7d6239 b8d85373
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -788,8 +788,8 @@ public abstract class WallpaperService extends Service {
                                com.android.internal.R.style.Animation_Wallpaper;
                        mInputChannel = new InputChannel();
                        if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
                            Display.DEFAULT_DISPLAY, mContentInsets, mStableInsets, mOutsets,
                                mDisplayCutout, mInputChannel) < 0) {
                                Display.DEFAULT_DISPLAY, mWinFrame, mContentInsets, mStableInsets,
                                mOutsets, mDisplayCutout, mInputChannel) < 0) {
                            Log.w(TAG, "Failed to add window while updating wallpaper surface.");
                            return;
                        }
+2 −2
Original line number Diff line number Diff line
@@ -41,8 +41,8 @@ interface IWindowSession {
            in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets,
            out InputChannel outInputChannel);
    int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
            in int viewVisibility, in int layerStackId, out Rect outContentInsets,
            out Rect outStableInsets, out Rect outOutsets,
            in int viewVisibility, in int layerStackId, out Rect outFrame,
            out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets,
            out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel);
    int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
            in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets);
+3 −3
Original line number Diff line number Diff line
@@ -753,7 +753,7 @@ public final class ViewRootImpl implements ViewParent,
                    mAttachInfo.mRecomputeGlobalAttributes = true;
                    collectViewAttributes();
                    res = mWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes,
                            getHostVisibility(), mDisplay.getDisplayId(),
                            getHostVisibility(), mDisplay.getDisplayId(), mWinFrame,
                            mAttachInfo.mContentInsets, mAttachInfo.mStableInsets,
                            mAttachInfo.mOutsets, mAttachInfo.mDisplayCutout, mInputChannel);
                } catch (RemoteException e) {
@@ -1711,8 +1711,8 @@ public final class ViewRootImpl implements ViewParent,
                desiredWindowWidth = size.x;
                desiredWindowHeight = size.y;
            } else {
                desiredWindowWidth = dipToPx(config.screenWidthDp);
                desiredWindowHeight = dipToPx(config.screenHeightDp);
                desiredWindowWidth = mWinFrame.width();
                desiredWindowHeight = mWinFrame.height();
            }

            // We used to use the following condition to choose 32 bits drawing caches:
+27 −17
Original line number Diff line number Diff line
@@ -4389,13 +4389,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    @Override
    // TODO: Should probably be moved into DisplayFrames.
    public boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
            DisplayFrames displayFrames, Rect outContentInsets, Rect outStableInsets,
    public boolean getLayoutHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
            DisplayFrames displayFrames, Rect outFrame, Rect outContentInsets, Rect outStableInsets,
            Rect outOutsets, DisplayCutout.ParcelableWrapper outDisplayCutout) {
        final int fl = PolicyControl.getWindowFlags(null, attrs);
        final int pfl = attrs.privateFlags;
        final int sysuiVis = PolicyControl.getSystemUiVisibility(null, attrs);
        final int systemUiVisibility = (sysuiVis | attrs.subtreeSystemUiVisibility);
        final int requestedSysUiVis = PolicyControl.getSystemUiVisibility(null, attrs);
        final int sysUiVis = requestedSysUiVis | getImpliedSysUiFlagsForLayout(attrs);
        final int displayRotation = displayFrames.mRotation;
        final int displayWidth = displayFrames.mDisplayWidth;
        final int displayHeight = displayFrames.mDisplayHeight;
@@ -4416,21 +4416,20 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
        }

        final boolean layoutInScreenAndInsetDecor =
                (fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR))
                        == (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR);
        final boolean layoutInScreen = (fl & FLAG_LAYOUT_IN_SCREEN) != 0;
        final boolean layoutInScreenAndInsetDecor = layoutInScreen &&
                (fl & FLAG_LAYOUT_INSET_DECOR) != 0;
        final boolean screenDecor = (pfl & PRIVATE_FLAG_IS_SCREEN_DECOR) != 0;

        if (layoutInScreenAndInsetDecor && !screenDecor) {
            Rect frame;
            int availRight, availBottom;
            if (canHideNavigationBar() &&
                    (systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {
                frame = displayFrames.mUnrestricted;
                    (sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {
                outFrame.set(displayFrames.mUnrestricted);
                availRight = displayFrames.mUnrestricted.right;
                availBottom = displayFrames.mUnrestricted.bottom;
            } else {
                frame = displayFrames.mRestricted;
                outFrame.set(displayFrames.mRestricted);
                availRight = displayFrames.mRestricted.right;
                availBottom = displayFrames.mRestricted.bottom;
            }
@@ -4438,7 +4437,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    availRight - displayFrames.mStable.right,
                    availBottom - displayFrames.mStable.bottom);

            if ((systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
            if ((sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
                if ((fl & FLAG_FULLSCREEN) != 0) {
                    outContentInsets.set(displayFrames.mStableFullscreen.left,
                            displayFrames.mStableFullscreen.top,
@@ -4460,15 +4459,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        displayWidth, displayHeight);
                calculateRelevantTaskInsets(taskBounds, outStableInsets,
                        displayWidth, displayHeight);
                outFrame.intersect(taskBounds);
            }
            outDisplayCutout.set(displayFrames.mDisplayCutout.calculateRelativeTo(frame));
            outDisplayCutout.set(displayFrames.mDisplayCutout.calculateRelativeTo(outFrame));
            return mForceShowSystemBars;
        } else {
            if (layoutInScreen) {
                outFrame.set(displayFrames.mUnrestricted);
            } else {
                outFrame.set(displayFrames.mStable);
            }
            if (taskBounds != null) {
                outFrame.intersect(taskBounds);
            }

            outContentInsets.setEmpty();
            outStableInsets.setEmpty();
            outDisplayCutout.set(DisplayCutout.NO_CUTOUT);
            return mForceShowSystemBars;
        }
    }

    /**
     * For any given task bounds, the insets relevant for these bounds given the insets relevant
+6 −4
Original line number Diff line number Diff line
@@ -1145,13 +1145,14 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {


    /**
     * Return the insets for the areas covered by system windows. These values are computed on the
     * Return the layout hints for a newly added window. These values are computed on the
     * most recent layout, so they are not guaranteed to be correct.
     *
     * @param attrs The LayoutParams of the window.
     * @param taskBounds The bounds of the task this window is on or {@code null} if no task is
     *                   associated with the window.
     * @param displayFrames display frames.
     * @param outFrame The frame of the window.
     * @param outContentInsets The areas covered by system windows, expressed as positive insets.
     * @param outStableInsets The areas covered by stable system windows irrespective of their
     *                        current visibility. Expressed as positive insets.
@@ -1160,9 +1161,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
     * @return Whether to always consume the navigation bar.
     *         See {@link #isNavBarForcedShownLw(WindowState)}.
     */
    default boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
            DisplayFrames displayFrames, Rect outContentInsets, Rect outStableInsets,
            Rect outOutsets, DisplayCutout.ParcelableWrapper outDisplayCutout) {
    default boolean getLayoutHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
            DisplayFrames displayFrames, Rect outFrame, Rect outContentInsets,
            Rect outStableInsets, Rect outOutsets,
            DisplayCutout.ParcelableWrapper outDisplayCutout) {
        return false;
    }

Loading