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

Commit 7e8eeb79 authored by Chong Zhang's avatar Chong Zhang
Browse files

Remove dead window if its activity record is cleared from history

We keep the dead window if its activity record is kept. However, if
the activity doesn't have any saved state, the record will be removed
too, in that case we have to remove that window.

And add a "apps" option in window dump to retrieve all app windows
regardless of the visible states. We need this to get the windows
that's waiting for replacements.

bug: 26324082

Change-Id: I7179354fe85553a5436b26371d3ad7295a452ce3
parent 11dce732
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -157,8 +157,17 @@ class Task implements DimLayer.DimLayerUser {
        mDeferRemoval = false;
    }

    private boolean hasAppTokensAlive() {
        for (int i = mAppTokens.size() - 1; i >= 0; i--) {
            if (!mAppTokens.get(i).appDied) {
                return true;
            }
        }
        return false;
    }

    void removeLocked() {
        if (!mAppTokens.isEmpty() && mStack.isAnimating()) {
        if (hasAppTokensAlive() && mStack.isAnimating()) {
            if (DEBUG_STACK) Slog.i(TAG_WM, "removeTask: deferring removing taskId=" + mTaskId);
            mDeferRemoval = true;
            return;
+5 −4
Original line number Diff line number Diff line
@@ -9787,8 +9787,9 @@ public class WindowManagerService extends IWindowManager.Stub
    boolean dumpWindows(PrintWriter pw, String name, String[] args,
            int opti, boolean dumpAll) {
        WindowList windows = new WindowList();
        if ("visible".equals(name) || "visible-apps".equals(name)) {
            final boolean appsOnly = "visible-apps".equals(name);
        if ("apps".equals(name) || "visible".equals(name) || "visible-apps".equals(name)) {
            final boolean appsOnly = name.contains("apps");
            final boolean visibleOnly = name.contains("visible");
            synchronized(mWindowMap) {
                final int numDisplays = mDisplayContents.size();
                for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
@@ -9796,8 +9797,8 @@ public class WindowManagerService extends IWindowManager.Stub
                            mDisplayContents.valueAt(displayNdx).getWindowList();
                    for (int winNdx = windowList.size() - 1; winNdx >= 0; --winNdx) {
                        final WindowState w = windowList.get(winNdx);
                        if (w.mWinAnimator.getShown()
                                && (!appsOnly || (appsOnly && w.mAppToken != null))) {
                        if ((!visibleOnly || w.mWinAnimator.getShown())
                                && (!appsOnly || w.mAppToken != null)) {
                            windows.add(w);
                        }
                    }