From 1cf5527ae80b52b2451447a8616fe2dbc9546a8b Mon Sep 17 00:00:00 2001 From: Cyrus Boadway Date: Wed, 14 Jul 2021 16:47:25 +0000 Subject: [PATCH] Keep transparent drawable for clipping outline during launch animation During the widget-activity transition, the widget foreground loses its clipping radius, if the clipping is determined by a drawable. We remove the drawable through the animation. For widgets where there is content being clipped by the background's corener radius, this results in the widget window appearing square through the entire animation, then snapping in rounded corners on animation-complete. To solve this, we leave a transparent clone of the drawable in the original drawable's place, for the balance of the animation, providing the outline for clipping. Manual testing against 20 Google widgets showed no regression in behaviour in other cases. Bug: 193665108 Test: manual Change-Id: I3db31e4634c8dd6b22a513a976386d396445ebc2 --- .../quickstep/views/FloatingWidgetBackgroundView.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java index 65dba338f8..1548268891 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java @@ -72,14 +72,20 @@ final class FloatingWidgetBackgroundView extends View { mForegroundProperties.init( mOriginalForeground.getConstantState().newDrawable().mutate()); setForeground(mForegroundProperties.mDrawable); - mSourceView.setForeground(null); + Drawable clipPlaceholder = + mOriginalForeground.getConstantState().newDrawable().mutate(); + clipPlaceholder.setAlpha(0); + mSourceView.setForeground(clipPlaceholder); } if (isSupportedDrawable(backgroundView.getBackground())) { mOriginalBackground = backgroundView.getBackground(); mBackgroundProperties.init( mOriginalBackground.getConstantState().newDrawable().mutate()); setBackground(mBackgroundProperties.mDrawable); - mSourceView.setBackground(null); + Drawable clipPlaceholder = + mOriginalBackground.getConstantState().newDrawable().mutate(); + clipPlaceholder.setAlpha(0); + mSourceView.setBackground(clipPlaceholder); } else if (mOriginalForeground == null) { mFallbackDrawable.setColor(fallbackBackgroundColor); setBackground(mFallbackDrawable);