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

This reverts commit e9e5e51d73.

Reason for revert: This change breaks image indicators feature

Fixes: 195665605
Change-Id: I2abff19955e1594a40f06bfb4972721eed1ee16f
This commit is contained in:
Tracy Zhou 2021-11-02 01:50:13 +00:00
parent 651b93bb53
commit b58eb1bc63
5 changed files with 51 additions and 13 deletions

View File

@ -15,6 +15,7 @@
*/
package com.android.quickstep.util;
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.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
@ -99,6 +100,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
private boolean mLayoutValid = false;
private int mOrientationStateId;
private StagedSplitBounds mStagedSplitBounds;
private boolean mDrawsBelowRecents;
public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
mContext = context;
@ -198,6 +200,10 @@ 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.
*/
@ -351,6 +357,12 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
builder.withMatrix(mMatrix)
.withWindowCrop(mTmpCropRect)
.withCornerRadius(getCurrentCornerRadius());
if (ENABLE_QUICKSTEP_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);
}
}
/**

View File

@ -1911,8 +1911,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
}
}
setEnableDrawingLiveTile(false);
runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTransformParams()
.setTargetSet(null));
runActionOnRemoteHandles(remoteTargetHandle -> {
remoteTargetHandle.getTransformParams().setTargetSet(null);
remoteTargetHandle.getTaskViewSimulator().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.
@ -4368,12 +4370,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
TaskViewSimulator tvs = remoteTargetHandle.getTaskViewSimulator();
tvs.setOrientationState(mOrientationState);
tvs.setDp(mActivity.getDeviceProfile());
tvs.setDrawsBelowRecents(true);
tvs.recentsViewScale.value = 1;
}
}
/** Helper to avoid writing some for-loops to iterate over {@link #mRemoteTargetHandles} */
private void runActionOnRemoteHandles(Consumer<RemoteTargetHandle> consumer) {
public void runActionOnRemoteHandles(Consumer<RemoteTargetHandle> consumer) {
if (mRemoteTargetHandles == null) {
return;
}

View File

@ -16,6 +16,7 @@
package com.android.quickstep.views;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
import static com.android.quickstep.views.TaskThumbnailView.DIM_ALPHA;
@ -242,7 +243,17 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
LayoutParams lp = (LayoutParams) menuOptionView.getLayoutParams();
mTaskView.getPagedOrientationHandler().setLayoutParamsForTaskMenuOptionItem(lp,
menuOptionView, mActivity.getDeviceProfile());
menuOptionView.setOnClickListener(menuOption::onClick);
menuOptionView.setOnClickListener(view -> {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
RecentsView recentsView = mTaskView.getRecentsView();
recentsView.switchToScreenshot(null,
() -> recentsView.finishRecentsAnimation(true /* toRecents */,
false /* shouldPip */,
() -> menuOption.onClick(view)));
} else {
menuOption.onClick(view);
}
});
mOptionLayout.addView(menuOptionView);
}

View File

@ -31,6 +31,8 @@ import android.graphics.ColorFilter;
import android.graphics.Insets;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
@ -78,6 +80,7 @@ public class TaskThumbnailView extends View {
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;
@ -107,6 +110,7 @@ public class TaskThumbnailView extends View {
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);
@ -271,6 +275,7 @@ public class TaskThumbnailView extends View {
float cornerRadius) {
if (ENABLE_QUICKSTEP_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;

View File

@ -94,6 +94,7 @@ import com.android.quickstep.util.CancellableTask;
import com.android.quickstep.util.LauncherSplitScreenListener;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.TaskCornerRadius;
import com.android.quickstep.util.TaskViewSimulator;
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
import com.android.systemui.shared.recents.model.Task;
@ -624,8 +625,22 @@ public class TaskView extends FrameLayout implements Reusable {
mActivity.getStateManager(), recentsView,
recentsView.getDepthController());
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
recentsView.runActionOnRemoteHandles(
(Consumer<RemoteTargetHandle>) remoteTargetHandle ->
remoteTargetHandle
.getTaskViewSimulator()
.setDrawsBelowRecents(false));
}
@Override
public void onAnimationEnd(Animator animator) {
recentsView.runActionOnRemoteHandles(
(Consumer<RemoteTargetHandle>) remoteTargetHandle ->
remoteTargetHandle
.getTaskViewSimulator()
.setDrawsBelowRecents(true));
mIsClickableAsLiveTile = true;
}
});
@ -821,15 +836,7 @@ public class TaskView extends FrameLayout implements Reusable {
if (confirmSecondSplitSelectApp()) {
return;
}
if (ENABLE_QUICKSTEP_LIVE_TILE.get() && isRunningTask()) {
RecentsView recentsView = getRecentsView();
recentsView.switchToScreenshot(
() -> recentsView.finishRecentsAnimation(true /* toRecents */,
false /* shouldPip */,
() -> showTaskMenu(iconView)));
} else {
showTaskMenu(iconView);
}
showTaskMenu(iconView);
});
iconView.setOnLongClickListener(v -> {
requestDisallowInterceptTouchEvent(true);