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

Commit 02319a61 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Associate WindowToken object with only one display at a time

WindowTokens were global objects that contained windows that could
be on multiple displays. This model does not work with the
WindowContainer hierarachy as children (window tokens) can not have
mulitple parents (displays).
We now:
- Track the mapping of binder tokens to window tokens per display
instead of globally . So, you can have a binder token map to
individual WindowToken objects per display.
- WMS.addWindowToken is used to create a WindowToken that clients
can then later add windows to. However, when addWindowToken is called
we don't know the display the client(s) would like to add window to.
So, we track binder tokens that we are allowed to add window for in
the RootWindowContainer and create a window token for the binder on
a specific display when we try to add a window.

Bug: 30060889
Test: Manual testing and existing tests pass.
Change-Id: I81a52a32b01c33ed32169d2da0506b688ea9bc8a
parent 5f9b85ff
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -158,8 +158,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    ArrayDeque<Rect> mFrozenBounds = new ArrayDeque<>();
    ArrayDeque<Rect> mFrozenBounds = new ArrayDeque<>();
    ArrayDeque<Configuration> mFrozenMergedConfig = new ArrayDeque<>();
    ArrayDeque<Configuration> mFrozenMergedConfig = new ArrayDeque<>();


    AppWindowToken(WindowManagerService service, IApplicationToken token, boolean _voiceInteraction) {
    AppWindowToken(WindowManagerService service, IApplicationToken token, boolean _voiceInteraction,
        super(service, token != null ? token.asBinder() : null, TYPE_APPLICATION, true);
            DisplayContent displayContent) {
        super(service, token != null ? token.asBinder() : null, TYPE_APPLICATION, true,
                displayContent);
        appToken = token;
        appToken = token;
        voiceInteraction = _voiceInteraction;
        voiceInteraction = _voiceInteraction;
        mInputApplicationHandle = new InputApplicationHandle(this);
        mInputApplicationHandle = new InputApplicationHandle(this);
@@ -897,7 +899,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    }
    }


    boolean transferStartingWindow(IBinder transferFrom) {
    boolean transferStartingWindow(IBinder transferFrom) {
        final AppWindowToken fromToken = mService.findAppWindowToken(transferFrom);
        final AppWindowToken fromToken = getDisplayContent().getAppWindowToken(transferFrom);
        if (fromToken == null) {
        if (fromToken == null) {
            return false;
            return false;
        }
        }
+57 −2
Original line number Original line Diff line number Diff line
@@ -53,6 +53,7 @@ import android.graphics.Region;
import android.graphics.Region.Op;
import android.graphics.Region.Op;
import android.hardware.display.DisplayManagerInternal;
import android.hardware.display.DisplayManagerInternal;
import android.os.Debug;
import android.os.Debug;
import android.os.IBinder;
import android.util.DisplayMetrics;
import android.util.DisplayMetrics;
import android.util.Slog;
import android.util.Slog;
import android.view.Display;
import android.view.Display;
@@ -66,6 +67,8 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.List;


class DisplayContentList extends ArrayList<DisplayContent> {
class DisplayContentList extends ArrayList<DisplayContent> {
@@ -87,6 +90,9 @@ class DisplayContent extends WindowContainer<TaskStack> {
     * from mDisplayWindows; */
     * from mDisplayWindows; */
    private final WindowList mWindows = new WindowList();
    private final WindowList mWindows = new WindowList();


    // Mapping from a token IBinder to a WindowToken object on this display.
    private final HashMap<IBinder, WindowToken> mTokenMap = new HashMap();

    int mInitialDisplayWidth = 0;
    int mInitialDisplayWidth = 0;
    int mInitialDisplayHeight = 0;
    int mInitialDisplayHeight = 0;
    int mInitialDisplayDensity = 0;
    int mInitialDisplayDensity = 0;
@@ -167,6 +173,35 @@ class DisplayContent extends WindowContainer<TaskStack> {
        return mWindows;
        return mWindows;
    }
    }


    WindowToken getWindowToken(IBinder binder) {
        return mTokenMap.get(binder);
    }

    AppWindowToken getAppWindowToken(IBinder binder) {
        final WindowToken token = getWindowToken(binder);
        if (token == null) {
            return null;
        }
        return token.asAppWindowToken();
    }

    void setWindowToken(IBinder binder, WindowToken token) {
        final DisplayContent dc = mService.mRoot.getWindowTokenDisplay(token);
        if (dc != null) {
            // We currently don't support adding a window token to the display if the display
            // already has the binder mapped to another token. If there is a use case for supporting
            // this moving forward we will either need to merge the WindowTokens some how or have
            // the binder map to a list of window tokens.
            throw new IllegalArgumentException("Can't map token=" + token + " to display=" + this
                    + " already mapped to display=" + dc + " tokens=" + dc.mTokenMap);
        }
        mTokenMap.put(binder, token);
    }

    WindowToken removeWindowToken(IBinder binder) {
        return mTokenMap.remove(binder);
    }

    Display getDisplay() {
    Display getDisplay() {
        return mDisplay;
        return mDisplay;
    }
    }
@@ -342,6 +377,7 @@ class DisplayContent extends WindowContainer<TaskStack> {
            mHomeStack = stack;
            mHomeStack = stack;
        }
        }
        addChild(stack, onTop);
        addChild(stack, onTop);
        stack.onDisplayChanged(this);
    }
    }


    void moveStack(TaskStack stack, boolean toTop) {
    void moveStack(TaskStack stack, boolean toTop) {
@@ -899,7 +935,7 @@ class DisplayContent extends WindowContainer<TaskStack> {
        // position; else we need to look some more.
        // position; else we need to look some more.
        if (pos != null) {
        if (pos != null) {
            // Move behind any windows attached to this one.
            // Move behind any windows attached to this one.
            final WindowToken atoken = mService.mTokenMap.get(pos.mClient.asBinder());
            final WindowToken atoken = getWindowToken(pos.mClient.asBinder());
            if (atoken != null) {
            if (atoken != null) {
                tokenWindowList = getTokenWindowsOnDisplay(atoken);
                tokenWindowList = getTokenWindowsOnDisplay(atoken);
                final int NC = tokenWindowList.size();
                final int NC = tokenWindowList.size();
@@ -929,7 +965,7 @@ class DisplayContent extends WindowContainer<TaskStack> {


        if (pos != null) {
        if (pos != null) {
            // Move in front of any windows attached to this one.
            // Move in front of any windows attached to this one.
            final WindowToken atoken = mService.mTokenMap.get(pos.mClient.asBinder());
            final WindowToken atoken = getWindowToken(pos.mClient.asBinder());
            if (atoken != null) {
            if (atoken != null) {
                final WindowState top = atoken.getTopWindow();
                final WindowState top = atoken.getTopWindow();
                if (top != null && top.mSubLayer >= 0) {
                if (top != null && top.mSubLayer >= 0) {
@@ -1238,6 +1274,25 @@ class DisplayContent extends WindowContainer<TaskStack> {
        }
        }
    }
    }


    void dumpTokens(PrintWriter pw, boolean dumpAll) {
        if (mTokenMap.isEmpty()) {
            return;
        }
        pw.println("  Display #" + mDisplayId);
        final Iterator<WindowToken> it = mTokenMap.values().iterator();
        while (it.hasNext()) {
            final WindowToken token = it.next();
            pw.print("  ");
            pw.print(token);
            if (dumpAll) {
                pw.println(':');
                token.dump(pw, "    ");
            } else {
                pw.println();
            }
        }
    }

    static final class GetWindowOnDisplaySearchResult {
    static final class GetWindowOnDisplaySearchResult {
        boolean reachedToken;
        boolean reachedToken;
        WindowState foundWindow;
        WindowState foundWindow;
+220 −2
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.Rect;
import android.hardware.power.V1_0.PowerHint;
import android.hardware.power.V1_0.PowerHint;
import android.os.Binder;
import android.os.Binder;
import android.os.Debug;
import android.os.Debug;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.RemoteException;
@@ -42,9 +43,11 @@ import com.android.server.input.InputWindowHandle;
import java.io.FileDescriptor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.LinkedList;


import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
@@ -58,8 +61,11 @@ import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static com.android.server.wm.AppTransition.TRANSIT_UNSET;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DISPLAY;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DISPLAY;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_KEEP_SCREEN_ON;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_KEEP_SCREEN_ON;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS;
@@ -79,6 +85,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS;
import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS;
import static com.android.server.wm.WindowManagerService.H.SEND_NEW_CONFIGURATION;
import static com.android.server.wm.WindowManagerService.H.SEND_NEW_CONFIGURATION;
import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD;
import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_PLACING_SURFACES;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_PLACING_SURFACES;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.WINDOWS_FREEZING_SCREENS_NONE;
import static com.android.server.wm.WindowManagerService.WINDOWS_FREEZING_SCREENS_NONE;
@@ -137,6 +144,15 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {


    private final LinkedList<AppWindowToken> mTmpUpdateAllDrawn = new LinkedList();
    private final LinkedList<AppWindowToken> mTmpUpdateAllDrawn = new LinkedList();


    private final ArrayList<WindowToken> mTmpTokensList = new ArrayList();

    // Collection of binder tokens mapped to their window type we are allowed to create window
    // tokens for but that are not current attached to any display. We need to track this here
    // because a binder token can be added through {@link WindowManagerService#addWindowToken},
    // but we don't know what display windows for the token will be added to until
    // {@link WindowManagerService#addWindow} is called.
    private final HashMap<IBinder, Integer> mUnattachedBinderTokens = new HashMap();

    // State for the RemoteSurfaceTrace system used in testing. If this is enabled SurfaceControl
    // State for the RemoteSurfaceTrace system used in testing. If this is enabled SurfaceControl
    // instances will be replaced with an instance that writes a binary representation of all
    // instances will be replaced with an instance that writes a binary representation of all
    // commands to mSurfaceTraceFd.
    // commands to mSurfaceTraceFd.
@@ -179,7 +195,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        return dc;
        return dc;
    }
    }


    private DisplayContent getDisplayContent(int displayId) {
    DisplayContent getDisplayContent(int displayId) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final DisplayContent current = mChildren.get(i);
            final DisplayContent current = mChildren.get(i);
            if (current.getDisplayId() == displayId) {
            if (current.getDisplayId() == displayId) {
@@ -253,7 +269,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        }
        }


        if (!attachedToDisplay) {
        if (!attachedToDisplay) {
            stack.attachDisplayContent(dc);
            dc.attachStack(stack, onTop);
            dc.attachStack(stack, onTop);
        }
        }


@@ -338,6 +353,202 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        return null;
        return null;
    }
    }


    /** Return the window token associated with the input binder token on the input display */
    WindowToken getWindowToken(IBinder binder, DisplayContent dc) {
        final WindowToken token = dc.getWindowToken(binder);
        if (token != null) {
            return token;
        }

        // There is no window token mapped to the binder on the display. Create and map a window
        // token if it is currently allowed.
        if (!mUnattachedBinderTokens.containsKey(binder)) {
            return null;
        }

        final int type = mUnattachedBinderTokens.get(binder);
        return new WindowToken(mService, binder, type, true, dc);
    }

    /** Returns all window tokens mapped to the input binder. */
    ArrayList<WindowToken> getWindowTokens(IBinder binder) {
        mTmpTokensList.clear();
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final DisplayContent dc = mChildren.get(i);
            final WindowToken token = dc.getWindowToken(binder);
            if (token != null) {
                mTmpTokensList.add(token);
            }
        }
        return mTmpTokensList;
    }

    /**
     * Returns the app window token for the input binder if it exist in the system.
     * NOTE: Only one AppWindowToken is allowed to exist in the system for a binder token, since
     * AppWindowToken represents an activity which can only exist on one display.
     */
    AppWindowToken getAppWindowToken(IBinder binder) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final DisplayContent dc = mChildren.get(i);
            final AppWindowToken atoken = dc.getAppWindowToken(binder);
            if (atoken != null) {
                return atoken;
            }
        }
        return null;
    }

    /** Returns the display object the input window token is currently mapped on. */
    DisplayContent getWindowTokenDisplay(WindowToken token) {
        if (token == null) {
            return null;
        }

        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final DisplayContent dc = mChildren.get(i);
            final WindowToken current = dc.getWindowToken(token.token);
            if (current == token) {
                return dc;
            }
        }

        return null;
    }

    void addWindowToken(IBinder binder, int type) {
        if (mUnattachedBinderTokens.containsKey(binder)) {
            Slog.w(TAG_WM, "addWindowToken: Attempted to add existing binder token: " + binder);
            return;
        }

        final ArrayList<WindowToken> tokens = getWindowTokens(binder);

        if (!tokens.isEmpty()) {
            Slog.w(TAG_WM, "addWindowToken: Attempted to add binder token: " + binder
                    + " for already created window tokens: " + tokens);
            return;
        }

        mUnattachedBinderTokens.put(binder, type);

        // TODO(multi-display): By default we add this to the default display, but maybe we
        // should provide an API for a token to be added to any display?
        final WindowToken token = new WindowToken(mService, binder, type, true,
                getDisplayContent(DEFAULT_DISPLAY));
        if (type == TYPE_WALLPAPER) {
            mService.mWallpaperControllerLocked.addWallpaperToken(token);
        }
    }

    ArrayList<WindowToken> removeWindowToken(IBinder binder) {
        mUnattachedBinderTokens.remove(binder);

        mTmpTokensList.clear();
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final DisplayContent dc = mChildren.get(i);
            final WindowToken token = dc.removeWindowToken(binder);
            if (token != null) {
                mTmpTokensList.add(token);
            }
        }
        return mTmpTokensList;
    }

    /**
     * Removed the mapping to the input binder for the system if it no longer as a window token
     * associated with it on any display.
     */
    void removeWindowTokenIfPossible(IBinder binder) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final DisplayContent dc = mChildren.get(i);
            final WindowToken token = dc.getWindowToken(binder);
            if (token != null) {
                return;
            }
        }

        mUnattachedBinderTokens.remove(binder);
    }

    void removeAppToken(IBinder binder) {
        final ArrayList<WindowToken> removedTokens = removeWindowToken(binder);
        if (removedTokens == null || removedTokens.isEmpty()) {
            Slog.w(TAG_WM, "removeAppToken: Attempted to remove non-existing token: " + binder);
            return;
        }

        for (int i = removedTokens.size() - 1; i >= 0; --i) {
            WindowToken wtoken = removedTokens.get(i);
            AppWindowToken appToken = wtoken.asAppWindowToken();

            if (appToken == null) {
                Slog.w(TAG_WM,
                        "Attempted to remove non-App token: " + binder + " wtoken=" + wtoken);
                continue;
            }

            AppWindowToken startingToken = null;

            if (DEBUG_APP_TRANSITIONS) Slog.v(TAG_WM, "Removing app token: " + appToken);

            boolean delayed = appToken.setVisibility(null, false, TRANSIT_UNSET, true,
                    appToken.voiceInteraction);

            mService.mOpeningApps.remove(appToken);
            appToken.waitingToShow = false;
            if (mService.mClosingApps.contains(appToken)) {
                delayed = true;
            } else if (mService.mAppTransition.isTransitionSet()) {
                mService.mClosingApps.add(appToken);
                delayed = true;
            }

            if (DEBUG_APP_TRANSITIONS) Slog.v(TAG_WM, "Removing app " + appToken
                    + " delayed=" + delayed
                    + " animation=" + appToken.mAppAnimator.animation
                    + " animating=" + appToken.mAppAnimator.animating);

            if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG_WM, "removeAppToken: "
                    + appToken + " delayed=" + delayed + " Callers=" + Debug.getCallers(4));

            final TaskStack stack = appToken.mTask.mStack;
            if (delayed && !appToken.isEmpty()) {
                // set the token aside because it has an active animation to be finished
                if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG_WM,
                        "removeAppToken make exiting: " + appToken);
                stack.mExitingAppTokens.add(appToken);
                appToken.mIsExiting = true;
            } else {
                // Make sure there is no animation running on this token, so any windows associated
                // with it will be removed as soon as their animations are complete
                appToken.mAppAnimator.clearAnimation();
                appToken.mAppAnimator.animating = false;
                appToken.removeIfPossible();
            }

            appToken.removed = true;
            if (appToken.startingData != null) {
                startingToken = appToken;
            }
            appToken.stopFreezingScreen(true, true);
            if (mService.mFocusedApp == appToken) {
                if (DEBUG_FOCUS_LIGHT) Slog.v(TAG_WM, "Removing focused app token:" + appToken);
                mService.mFocusedApp = null;
                mService.updateFocusedWindowLocked(
                        UPDATE_FOCUS_NORMAL, true /*updateInputWindows*/);
                mService.mInputMonitor.setFocusedAppLw(null);
            }

            if (!delayed) {
                appToken.updateReportedVisibilityLocked();
            }

            // Will only remove if startingToken non null.
            mService.scheduleRemoveStartingWindowLocked(startingToken);
        }
    }

    // TODO: Users would have their own window containers under the display container?
    // TODO: Users would have their own window containers under the display container?
    void switchUser() {
    void switchUser() {
        final int count = mChildren.size();
        final int count = mChildren.size();
@@ -1361,6 +1572,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        }
        }
    }
    }


    void dumpTokens(PrintWriter pw, boolean dumpAll) {
        pw.println("  All tokens:");
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            mChildren.get(i).dumpTokens(pw, dumpAll);
        }
    }

    @Override
    @Override
    String getName() {
    String getName() {
        return "ROOT";
        return "ROOT";
+10 −8
Original line number Original line Diff line number Diff line
@@ -94,16 +94,16 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
    private boolean mFillsParent = true;
    private boolean mFillsParent = true;


    // Device rotation as of the last time {@link #mBounds} was set.
    // Device rotation as of the last time {@link #mBounds} was set.
    int mRotation;
    private int mRotation;


    /** Density as of last time {@link #mBounds} was set. */
    /** Density as of last time {@link #mBounds} was set. */
    int mDensity;
    private int mDensity;


    /** Support for non-zero {@link android.view.animation.Animation#getBackgroundColor()} */
    /** Support for non-zero {@link android.view.animation.Animation#getBackgroundColor()} */
    DimLayer mAnimationBackgroundSurface;
    private DimLayer mAnimationBackgroundSurface;


    /** The particular window with an Animation with non-zero background color. */
    /** The particular window with an Animation with non-zero background color. */
    WindowStateAnimator mAnimationBackgroundAnimator;
    private WindowStateAnimator mAnimationBackgroundAnimator;


    /** Application tokens that are exiting, but still on screen for animations. */
    /** Application tokens that are exiting, but still on screen for animations. */
    final AppTokenList mExitingAppTokens = new AppTokenList();
    final AppTokenList mExitingAppTokens = new AppTokenList();
@@ -606,12 +606,12 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
        }
        }
    }
    }


    void attachDisplayContent(DisplayContent displayContent) {
    void onDisplayChanged(DisplayContent dc) {
        if (mDisplayContent != null) {
        if (mDisplayContent != null) {
            throw new IllegalStateException("attachDisplayContent: Already attached");
            throw new IllegalStateException("onDisplayChanged: Already attached");
        }
        }


        mDisplayContent = displayContent;
        mDisplayContent = dc;
        mAnimationBackgroundSurface = new DimLayer(mService, this, mDisplayContent.getDisplayId(),
        mAnimationBackgroundSurface = new DimLayer(mService, this, mDisplayContent.getDisplayId(),
                "animation background stackId=" + mStackId);
                "animation background stackId=" + mStackId);


@@ -625,7 +625,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
            // not fullscreen. If it's fullscreen, it means that we are in the transition of
            // not fullscreen. If it's fullscreen, it means that we are in the transition of
            // dismissing it, so we must not resize this stack.
            // dismissing it, so we must not resize this stack.
            bounds = new Rect();
            bounds = new Rect();
            displayContent.getLogicalDisplayRect(mTmpRect);
            dc.getLogicalDisplayRect(mTmpRect);
            mTmpRect2.setEmpty();
            mTmpRect2.setEmpty();
            if (dockedStack != null) {
            if (dockedStack != null) {
                dockedStack.getRawBounds(mTmpRect2);
                dockedStack.getRawBounds(mTmpRect2);
@@ -638,6 +638,8 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
        }
        }


        updateDisplayInfo(bounds);
        updateDisplayInfo(bounds);

        super.onDisplayChanged(dc);
    }
    }


    void getStackDockedModeBoundsLocked(Rect outBounds, boolean ignoreVisibility) {
    void getStackDockedModeBoundsLocked(Rect outBounds, boolean ignoreVisibility) {
+11 −0
Original line number Original line Diff line number Diff line
@@ -254,6 +254,17 @@ class WindowContainer<E extends WindowContainer> implements Comparable<WindowCon
        }
        }
    }
    }


    /**
     * Notify that the display this container is on has changed.
     * @param dc The new display this container is on.
     */
    void onDisplayChanged(DisplayContent dc) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final WindowContainer child = mChildren.get(i);
            child.onDisplayChanged(dc);
        }
    }

    void setWaitingForDrawnIfResizingChanged() {
    void setWaitingForDrawnIfResizingChanged() {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final WindowContainer wc = mChildren.get(i);
            final WindowContainer wc = mChildren.get(i);
Loading