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

Commit d67569ea authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Fix AlwaysOnTop stack may covered by RemoteAnimation

Merging changes from Change-Id: I8028cd50d66f7d77e5d1ec6514e953c8be9935d6
in TaskViewSimulator

Bug: 151024899
Change-Id: Id41e5af227be2557032387bdaa61cac3458baf32
parent 0dbbd895
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -530,7 +530,7 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity>
    @Override
    protected void initTransitionEndpoints(DeviceProfile dp) {
        super.initTransitionEndpoints(dp);
        mTaskViewSimulator.setDp(dp, false /* isOpening */);
        mTaskViewSimulator.setDp(dp);
        mTaskViewSimulator.setLayoutRotation(
                mDeviceState.getCurrentActiveRotation(),
                mDeviceState.getDisplayRotation());
+2 −12
Original line number Diff line number Diff line
@@ -17,14 +17,11 @@ package com.android.quickstep.util;

import static android.view.Surface.ROTATION_0;

import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.states.RotationHelper.deltaRotation;
import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE;
import static com.android.quickstep.util.AppWindowAnimationHelper.applySurfaceParams;
import static com.android.quickstep.util.RecentsOrientedState.isFixedRotationTransformEnabled;
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;

import android.content.Context;
@@ -71,8 +68,6 @@ public class TaskViewSimulator {
    private RemoteAnimationTargetCompat mRunningTarget;
    private RecentsAnimationTargets mAllTargets;

    // Whether to boost the opening animation target layers, or the closing
    private int mBoostModeTargetLayers = -1;
    private TargetAlphaProvider mTaskAlphaCallback = (t, a) -> a;

    // Thumbnail view properties
@@ -112,10 +107,9 @@ public class TaskViewSimulator {
    /**
     * Sets the device profile for the current state
     */
    public void setDp(DeviceProfile dp, boolean isOpening) {
    public void setDp(DeviceProfile dp) {
        mDp = dp;
        mOrientationState.setMultiWindowMode(mDp.isMultiWindowMode);
        mBoostModeTargetLayers = isOpening ? MODE_OPENING : MODE_CLOSING;
        mLayoutValid = false;
    }

@@ -254,8 +248,7 @@ public class TaskViewSimulator {
        SurfaceParams[] surfaceParams = new SurfaceParams[mAllTargets.unfilteredApps.length];
        for (int i = 0; i < mAllTargets.unfilteredApps.length; i++) {
            RemoteAnimationTargetCompat app = mAllTargets.unfilteredApps[i];
            SurfaceParams.Builder builder = new SurfaceParams.Builder(app.leash)
                    .withLayer(RemoteAnimationProvider.getLayer(app, mBoostModeTargetLayers));
            SurfaceParams.Builder builder = new SurfaceParams.Builder(app.leash);

            if (app.mode == mAllTargets.targetMode) {
                float alpha = mTaskAlphaCallback.getAlpha(app, params.getTargetAlpha());
@@ -276,9 +269,6 @@ public class TaskViewSimulator {
                }
            } else {
                builder.withAlpha(1);
                if (ENABLE_QUICKSTEP_LIVE_TILE.get() && params.isLauncherOnTop()) {
                    builder.withLayer(Integer.MAX_VALUE);
                }
            }
            surfaceParams[i] = builder.build();
        }
+1 −21
Original line number Diff line number Diff line
@@ -25,12 +25,10 @@ import com.android.launcher3.WrappedLauncherAnimationRunner;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.TransactionCompat;

public abstract class RemoteAnimationProvider {

    LauncherAnimationRunner mAnimationRunner;
    static final int Z_BOOST_BASE = 800570000;

    public abstract AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] appTargets,
            RemoteAnimationTargetCompat[] wallpaperTargets);
@@ -52,24 +50,6 @@ public abstract class RemoteAnimationProvider {
                new RemoteAnimationAdapterCompat(wrapper, duration, 0));
    }

    /**
     * Prepares the given {@param targets} for a remote animation, and should be called with the
     * transaction from the first frame of animation.
     *
     * @param boostModeTargets The mode indicating which targets to boost in z-order above other
     *                         targets.
     */
    static void prepareTargetsForFirstFrame(RemoteAnimationTargetCompat[] targets,
            TransactionCompat t, int boostModeTargets) {
        for (RemoteAnimationTargetCompat target : targets) {
            t.show(target.leash);
        }
    }

    public static int getLayer(RemoteAnimationTargetCompat target, int boostModeTarget) {
        return target.prefixOrderIndex;
    }

    /**
     * @return the target with the lowest opaque layer for a certain app animation, or null.
     */
@@ -80,7 +60,7 @@ public abstract class RemoteAnimationProvider {
        for (int i = appTargets.length - 1; i >= 0; i--) {
            RemoteAnimationTargetCompat target = appTargets[i];
            if (target.mode == mode && !target.isTranslucent) {
                int layer = getLayer(target, mode);
                int layer = target.prefixOrderIndex;
                if (layer < lowestLayer) {
                    lowestLayer = layer;
                    lowestLayerIndex = i;
+3 −2
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.quickstep.util;

import static com.android.quickstep.util.RemoteAnimationProvider.prepareTargetsForFirstFrame;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;

import android.animation.ValueAnimator;
@@ -42,7 +41,9 @@ public class RemoteFadeOutAnimationListener implements AnimatorUpdateListener {
    public void onAnimationUpdate(ValueAnimator valueAnimator) {
        TransactionCompat t = new TransactionCompat();
        if (mFirstFrame) {
            prepareTargetsForFirstFrame(mTarget.unfilteredApps, t, MODE_CLOSING);
            for (RemoteAnimationTargetCompat target : mTarget.unfilteredApps) {
                t.show(target.leash);
            }
            mFirstFrame = false;
        }