### Question:
IconCompat { @VisibleForTesting static Bitmap createLegacyIconFromAdaptiveIcon(Bitmap adaptiveIconBitmap, boolean addShadow) { int size = (int) (DEFAULT_VIEW_PORT_SCALE * Math.min(adaptiveIconBitmap.getWidth(), adaptiveIconBitmap.getHeight())); Bitmap icon = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(icon); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); float center = size * 0.5f; float radius = center * ICON_DIAMETER_FACTOR; if (addShadow) { float blur = BLUR_FACTOR * size; paint.setColor(Color.TRANSPARENT); paint.setShadowLayer(blur, 0, KEY_SHADOW_OFFSET_FACTOR * size, KEY_SHADOW_ALPHA << 24); canvas.drawCircle(center, center, radius, paint); paint.setShadowLayer(blur, 0, 0, AMBIENT_SHADOW_ALPHA << 24); canvas.drawCircle(center, center, radius, paint); paint.clearShadowLayer(); } paint.setColor(Color.BLACK); BitmapShader shader = new BitmapShader(adaptiveIconBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); Matrix shift = new Matrix(); shift.setTranslate(-(adaptiveIconBitmap.getWidth() - size) / 2, -(adaptiveIconBitmap.getHeight() - size) / 2); shader.setLocalMatrix(shift); paint.setShader(shader); canvas.drawCircle(center, center, radius, paint); canvas.setBitmap(null); return icon; } private  IconCompat(int mType); static IconCompat createWithResource(Context context, @DrawableRes int resId); static IconCompat createWithBitmap(Bitmap bits); static IconCompat createWithAdaptiveBitmap(Bitmap bits); static IconCompat createWithData(byte[] data, int offset, int length); static IconCompat createWithContentUri(String uri); static IconCompat createWithContentUri(Uri uri); @IconType int getType(); @NonNull String getResPackage(); @IdRes int getResId(); @NonNull Uri getUri(); IconCompat setTint(@ColorInt int tint); IconCompat setTintList(ColorStateList tintList); IconCompat setTintMode(PorterDuff.Mode mode); @RequiresApi(23) Icon toIcon(); Drawable loadDrawable(Context context); @RestrictTo(LIBRARY_GROUP) @SuppressWarnings("deprecation") void addToShortcutIntent(@NonNull Intent outIntent, @Nullable Drawable badge,
            @NonNull Context c); Bundle toBundle(); @Override String toString(); static @Nullable IconCompat createFromBundle(@NonNull Bundle bundle); @RequiresApi(23) @Nullable static IconCompat createFromIcon(@NonNull Icon icon); @IconType @RequiresApi(23) static int getType(@NonNull Icon icon); @Nullable @RequiresApi(23) static String getResPackage(@NonNull Icon icon); @IdRes @RequiresApi(23) static int getResId(@NonNull Icon icon); @Nullable @RequiresApi(23) Uri getUri(@NonNull Icon icon); static final int TYPE_UNKOWN; }### Answer:
@Test public void testClipAdaptiveIcon() throws Throwable { Bitmap source = Bitmap.createBitmap(200, 150, Bitmap.Config.ARGB_8888); source.eraseColor(Color.RED); Bitmap result = IconCompat.createLegacyIconFromAdaptiveIcon(source, false); verifyClippedCircle(result, Color.RED, 100); }