Merge "Anti-alias TaskThumbnailView" into ub-launcher3-qt-dev
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 2574665..24a8be5 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -74,6 +74,7 @@
public static final float SHAPE_PROGRESS_DURATION = 0.15f;
private static final int FADE_DURATION_MS = 200;
private static final Rect sTmpRect = new Rect();
+ private static final Object[] sTmpObjArray = new Object[1];
private Runnable mEndRunnable;
private CancellationSignal mLoadIconSignal;
@@ -263,10 +264,7 @@
Drawable drawable = null;
boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get()
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
- if (!supportsAdaptiveIcons && v instanceof BubbleTextView) {
- // Similar to DragView, we simply use the BubbleTextView icon here.
- drawable = ((BubbleTextView) v).getIcon();
- }
+ Drawable btvIcon = v instanceof BubbleTextView ? ((BubbleTextView) v).getIcon() : null;
if (info instanceof SystemShortcut) {
if (v instanceof ImageView) {
drawable = ((ImageView) v).getDrawable();
@@ -275,10 +273,24 @@
} else {
drawable = v.getBackground();
}
- }
- if (drawable == null) {
- drawable = Utilities.getFullDrawable(launcher, info, lp.width, lp.height,
- false, new Object[1]);
+ } else {
+ if (supportsAdaptiveIcons) {
+ drawable = Utilities.getFullDrawable(launcher, info, lp.width, lp.height,
+ false, sTmpObjArray);
+ if (!(drawable instanceof AdaptiveIconDrawable)) {
+ // The drawable we get back is not an adaptive icon, so we need to use the
+ // BubbleTextView icon that is already legacy treated.
+ drawable = btvIcon;
+ }
+ } else {
+ if (v instanceof BubbleTextView) {
+ // Similar to DragView, we simply use the BubbleTextView icon here.
+ drawable = btvIcon;
+ } else {
+ drawable = Utilities.getFullDrawable(launcher, info, lp.width, lp.height,
+ false, sTmpObjArray);
+ }
+ }
}
Drawable finalDrawable = drawable == null ? null
diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
index 84452b4..06a8bca 100644
--- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
@@ -71,25 +71,25 @@
}
@Test
- @Ignore // Convert test to TAPL and enable them; b/131116002
+ // Convert test to TAPL b/131116002
public void testWidgetConfig() throws Throwable {
runTest(false, true);
}
@Test
- @Ignore // Convert test to TAPL and enable them; b/131116002
+ @Ignore // b/121280703
public void testWidgetConfig_rotate() throws Throwable {
runTest(true, true);
}
@Test
- @Ignore // Convert test to TAPL and enable them; b/131116002
+ // Convert test to TAPL b/131116002
public void testConfigCancelled() throws Throwable {
runTest(false, false);
}
@Test
- @Ignore // Convert test to TAPL and enable them; b/131116002
+ @Ignore // b/121280703
public void testConfigCancelled_rotate() throws Throwable {
runTest(true, false);
}
diff --git a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java
index 90c339f..7bebf2f 100644
--- a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java
@@ -49,19 +49,19 @@
@Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grantWidgetBind();
@Test
- @Ignore // Convert test to TAPL and enable them; b/131116002
public void testDragIcon_portrait() throws Throwable {
lockRotation(true);
performTest();
}
@Test
- @Ignore // Convert test to TAPL and enable them; b/131116002
+ @Ignore // b/121280703
public void testDragIcon_landscape() throws Throwable {
lockRotation(false);
performTest();
}
+ // b/131116002
private void performTest() throws Throwable {
clearHomescreen();
mActivityMonitor.startLauncher();