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

Commit b4fb0ca6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Workaround for leaked dim layer."

parents f6ee7f01 f0a60a9c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ public class DimLayer {
        boolean dimFullscreen();
        /** Returns the display info. of the dim layer user. */
        DisplayInfo getDisplayInfo();
        /** Returns true if the dim layer user is currently attached to a display */
        boolean isAttachedToDisplay();
        /** Gets the bounds of the dim layer user. */
        void getDimBounds(Rect outBounds);
        String toShortString();
+15 −2
Original line number Diff line number Diff line
@@ -191,8 +191,21 @@ class DimLayerController {
        boolean result = false;

        for (int i = mState.size() - 1; i >= 0; i--) {
            DimLayer.DimLayerUser user = mState.keyAt(i);
            DimLayerState state = mState.valueAt(i);
            final DimLayer.DimLayerUser user = mState.keyAt(i);
            final DimLayerState state = mState.valueAt(i);

            if (!user.isAttachedToDisplay()) {
                // Leaked dim user that is no longer attached to the display. Go ahead and clean it
                // clean-up and log what happened.
                // TODO: This is a work around for b/34395537 as the dim user should have cleaned-up
                // it self when it was detached from the display. Need to investigate how the dim
                // user is leaking...
                Slog.wtfStack(TAG_WM, "Leaked dim user=" + user.toShortString()
                        + " state=" + state);
                removeDimLayerUser(user);
                continue;
            }

            // 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
+5 −0
Original line number Diff line number Diff line
@@ -834,6 +834,11 @@ public class DockedStackDividerController implements DimLayerUser {
        return mDisplayContent.getDisplayInfo();
    }

    @Override
    public boolean isAttachedToDisplay() {
        return mDisplayContent != null;
    }

    @Override
    public void getDimBounds(Rect outBounds) {
        // This dim layer user doesn't need this.
+6 −1
Original line number Diff line number Diff line
@@ -628,7 +628,12 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU

    @Override
    public DisplayInfo getDisplayInfo() {
        return mStack.getDisplayContent().getDisplayInfo();
        return getDisplayContent().getDisplayInfo();
    }

    @Override
    public boolean isAttachedToDisplay() {
        return getDisplayContent() != null;
    }

    void forceWindowsScaleable(boolean force) {
+5 −0
Original line number Diff line number Diff line
@@ -692,6 +692,11 @@ class TaskPositioner implements DimLayer.DimLayerUser {
        return mTask.mStack.getDisplayInfo();
    }

    @Override
    public boolean isAttachedToDisplay() {
        return mTask != null && mTask.getDisplayContent() != null;
    }

    @Override
    public void getDimBounds(Rect out) {
        // This dim layer user doesn't need this.
Loading