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
diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java
index 65dba33..1548268 100644
--- a/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java
+++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java
@@ -72,14 +72,20 @@
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);