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

Commit 3f44ef16 authored by Adrian Roos's avatar Adrian Roos Committed by android-build-merger
Browse files

Merge changes Ifc6355e2,Ia8afa338 into pi-dev am: ba9e18c2

am: 526ad191

Change-Id: I6aa7b9da16bc165cd390698295acae91a32bc355
parents 23c3b3cb 526ad191
Loading
Loading
Loading
Loading
+18 −1
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.server.wm.proto.BarControllerProto.STATE;
import static com.android.server.wm.proto.BarControllerProto.TRANSIENT_STATE;
import static com.android.server.wm.proto.BarControllerProto.TRANSIENT_STATE;


import android.app.StatusBarManager;
import android.app.StatusBarManager;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
import android.os.SystemClock;
import android.os.SystemClock;
@@ -68,6 +69,7 @@ public class BarController {
    private boolean mShowTransparent;
    private boolean mShowTransparent;
    private boolean mSetUnHideFlagWhenNextTransparent;
    private boolean mSetUnHideFlagWhenNextTransparent;
    private boolean mNoAnimationOnNextShow;
    private boolean mNoAnimationOnNextShow;
    private final Rect mContentFrame = new Rect();


    private OnBarVisibilityChangedListener mVisibilityChangeListener;
    private OnBarVisibilityChangedListener mVisibilityChangeListener;


@@ -87,6 +89,15 @@ public class BarController {
        mWin = win;
        mWin = win;
    }
    }


    /**
     * Sets the frame within which the bar will display its content.
     *
     * This is used to determine if letterboxes interfere with the display of such content.
     */
    public void setContentFrame(Rect frame) {
        mContentFrame.set(frame);
    }

    public void setShowTransparent(boolean transparent) {
    public void setShowTransparent(boolean transparent) {
        if (transparent != mShowTransparent) {
        if (transparent != mShowTransparent) {
            mShowTransparent = transparent;
            mShowTransparent = transparent;
@@ -135,7 +146,8 @@ public class BarController {
                } else {
                } else {
                    vis &= ~mTranslucentFlag;
                    vis &= ~mTranslucentFlag;
                }
                }
                if ((fl & WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) {
                if ((fl & WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
                        && isTransparentAllowed(win)) {
                    vis |= mTransparentFlag;
                    vis |= mTransparentFlag;
                } else {
                } else {
                    vis &= ~mTransparentFlag;
                    vis &= ~mTransparentFlag;
@@ -148,6 +160,10 @@ public class BarController {
        return vis;
        return vis;
    }
    }


    boolean isTransparentAllowed(WindowState win) {
        return win == null || !win.isLetterboxedOverlappingWith(mContentFrame);
    }

    public boolean setBarShowingLw(final boolean show) {
    public boolean setBarShowingLw(final boolean show) {
        if (mWin == null) return false;
        if (mWin == null) return false;
        if (show && mTransientBarState == TRANSIENT_BAR_HIDING) {
        if (show && mTransientBarState == TRANSIENT_BAR_HIDING) {
@@ -328,6 +344,7 @@ public class BarController {
            pw.println(StatusBarManager.windowStateToString(mState));
            pw.println(StatusBarManager.windowStateToString(mState));
            pw.print(prefix); pw.print("  "); pw.print("mTransientBar"); pw.print('=');
            pw.print(prefix); pw.print("  "); pw.print("mTransientBar"); pw.print('=');
            pw.println(transientBarStateToString(mTransientBarState));
            pw.println(transientBarStateToString(mTransientBarState));
            pw.print(prefix); pw.print("  mContentFrame="); pw.println(mContentFrame);
        }
        }
    }
    }


+29 −20
Original line number Original line Diff line number Diff line
@@ -4705,6 +4705,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        displayFrames.mStable.top = displayFrames.mUnrestricted.top
        displayFrames.mStable.top = displayFrames.mUnrestricted.top
                + mStatusBarHeightForRotation[displayFrames.mRotation];
                + mStatusBarHeightForRotation[displayFrames.mRotation];


        // Tell the bar controller where the collapsed status bar content is
        mTmpRect.set(mStatusBar.getContentFrameLw());
        mTmpRect.intersect(displayFrames.mDisplayCutoutSafe);
        mTmpRect.top = mStatusBar.getContentFrameLw().top;  // Ignore top display cutout inset
        mTmpRect.bottom = displayFrames.mStable.top;  // Use collapsed status bar size
        mStatusBarController.setContentFrame(mTmpRect);

        boolean statusBarTransient = (sysui & View.STATUS_BAR_TRANSIENT) != 0;
        boolean statusBarTransient = (sysui & View.STATUS_BAR_TRANSIENT) != 0;
        boolean statusBarTranslucent = (sysui
        boolean statusBarTranslucent = (sysui
                & (View.STATUS_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSPARENT)) != 0;
                & (View.STATUS_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSPARENT)) != 0;
@@ -4838,6 +4845,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                mTmpNavigationFrame, displayFrames.mDisplayCutoutSafe, mTmpNavigationFrame, dcf,
                mTmpNavigationFrame, displayFrames.mDisplayCutoutSafe, mTmpNavigationFrame, dcf,
                mTmpNavigationFrame, displayFrames.mDisplayCutoutSafe,
                mTmpNavigationFrame, displayFrames.mDisplayCutoutSafe,
                displayFrames.mDisplayCutout);
                displayFrames.mDisplayCutout);
        mNavigationBarController.setContentFrame(mNavigationBar.getContentFrameLw());

        if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame);
        if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame);
        return mNavigationBarController.checkHiddenLw();
        return mNavigationBarController.checkHiddenLw();
    }
    }
@@ -8025,11 +8034,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            // If the top fullscreen-or-dimming window is also the top fullscreen, respect
            // If the top fullscreen-or-dimming window is also the top fullscreen, respect
            // its light flag.
            // its light flag.
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            if (!statusColorWin.isLetterboxedForDisplayCutoutLw()) {
                // Only allow white status bar if the window was not letterboxed.
            vis |= PolicyControl.getSystemUiVisibility(statusColorWin, null)
            vis |= PolicyControl.getSystemUiVisibility(statusColorWin, null)
                    & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                    & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            }
        } else if (statusColorWin != null && statusColorWin.isDimming()) {
        } else if (statusColorWin != null && statusColorWin.isDimming()) {
            // Otherwise if it's dimming, clear the light flag.
            // Otherwise if it's dimming, clear the light flag.
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
@@ -8097,15 +8103,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        return vis;
        return vis;
    }
    }


    private boolean drawsSystemBarBackground(WindowState win) {
        return win == null || (win.getAttrs().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0;
    }

    private boolean forcesDrawStatusBarBackground(WindowState win) {
        return win == null || (win.getAttrs().privateFlags
                & PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND) != 0;
    }

    private int updateSystemBarsLw(WindowState win, int oldVis, int vis) {
    private int updateSystemBarsLw(WindowState win, int oldVis, int vis) {
        final boolean dockedStackVisible =
        final boolean dockedStackVisible =
                mWindowManagerInternal.isStackVisible(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
                mWindowManagerInternal.isStackVisible(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
@@ -8129,13 +8126,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                mTopDockedOpaqueWindowState, 0, 0);
                mTopDockedOpaqueWindowState, 0, 0);


        final boolean fullscreenDrawsStatusBarBackground =
        final boolean fullscreenDrawsStatusBarBackground =
                (drawsSystemBarBackground(mTopFullscreenOpaqueWindowState)
                drawsStatusBarBackground(vis, mTopFullscreenOpaqueWindowState);
                        && (vis & View.STATUS_BAR_TRANSLUCENT) == 0)
                || forcesDrawStatusBarBackground(mTopFullscreenOpaqueWindowState);
        final boolean dockedDrawsStatusBarBackground =
        final boolean dockedDrawsStatusBarBackground =
                (drawsSystemBarBackground(mTopDockedOpaqueWindowState)
                drawsStatusBarBackground(dockedVis, mTopDockedOpaqueWindowState);
                        && (dockedVis & View.STATUS_BAR_TRANSLUCENT) == 0)
                || forcesDrawStatusBarBackground(mTopDockedOpaqueWindowState);


        // prevent status bar interaction from clearing certain flags
        // prevent status bar interaction from clearing certain flags
        int type = win.getAttrs().type;
        int type = win.getAttrs().type;
@@ -8238,6 +8231,22 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        return vis;
        return vis;
    }
    }


    private boolean drawsStatusBarBackground(int vis, WindowState win) {
        if (!mStatusBarController.isTransparentAllowed(win)) {
            return false;
        }
        if (win == null) {
            return true;
        }

        final boolean drawsSystemBars =
                (win.getAttrs().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0;
        final boolean forceDrawsSystemBars =
                (win.getAttrs().privateFlags & PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND) != 0;

        return forceDrawsSystemBars || drawsSystemBars && (vis & View.STATUS_BAR_TRANSLUCENT) == 0;
    }

    /**
    /**
     * @return the current visibility flags with the nav-bar opacity related flags toggled based
     * @return the current visibility flags with the nav-bar opacity related flags toggled based
     *         on the nav bar opacity rules chosen by {@link #mNavBarOpacityMode}.
     *         on the nav bar opacity rules chosen by {@link #mNavBarOpacityMode}.
+8 −0
Original line number Original line Diff line number Diff line
@@ -447,6 +447,14 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
            return false;
            return false;
        }
        }


        /**
         * Returns true if the window has a letterbox and any part of that letterbox overlaps with
         * the given {@code rect}.
         */
        default boolean isLetterboxedOverlappingWith(Rect rect) {
            return false;
        }

        /** @return the current windowing mode of this window. */
        /** @return the current windowing mode of this window. */
        int getWindowingMode();
        int getWindowingMode();


+24 −16
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.SurfaceControl.HIDDEN;
import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
@@ -712,7 +711,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        if (destroyedSomething) {
        if (destroyedSomething) {
            final DisplayContent dc = getDisplayContent();
            final DisplayContent dc = getDisplayContent();
            dc.assignWindowLayers(true /*setLayoutNeeded*/);
            dc.assignWindowLayers(true /*setLayoutNeeded*/);
            updateLetterbox(null);
            updateLetterboxSurface(null);
        }
        }
    }
    }


