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

Commit 54977fe9 authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Don't throw when request size and docked stack is not visible.

When requesting size for the stack that is next to the dock stack, we
shouldn't crash if the dock stack is not visible (which we would treat
as if it was not availble). We continue to throw an exception if the
docked stack really isn't there, but if it's only not visible, we give
the other stack full screen bounds.

Bug: 25019182
Change-Id: Ia611733590a6cb5a4ef4cc636aa0a2a6a0958ceb
parent 32c97eef
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -16,10 +16,14 @@

package com.android.server.wm;

import static android.app.ActivityManager.*;
import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.DOCKED_STACK_ID;
import static android.app.ActivityManager.FIRST_STATIC_STACK_ID;
import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.LAST_STATIC_STACK_ID;
import static com.android.server.wm.WindowManagerService.DEBUG_TASK_MOVEMENT;
import static com.android.server.wm.WindowManagerService.H.RESIZE_STACK;
import static com.android.server.wm.WindowManagerService.H.UNUSED;
import static com.android.server.wm.WindowManagerService.TAG;

import android.annotation.IntDef;
@@ -30,8 +34,8 @@ import android.util.EventLog;
import android.util.Slog;
import android.util.SparseArray;
import android.view.DisplayInfo;

import android.view.Surface;

import com.android.server.EventLogTags;

import java.io.PrintWriter;
@@ -424,12 +428,19 @@ public class TaskStack implements DimLayer.DimLayerUser {
            return;
        }

        final TaskStack dockedStack = mDisplayContent.getDockedStackLocked();
        final TaskStack dockedStack = mService.mStackIdToStack.get(DOCKED_STACK_ID);
        if (dockedStack == null) {
            // Not sure why you are calling this method when there is no docked stack...
            throw new IllegalStateException(
                    "Calling getStackDockedModeBoundsLocked() when there is no docked stack.");
        }
        if (!dockedStack.isVisibleLocked()) {
            // The docked stack is being dismissed, but we caught before it finished being
            // dismissed. In that case we want to treat it as if it is not occupying any space and
            // let others occupy the whole display.
            mDisplayContent.getLogicalDisplayRect(mTmpRect);
            return;
        }

        @DockSide
        final int dockedSide = dockedStack.getDockSide();