diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 1b54211beb..de9b361197 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -783,7 +783,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener final FloatingWidgetView floatingView = FloatingWidgetView.getFloatingWidgetView(mLauncher, v, widgetBackgroundBounds, new Size(windowTargetBounds.width(), windowTargetBounds.height()), - finalWindowRadius); + finalWindowRadius, appTargetsAreTranslucent); final float initialWindowRadius = supportsRoundedCornersOnWindows(mLauncher.getResources()) ? floatingView.getInitialCornerRadius() : 0; diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index d04bfe95e2..bcf66876c1 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1047,7 +1047,7 @@ public abstract class AbsSwipeUpHandler, } protected abstract HomeAnimationFactory createHomeAnimationFactory( - ArrayList launchCookies, long duration); + ArrayList launchCookies, long duration, boolean isTargetTranslucent); private final TaskStackChangeListener mActivityRestartListener = new TaskStackChangeListener() { @Override @@ -1091,7 +1091,9 @@ public abstract class AbsSwipeUpHandler, final ArrayList cookies = runningTaskTarget != null ? runningTaskTarget.taskInfo.launchCookies : new ArrayList<>(); - HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(cookies, duration); + boolean isTranslucent = runningTaskTarget != null && runningTaskTarget.isTranslucent; + HomeAnimationFactory homeAnimFactory = + createHomeAnimationFactory(cookies, duration, isTranslucent); mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome() && runningTaskTarget != null && runningTaskTarget.taskInfo.pictureInPictureParams != null diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java index 9846ee78e3..2d81429a94 100644 --- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java @@ -129,7 +129,7 @@ public class FallbackSwipeHandler extends @Override protected HomeAnimationFactory createHomeAnimationFactory(ArrayList launchCookies, - long duration) { + long duration, boolean isTargetTranslucent) { mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration); ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0); Intent intent = new Intent(mGestureState.getHomeIntent()); diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java index 46cd8a2cf9..267227dce5 100644 --- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java @@ -80,7 +80,7 @@ public class LauncherSwipeHandlerV2 extends @Override protected HomeAnimationFactory createHomeAnimationFactory(ArrayList launchCookies, - long duration) { + long duration, boolean isTargetTranslucent) { if (mActivity == null) { mStateCallback.addChangeListener(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, isPresent -> mRecentsView.startHome()); @@ -103,7 +103,8 @@ public class LauncherSwipeHandlerV2 extends return new LauncherHomeAnimationFactory(); } if (workspaceView instanceof LauncherAppWidgetHostView) { - return createWidgetHomeAnimationFactory((LauncherAppWidgetHostView) workspaceView); + return createWidgetHomeAnimationFactory((LauncherAppWidgetHostView) workspaceView, + isTargetTranslucent); } return createIconHomeAnimationFactory(workspaceView); } @@ -235,7 +236,7 @@ public class LauncherSwipeHandlerV2 extends } private HomeAnimationFactory createWidgetHomeAnimationFactory( - LauncherAppWidgetHostView hostView) { + LauncherAppWidgetHostView hostView, boolean isTargetTranslucent) { RectF backgroundLocation = new RectF(); Rect crop = new Rect(); @@ -243,7 +244,7 @@ public class LauncherSwipeHandlerV2 extends Size windowSize = new Size(crop.width(), crop.height()); FloatingWidgetView floatingWidgetView = FloatingWidgetView.getFloatingWidgetView(mActivity, hostView, backgroundLocation, windowSize, - mTaskViewSimulator.getCurrentCornerRadius()); + mTaskViewSimulator.getCurrentCornerRadius(), isTargetTranslucent); return new LauncherHomeAnimationFactory() { diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java index ed54f1007e..121e09400f 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java @@ -57,6 +57,7 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, private Runnable mEndRunnable; private Runnable mFastFinishRunnable; private Runnable mOnTargetChangeRunnable; + private boolean mAppTargetIsTranslucent; public FloatingWidgetView(Context context) { this(context, null); @@ -142,10 +143,12 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, } private void init(DragLayer dragLayer, LauncherAppWidgetHostView originalView, - RectF widgetBackgroundPosition, Size windowSize, float windowCornerRadius) { + RectF widgetBackgroundPosition, Size windowSize, float windowCornerRadius, + boolean appTargetIsTranslucent) { mAppWidgetView = originalView; mAppWidgetView.beginDeferringUpdates(); mBackgroundPosition = widgetBackgroundPosition; + mAppTargetIsTranslucent = appTargetIsTranslucent; mEndRunnable = () -> finish(dragLayer); mAppWidgetBackgroundView = RoundedCornerEnforcement.findBackground(mAppWidgetView); @@ -155,11 +158,13 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, getRelativePosition(mAppWidgetBackgroundView, dragLayer, mBackgroundPosition); getRelativePosition(mAppWidgetBackgroundView, mAppWidgetView, mBackgroundOffset); - mBackgroundView.init(mAppWidgetView, mAppWidgetBackgroundView, windowCornerRadius); - // Layout call before GhostView creation so that the overlaid view isn't clipped - layout(0, 0, windowSize.getWidth(), windowSize.getHeight()); - mForegroundOverlayView = GhostView.addGhost(mAppWidgetView, this); - positionViews(); + if (!mAppTargetIsTranslucent) { + mBackgroundView.init(mAppWidgetView, mAppWidgetBackgroundView, windowCornerRadius); + // Layout call before GhostView creation so that the overlaid view isn't clipped + layout(0, 0, windowSize.getWidth(), windowSize.getHeight()); + mForegroundOverlayView = GhostView.addGhost(mAppWidgetView, this); + positionViews(); + } mListenerView.setListener(this::fastFinish); dragLayer.addView(mListenerView); @@ -179,7 +184,7 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, */ public void update(RectF backgroundPosition, float floatingWidgetAlpha, float foregroundAlpha, float fallbackBackgroundAlpha, float cornerRadiusProgress) { - if (isUninitialized()) return; + if (isUninitialized() || mAppTargetIsTranslucent) return; setAlpha(floatingWidgetAlpha); mBackgroundView.update(cornerRadiusProgress, fallbackBackgroundAlpha); mAppWidgetView.setAlpha(foregroundAlpha); @@ -203,13 +208,16 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, backgroundParams.height = (int) mBackgroundPosition.height(); mBackgroundView.setLayoutParams(backgroundParams); - sTmpMatrix.reset(); - float foregroundScale = mBackgroundPosition.width() / mAppWidgetBackgroundView.getWidth(); - sTmpMatrix.setTranslate(-mBackgroundOffset.left - mAppWidgetView.getLeft(), - -mBackgroundOffset.top - mAppWidgetView.getTop()); - sTmpMatrix.postScale(foregroundScale, foregroundScale); - sTmpMatrix.postTranslate(mBackgroundPosition.left, mBackgroundPosition.top); - mForegroundOverlayView.setMatrix(sTmpMatrix); + if (mForegroundOverlayView != null) { + sTmpMatrix.reset(); + float foregroundScale = + mBackgroundPosition.width() / mAppWidgetBackgroundView.getWidth(); + sTmpMatrix.setTranslate(-mBackgroundOffset.left - mAppWidgetView.getLeft(), + -mBackgroundOffset.top - mAppWidgetView.getTop()); + sTmpMatrix.postScale(foregroundScale, foregroundScale); + sTmpMatrix.postTranslate(mBackgroundPosition.left, mBackgroundPosition.top); + mForegroundOverlayView.setMatrix(sTmpMatrix); + } } private void finish(DragLayer dragLayer) { @@ -254,7 +262,7 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, */ public static FloatingWidgetView getFloatingWidgetView(Launcher launcher, LauncherAppWidgetHostView originalView, RectF widgetBackgroundPosition, - Size windowSize, float windowCornerRadius) { + Size windowSize, float windowCornerRadius, boolean appTargetsAreTranslucent) { final DragLayer dragLayer = launcher.getDragLayer(); ViewGroup parent = (ViewGroup) dragLayer.getParent(); FloatingWidgetView floatingView = @@ -262,7 +270,7 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, floatingView.recycle(); floatingView.init(dragLayer, originalView, widgetBackgroundPosition, windowSize, - windowCornerRadius); + windowCornerRadius, appTargetsAreTranslucent); parent.addView(floatingView); return floatingView; }