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

Commit 53a7a92b authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Do not play enter dim animation when starting window is on top of task." into main

parents b58efc3a cf85fdb5
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.server.wm.AlphaAnimationSpecProto.TO;
import static com.android.server.wm.AnimationSpecProto.ALPHA;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_DIMMER;

import android.annotation.NonNull;
import android.graphics.Rect;
import android.util.Log;
import android.util.proto.ProtoOutputStream;
@@ -178,6 +179,7 @@ class Dimmer {
        mSurfaceAnimatorStarter = surfaceAnimatorStarter;
    }

    @NonNull
    WindowContainer<?> getHost() {
        return mHost;
    }
@@ -199,13 +201,6 @@ class Dimmer {
            try {
                final SurfaceControl ctl = makeDimLayer();
                mDimState = new DimState(ctl);
                /**
                 * See documentation on {@link #dimAbove} to understand lifecycle management of
                 * Dim's via state resetting for Dim's with containers.
                 */
                if (container == null) {
                    mDimState.mDontReset = true;
                }
            } catch (Surface.OutOfResourcesException e) {
                Log.w(TAG, "OutOfResourcesException creating dim surface");
            }
@@ -241,7 +236,7 @@ class Dimmer {
     * @param container The container which to dim above. Should be a child of our host.
     * @param alpha     The alpha at which to Dim.
     */
    void dimAbove(WindowContainer container, float alpha) {
    void dimAbove(@NonNull WindowContainer container, float alpha) {
        dim(container, 1, alpha, 0);
    }

@@ -253,7 +248,7 @@ class Dimmer {
     * @param blurRadius The amount of blur added to the Dim.
     */

    void dimBelow(WindowContainer container, float alpha, int blurRadius) {
    void dimBelow(@NonNull WindowContainer container, float alpha, int blurRadius) {
        dim(container, -1, alpha, blurRadius);
    }

@@ -316,8 +311,13 @@ class Dimmer {
            if (!mDimState.isVisible) {
                mDimState.isVisible = true;
                t.show(mDimState.mDimLayer);
                // Skip enter animation while starting window is on top of its activity
                final WindowState ws = mLastRequestedDimContainer.asWindowState();
                if (ws == null || ws.mActivityRecord == null
                        || ws.mActivityRecord.mStartingData == null) {
                    startDimEnter(mLastRequestedDimContainer, mDimState.mSurfaceAnimator, t);
                }
            }
            return true;
        }
    }
+5 −4
Original line number Diff line number Diff line
@@ -440,10 +440,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
    boolean canApplyDim(@NonNull Task task) {
        if (mTransientLaunches == null) return true;
        final Dimmer dimmer = task.getDimmer();
        final WindowContainer<?> dimmerHost = dimmer != null ? dimmer.getHost() : null;
        if (dimmerHost == null) return false;
        if (isInTransientHide(dimmerHost)) {
            // The layer of dimmer is inside transient-hide task, then allow to dim.
        if (dimmer == null) {
            return false;
        }
        if (dimmer.getHost().asTask() != null) {
            // Always allow to dim if the host only affects its task.
            return true;
        }
        // The dimmer host of a translucent task can be a display, then it is not in transient-hide.