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

Commit 385f03f4 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

Merge "Fixed some issues with fullscreen dimming" into nyc-dev

am: e208bd4c

* commit 'e208bd4c':
  Fixed some issues with fullscreen dimming

Change-Id: Ibf06c08daca76f47a7a3cd8baf94aaf0b4d8adc2
parents 6122c439 e208bd4c
Loading
Loading
Loading
Loading
+28 −21
Original line number Diff line number Diff line
@@ -73,8 +73,8 @@ public class DimLayer {

    /** Interface implemented by users of the dim layer */
    interface DimLayerUser {
        /** Returns true if the user of the dim layer is fullscreen. */
        boolean isFullscreen();
        /** Returns true if the  dim should be fullscreen. */
        boolean dimFullscreen();
        /** Returns the display info. of the dim layer user. */
        DisplayInfo getDisplayInfo();
        /** Gets the bounds of the dim layer user. */
@@ -188,14 +188,23 @@ public class DimLayer {
     * NOTE: Must be called with Surface transaction open.
     */
    private void adjustBounds() {
        if (mUser.dimFullscreen()) {
            getBoundsForFullscreen(mBounds);
        }

        if (mDimSurface != null) {
            mDimSurface.setPosition(mBounds.left, mBounds.top);
            mDimSurface.setSize(mBounds.width(), mBounds.height());
            if (DEBUG_DIM_LAYER) Slog.v(TAG,
                    "adjustBounds user=" + mUser.toShortString() + " mBounds=" + mBounds);
        }

        mLastBounds.set(mBounds);
    }

    private void getBoundsForFullscreen(Rect outBounds) {
        final int dw, dh;
        final float xPos, yPos;
        if (!mUser.isFullscreen()) {
            dw = mBounds.width();
            dh = mBounds.height();
            xPos = mBounds.left;
            yPos = mBounds.top;
        } else {
        // Set surface size to screen size.
        final DisplayInfo info = mUser.getDisplayInfo();
        // Multiply by 1.5 so that rotating a frozen surface that includes this does not expose
@@ -205,14 +214,12 @@ public class DimLayer {
        // back off position so 1/4 of Surface is before and 1/4 is after.
        xPos = -1 * dw / 6;
        yPos = -1 * dh / 6;
        outBounds.set((int) xPos, (int) yPos, (int) xPos + dw, (int) yPos + dh);
    }

        if (mDimSurface != null) {
            mDimSurface.setPosition(xPos, yPos);
            mDimSurface.setSize(dw, dh);
        }

        mLastBounds.set(mBounds);
    void setBoundsForFullscreen() {
        getBoundsForFullscreen(mBounds);
        setBounds(mBounds);
    }

    /** @param bounds The new bounds to set */
+18 −14
Original line number Diff line number Diff line
@@ -48,14 +48,15 @@ class DimLayerController {

    /** Updates the dim layer bounds, recreating it if needed. */
    void updateDimLayer(DimLayer.DimLayerUser dimLayerUser) {
        DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
        final DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
        final boolean previousFullscreen = state.dimLayer != null
                && state.dimLayer == mSharedFullScreenDimLayer;
        DimLayer newDimLayer;
        final int displayId = mDisplayContent.getDisplayId();
        if (dimLayerUser.isFullscreen()) {
            if (previousFullscreen) {
                // Nothing to do here...
        if (dimLayerUser.dimFullscreen()) {
            if (previousFullscreen && mSharedFullScreenDimLayer != null) {
                // Update the bounds for fullscreen in case of rotation.
                mSharedFullScreenDimLayer.setBoundsForFullscreen();
                return;
            }
            // Use shared fullscreen dim layer
@@ -146,7 +147,7 @@ class DimLayerController {
                || !state.animator.getShown()
                || state.animator.mAnimLayer <= newWinAnimator.mAnimLayer)) {
            state.animator = newWinAnimator;
            if (state.animator.mWin.mAppToken == null && !dimLayerUser.isFullscreen()) {
            if (state.animator.mWin.mAppToken == null && !dimLayerUser.dimFullscreen()) {
                // Dim should cover the entire screen for system windows.
                mDisplayContent.getLogicalDisplayRect(mTmpBounds);
            } else {
@@ -190,11 +191,11 @@ class DimLayerController {
        for (int i = mState.size() - 1; i >= 0; i--) {
            DimLayer.DimLayerUser user = mState.keyAt(i);
            DimLayerState state = mState.valueAt(i);
            // We have to check that we are acutally the shared fullscreen layer
            // We have to check that we are actually the shared fullscreen layer
            // for this path. If we began as non fullscreen and became fullscreen
            // (e.g. Docked stack closing), then we may not be the shared layer
            // and we have to make sure we always animate the layer.
            if (user.isFullscreen() && state.dimLayer == mSharedFullScreenDimLayer) {
            if (user.dimFullscreen() && state.dimLayer == mSharedFullScreenDimLayer) {
                fullScreen = i;
                if (mState.valueAt(i).continueDimming) {
                    fullScreenAndDimming = i;
@@ -337,15 +338,18 @@ class DimLayerController {

    void dump(String prefix, PrintWriter pw) {
        pw.println(prefix + "DimLayerController");
        final String doubleSpace = "  ";
        final String prefixPlusDoubleSpace = prefix + doubleSpace;

        for (int i = 0, n = mState.size(); i < n; i++) {
            pw.println(prefix + "  " + mState.keyAt(i).toShortString());
            pw.print(prefix + "    ");
            pw.println(prefixPlusDoubleSpace + mState.keyAt(i).toShortString());
            DimLayerState state = mState.valueAt(i);
            pw.print("dimLayer=" + (state.dimLayer == mSharedFullScreenDimLayer ? "shared" :
                    state.dimLayer));
            pw.print(", animator=" + state.animator);
            pw.println(", continueDimming=" + state.continueDimming + "}");

            pw.println(prefixPlusDoubleSpace + doubleSpace + "dimLayer="
                    + (state.dimLayer == mSharedFullScreenDimLayer ? "shared" : state.dimLayer)
                    + ", animator=" + state.animator + ", continueDimming=" + state.continueDimming);
            if (state.dimLayer != null) {
                state.dimLayer.printTo(prefixPlusDoubleSpace + doubleSpace, pw);
            }
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ public class DockedStackDividerController implements DimLayerUser {
    }

    @Override
    public boolean isFullscreen() {
    public boolean dimFullscreen() {
        return false;
    }

+5 −1
Original line number Diff line number Diff line
@@ -750,7 +750,11 @@ class Task implements DimLayer.DimLayerUser {
    }

    @Override
    public boolean isFullscreen() {
    public boolean dimFullscreen() {
        return isHomeTask() || isFullscreen();
    }

    boolean isFullscreen() {
        if (useCurrentBounds()) {
            return mFullscreen;
        }
+5 −1
Original line number Diff line number Diff line
@@ -515,7 +515,11 @@ class TaskPositioner implements DimLayer.DimLayerUser {
    }

    @Override /** {@link DimLayer.DimLayerUser} */
    public boolean isFullscreen() {
    public boolean dimFullscreen() {
        return isFullscreen();
    }

    boolean isFullscreen() {
        return false;
    }

Loading