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

Commit e9e5e51d authored by Tracy Zhou's avatar Tracy Zhou
Browse files

[Live Tile] App surface is above launcher even after reaching Overview

Currently we place app surface below launcher and punch a hole through task view to display live tile in overview. In this change the order will be flipped, with a few benefits not limited to the following. For example, we have a surface view lifecycle bug where the surface view in a live tile app can go blank during app launch transition. This change will significantly mitigate the issue visually as the background wallpaper will not be revealed.

In order to make sure visually everything still looks the same, we will need to finish the recents animation when the user taps on the task view icon, since the menu overlaps with the task snapshort view.

This change also addresses fading out the task view when it's getting dismissed.

Test: manual
Fixes: 186531762
Fixes: 189265196

Change-Id: Ieae67fb89b60136fd81ceb8abde1a0cab8718b27
parent 0a740a07
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package com.android.quickstep.util;

import static com.android.launcher3.states.RotationHelper.deltaRotation;
import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE;
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
import static com.android.quickstep.util.RecentsOrientedState.preDisplayRotation;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;
@@ -62,7 +61,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    private final boolean mIsRecentsRtl;

    private final Rect mTaskRect = new Rect();
    private boolean mDrawsBelowRecents;
    private final PointF mPivot = new PointF();
    private DeviceProfile mDp;

@@ -163,10 +161,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        recentsViewScroll.value = scroll;
    }

    public void setDrawsBelowRecents(boolean drawsBelowRecents) {
        mDrawsBelowRecents = drawsBelowRecents;
    }

    /**
     * Adds animation for all the components corresponding to transition from an app to overview.
     */
@@ -301,12 +295,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        builder.withMatrix(mMatrix)
                .withWindowCrop(mTmpCropRect)
                .withCornerRadius(getCurrentCornerRadius());

        if (LIVE_TILE.get() && params.getRecentsSurface() != null) {
            // When relativeLayer = 0, it reverts the surfaces back to the original order.
            builder.withRelativeLayerTo(params.getRecentsSurface(),
                    mDrawsBelowRecents ? Integer.MIN_VALUE : 0);
        }
    }

    /**
+6 −2
Original line number Diff line number Diff line
@@ -638,7 +638,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        mLiveTileTaskViewSimulator = new TaskViewSimulator(getContext(), getSizeStrategy());
        mLiveTileTaskViewSimulator.recentsViewScale.value = 1;
        mLiveTileTaskViewSimulator.setOrientationState(mOrientationState);
        mLiveTileTaskViewSimulator.setDrawsBelowRecents(true);

        mTintingColor = getForegroundScrimDimColor(context);
    }
@@ -1206,6 +1205,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
            mLiveTileTaskViewSimulator.taskSecondaryTranslation.value = 0;
            mLiveTileTaskViewSimulator.fullScreenProgress.value = 0;
            mLiveTileTaskViewSimulator.recentsViewScale.value = 1;

            mLiveTileParams.setTargetAlpha(1);
        }
        if (mRunningTaskTileHidden) {
            setRunningTaskHidden(mRunningTaskTileHidden);
@@ -1591,7 +1592,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        }
        setEnableDrawingLiveTile(false);
        mLiveTileParams.setTargetSet(null);
        mLiveTileTaskViewSimulator.setDrawsBelowRecents(true);

        // These are relatively expensive and don't need to be done this frame (RecentsView isn't
        // visible anyway), so defer by a frame to get off the critical path, e.g. app to home.
@@ -2173,6 +2173,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        // Use setFloat instead of setViewAlpha as we want to keep the view visible even when it's
        // alpha is set to 0 so that it can be recycled in the view pool properly
        anim.setFloat(taskView, VIEW_ALPHA, 0, clampToProgress(ACCEL, 0, 0.5f));
        if (LIVE_TILE.get() && taskView.isRunningTask()) {
            anim.setFloat(mLiveTileParams, TransformParams.TARGET_ALPHA, 0,
                    clampToProgress(ACCEL, 0, 0.5f));
        }
        SplitSelectStateController splitController = mSplitPlaceholderView.getSplitController();

        ResourceProvider rp = DynamicResource.provider(mActivity);
+1 −12
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.quickstep.views;

import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
import static com.android.quickstep.views.TaskThumbnailView.DIM_ALPHA;

import android.animation.Animator;
@@ -219,17 +218,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
                menuOptionView, mActivity.getDeviceProfile());
        menuOptionView.setEnabled(menuOption.isEnabled());
        menuOptionView.setAlpha(menuOption.isEnabled() ? 1 : 0.5f);
        menuOptionView.setOnClickListener(view -> {
            if (LIVE_TILE.get()) {
                RecentsView recentsView = mTaskView.getRecentsView();
                recentsView.switchToScreenshot(null,
                        () -> recentsView.finishRecentsAnimation(true /* toRecents */,
                                false /* shouldPip */,
                                () -> menuOption.onClick(view)));
            } else {
                menuOption.onClick(view);
            }
        });
        menuOptionView.setOnClickListener(menuOption::onClick);
        mOptionLayout.addView(menuOptionView);
    }

+0 −3
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
    private TaskOverlay mOverlay;
    private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    private final Paint mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    private final Paint mClearPaint = new Paint();
    private final Paint mDimmingPaintAfterClearing = new Paint();
    private final int mDimColor;

@@ -115,7 +114,6 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
        super(context, attrs, defStyleAttr);
        mPaint.setFilterBitmap(true);
        mBackgroundPaint.setColor(Color.WHITE);
        mClearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        mActivity = BaseActivity.fromContext(context);
        // Initialize with placeholder value. It is overridden later by TaskView
        mFullscreenParams = TEMP_PARAMS.get(context);
@@ -308,7 +306,6 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
            float cornerRadius) {
        if (LIVE_TILE.get()) {
            if (mTask != null && getTaskView().isRunningTask() && !getTaskView().showScreenshot()) {
                canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mClearPaint);
                canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius,
                        mDimmingPaintAfterClearing);
                return;
+10 −7
Original line number Diff line number Diff line
@@ -560,14 +560,8 @@ public class TaskView extends FrameLayout implements Reusable {
                    mActivity.getStateManager(), recentsView,
                    recentsView.getDepthController());
            anim.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animator) {
                    recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(false);
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(true);
                    mIsClickableAsLiveTile = true;
                }
            });
@@ -731,7 +725,16 @@ public class TaskView extends FrameLayout implements Reusable {
    private void setIcon(Drawable icon) {
        if (icon != null) {
            mIconView.setDrawable(icon);
            mIconView.setOnClickListener(v -> showTaskMenu());
            mIconView.setOnClickListener(v -> {
                if (LIVE_TILE.get() && isRunningTask()) {
                    RecentsView recentsView = getRecentsView();
                    recentsView.switchToScreenshot(
                            () -> recentsView.finishRecentsAnimation(true /* toRecents */,
                                    this::showTaskMenu));
                } else {
                    showTaskMenu();
                }
            });
            mIconView.setOnLongClickListener(v -> {
                requestDisallowInterceptTouchEvent(true);
                return showTaskMenu();