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

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

Merge "Introduced WindowContainer.hasContentToDisplay"

parents 995bb214 44f2180c
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.server.wm;
package com.android.server.wm;


import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYERS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -119,7 +118,7 @@ public class AppWindowAnimator {
            int stackClip) {
            int stackClip) {
        if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting animation in " + mAppToken
        if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting animation in " + mAppToken
                + ": " + anim + " wxh=" + width + "x" + height
                + ": " + anim + " wxh=" + width + "x" + height
                + " isVisible=" + mAppToken.isVisible());
                + " hasContentToDisplay=" + mAppToken.hasContentToDisplay());
        animation = anim;
        animation = anim;
        animating = false;
        animating = false;
        if (!anim.isInitialized()) {
        if (!anim.isInitialized()) {
@@ -141,7 +140,7 @@ public class AppWindowAnimator {
        }
        }
        // Start out animation gone if window is gone, or visible if window is visible.
        // Start out animation gone if window is gone, or visible if window is visible.
        transformation.clear();
        transformation.clear();
        transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
        transformation.setAlpha(mAppToken.hasContentToDisplay() ? 1 : 0);
        hasTransformation = true;
        hasTransformation = true;
        mStackClip = stackClip;
        mStackClip = stackClip;


@@ -164,11 +163,11 @@ public class AppWindowAnimator {


    public void setDummyAnimation() {
    public void setDummyAnimation() {
        if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting dummy animation in " + mAppToken
        if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting dummy animation in " + mAppToken
                + " isVisible=" + mAppToken.isVisible());
                + " hasContentToDisplay=" + mAppToken.hasContentToDisplay());
        animation = sDummyAnimation;
        animation = sDummyAnimation;
        hasTransformation = true;
        hasTransformation = true;
        transformation.clear();
        transformation.clear();
        transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
        transformation.setAlpha(mAppToken.hasContentToDisplay() ? 1 : 0);
    }
    }


    void setNullAnimation() {
    void setNullAnimation() {
+9 −0
Original line number Original line Diff line number Diff line
@@ -358,6 +358,15 @@ class AppWindowToken extends WindowToken {
        return StackId.canReceiveKeys(mTask.mStack.mStackId) || mAlwaysFocusable;
        return StackId.canReceiveKeys(mTask.mStack.mStackId) || mAlwaysFocusable;
    }
    }


    @Override
    boolean isVisible() {
        if (hidden) {
            // TODO: Should this be checking hiddenRequested instead of hidden?
            return false;
        }
        return super.isVisible();
    }

    @Override
    @Override
    void removeIfPossible() {
    void removeIfPossible() {
        mIsExiting = false;
        mIsExiting = false;
+10 −0
Original line number Original line Diff line number Diff line
@@ -579,6 +579,16 @@ class Task implements DimLayer.DimLayerUser {
        return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showForAllUsers;
        return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showForAllUsers;
    }
    }


    boolean hasContentToDisplay() {
        for (int i = mAppTokens.size() - 1; i >= 0; i--) {
            final AppWindowToken appToken = mAppTokens.get(i);
            if (appToken.hasContentToDisplay()) {
                return true;
            }
        }
        return false;
    }

    boolean isVisible() {
    boolean isVisible() {
        for (int i = mAppTokens.size() - 1; i >= 0; i--) {
        for (int i = mAppTokens.size() - 1; i >= 0; i--) {
            final AppWindowToken appToken = mAppTokens.get(i);
            final AppWindowToken appToken = mAppTokens.get(i);
+3 −6
Original line number Original line Diff line number Diff line
@@ -43,7 +43,6 @@ import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseArray;
import android.view.DisplayInfo;
import android.view.DisplayInfo;
import android.view.Surface;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.animation.Animation;
import android.view.animation.Animation;


import com.android.internal.policy.DividerSnapAlgorithm;
import com.android.internal.policy.DividerSnapAlgorithm;
@@ -898,7 +897,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
    void beginImeAdjustAnimation() {
    void beginImeAdjustAnimation() {
        for (int j = mTasks.size() - 1; j >= 0; j--) {
        for (int j = mTasks.size() - 1; j >= 0; j--) {
            final Task task = mTasks.get(j);
            final Task task = mTasks.get(j);
            if (task.isVisible()) {
            if (task.hasContentToDisplay()) {
                task.setDragResizing(true, DRAG_RESIZE_MODE_DOCKED_DIVIDER);
                task.setDragResizing(true, DRAG_RESIZE_MODE_DOCKED_DIVIDER);
                task.setWaitingForDrawnIfResizingChanged();
                task.setWaitingForDrawnIfResizingChanged();
            }
            }
@@ -1201,12 +1200,10 @@ public class TaskStack implements DimLayer.DimLayerUser,


        for (int i = mTasks.size() - 1; i >= 0; i--) {
        for (int i = mTasks.size() - 1; i >= 0; i--) {
            final Task task = mTasks.get(i);
            final Task task = mTasks.get(i);
            for (int j = task.mAppTokens.size() - 1; j >= 0; j--) {
            if (task.isVisible()) {
                if (!task.mAppTokens.get(j).hidden) {
                return true;
                return true;
            }
            }
        }
        }
        }


        return false;
        return false;
    }
    }
+27 −0
Original line number Original line Diff line number Diff line
@@ -193,6 +193,33 @@ class WindowContainer {
        }
        }
    }
    }


    /**
     * Returns true if the container or one of its children as some content it can display or wants
     * to display (e.g. app views or saved surface).
     *
     * NOTE: While this method will return true if the there is some content to display, it doesn't
     * mean the container is visible. Use {@link #isVisible()} to determine if the container is
     * visible.
     */
    boolean hasContentToDisplay() {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final WindowContainer wc = mChildren.get(i);
            if (wc.hasContentToDisplay()) {
                return true;
            }
        }
        return false;
    }

    /**
     * Returns true if the container or one of its children is considered visible from the
     * WindowManager perspective which usually means valid surface and some other internal state
     * are true.
     *
     * NOTE: While this method will return true if the surface is visible, it doesn't mean the
     * client has actually displayed any content. Use {@link #hasContentToDisplay()} to determine if
     * the container has any content to display.
     */
    boolean isVisible() {
    boolean isVisible() {
        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