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

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

Merge "Skip traversal of invisible visibility change"

parents 2967bebf 6bb5bedc
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -1554,9 +1554,14 @@ public final class ViewRootImpl implements ViewParent,

    void handleAppVisibility(boolean visible) {
        if (mAppVisible != visible) {
            final boolean previousVisible = getHostVisibility() == View.VISIBLE;
            mAppVisible = visible;
            final boolean currentVisible = getHostVisibility() == View.VISIBLE;
            // Root view only cares about whether it is visible or not.
            if (previousVisible != currentVisible) {
                mAppVisibilityChanged = true;
                scheduleTraversals();
            }
            if (!mAppVisible) {
                WindowManagerGlobal.trimForeground();
            }
@@ -1846,8 +1851,13 @@ public final class ViewRootImpl implements ViewParent,
                renderer.setStopped(mStopped);
            }
            if (!mStopped) {
                mNewSurfaceNeeded = true;
                // Unnecessary to traverse if the window is not yet visible.
                if (getHostVisibility() == View.VISIBLE) {
                    // Make sure that relayoutWindow will be called to get valid surface because
                    // the previous surface may have been released.
                    mAppVisibilityChanged = true;
                    scheduleTraversals();
                }
            } else {
                if (renderer != null) {
                    renderer.destroyHardwareResources(mView);
@@ -2028,7 +2038,8 @@ public final class ViewRootImpl implements ViewParent,
    }

    int getHostVisibility() {
        return (mAppVisible || mForceDecorViewVisibility) ? mView.getVisibility() : View.GONE;
        return mView != null && (mAppVisible || mForceDecorViewVisibility)
                ? mView.getVisibility() : View.GONE;
    }

    /**