@@ -979,7 +978,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    void removeChild(WindowState child) {
    void removeChild(WindowState child) {
        super.removeChild(child);
        super.removeChild(child);
        checkKeyguardFlagsChanged();
        checkKeyguardFlagsChanged();
        updateLetterbox(child);
        updateLetterboxSurface(child);
    }
    }


    private boolean waitingForReplacement() {
    private boolean waitingForReplacement() {
@@ -1470,7 +1469,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        return isInterestingAndDrawn;
        return isInterestingAndDrawn;
    }
    }


    void updateLetterbox(WindowState winHint) {
    void layoutLetterbox(WindowState winHint) {
        final WindowState w = findMainWindow();
        final WindowState w = findMainWindow();
        if (w != winHint && winHint != null && w != null) {
        if (w != winHint && winHint != null && w != null) {
            return;
            return;
@@ -1481,19 +1480,20 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
            if (mLetterbox == null) {
            if (mLetterbox == null) {
                mLetterbox = new Letterbox(() -> makeChildSurface(null));
                mLetterbox = new Letterbox(() -> makeChildSurface(null));
            }
            }
            mLetterbox.setDimensions(mPendingTransaction, getParent().getBounds(), w.mFrame);
            mLetterbox.layout(getParent().getBounds(), w.mFrame);
        } else if (mLetterbox != null) {
        } else if (mLetterbox != null) {
            final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
            mLetterbox.hide();
            // Make sure we have a transaction here, in case we're called outside of a transaction.
        }
            // This does not use mPendingTransaction, because SurfaceAnimator uses a
    }
            // global transaction in onAnimationEnd.

            SurfaceControl.openTransaction();
    void updateLetterboxSurface(WindowState winHint) {
            try {
        final WindowState w = findMainWindow();
                mLetterbox.hide(t);
        if (w != winHint && winHint != null && w != null) {
            } finally {
            return;
                SurfaceControl.mergeToGlobalTransaction(t);
                SurfaceControl.closeTransaction();
        }
        }
        layoutLetterbox(winHint);
        if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) {
            mLetterbox.applySurfaceChanges(mPendingTransaction);
        }
        }
    }
    }


