Merge "Bubble API: add support for URI based icons"

This commit is contained in:
Mady Mellor
2020-01-27 22:52:03 +00:00
committed by Android (Google) Code Review

View File

@@ -17,6 +17,8 @@
package android.app;
import static android.annotation.Dimension.DP;
import static android.graphics.drawable.Icon.TYPE_URI;
import static android.graphics.drawable.Icon.TYPE_URI_ADAPTIVE_BITMAP;
import static com.android.internal.util.ContrastColorUtil.satisfiesTextContrast;
@@ -2504,6 +2506,14 @@ public class Notification implements Parcelable
}
}
}
if (mBubbleMetadata != null && mBubbleMetadata.getBubbleIcon() != null) {
final Icon icon = mBubbleMetadata.getBubbleIcon();
final int iconType = icon.getType();
if (iconType == TYPE_URI_ADAPTIVE_BITMAP || iconType == TYPE_URI) {
visitor.accept(icon.getUri());
}
}
}
/**
@@ -8900,6 +8910,12 @@ public class Notification implements Parcelable
if (icon == null) {
throw new IllegalArgumentException("Bubbles require non-null icon");
}
if (icon.getType() != TYPE_URI_ADAPTIVE_BITMAP
&& icon.getType() != TYPE_URI) {
Log.w(TAG, "Bubbles work best with icons of TYPE_URI or "
+ "TYPE_URI_ADAPTIVE_BITMAP. "
+ "In the future, using an icon of this type will be required.");
}
mShortcutId = null;
mPendingIntent = intent;
mIcon = icon;