@@ -2163,4 +2163,12 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
            return new Rect();
            return new Rect();
        }
        }
    }
    }

    /**
     * @eturn true if there is a letterbox and any part of that letterbox overlaps with
     * the given {@code rect}.
     */
    boolean isLetterboxOverlappingWith(Rect rect) {
        return mLetterbox != null && mLetterbox.isOverlappingWith(rect);
    }
}
}
+5 −2
Original line number Original line Diff line number Diff line
@@ -80,7 +80,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_STACK_CRAWLS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_STACK_CRAWLS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -558,6 +557,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                    w.updateLastInsetValues();
                    w.updateLastInsetValues();
                }
                }


                if (w.mAppToken != null) {
                    w.mAppToken.layoutLetterbox(w);
                }

                if (DEBUG_LAYOUT) Slog.v(TAG, "  LAYOUT: mFrame=" + w.mFrame
                if (DEBUG_LAYOUT) Slog.v(TAG, "  LAYOUT: mFrame=" + w.mFrame
                        + " mContainingFrame=" + w.mContainingFrame
                        + " mContainingFrame=" + w.mContainingFrame
                        + " mDisplayFrame=" + w.mDisplayFrame);
                        + " mDisplayFrame=" + w.mDisplayFrame);
@@ -697,7 +700,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo


        final AppWindowToken atoken = w.mAppToken;
        final AppWindowToken atoken = w.mAppToken;
        if (atoken != null) {
        if (atoken != null) {
            atoken.updateLetterbox(w);
            atoken.updateLetterboxSurface(w);
            final boolean updateAllDrawn = atoken.updateDrawnWindowStates(w);
            final boolean updateAllDrawn = atoken.updateDrawnWindowStates(w);
            if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(atoken)) {
            if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(atoken)) {
                mTmpUpdateAllDrawn.add(atoken);
                mTmpUpdateAllDrawn.add(atoken);
Loading