Adds MaskableIconDrawable class to android.graphics.drawable package
Test: manual test ag/1774462, cts tests ag/1813947 Bug: 32063838 Design doc: http://go/layered-icons-eng - Reads in the mask path from config. - If <maskable-icon> is dynamically created, clip the drawable using the mask path. - Instead of using clipPath method, used BitmapShader for performance. Change-Id: If5b4a24127bf823477c6c5d8a81d5093501d58e7
This commit is contained in:
@@ -13640,6 +13640,23 @@ package android.graphics.drawable {
|
||||
method public void addLevel(int, int, android.graphics.drawable.Drawable);
|
||||
}
|
||||
|
||||
public class MaskableIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
|
||||
ctor public MaskableIconDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
|
||||
method public void draw(android.graphics.Canvas);
|
||||
method public android.graphics.drawable.Drawable getBackground();
|
||||
method public android.graphics.drawable.Drawable getForeground();
|
||||
method public android.graphics.Path getIconMask();
|
||||
method public int getOpacity();
|
||||
method public void invalidateDrawable(android.graphics.drawable.Drawable);
|
||||
method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long);
|
||||
method public void setAlpha(int);
|
||||
method public void setColorFilter(android.graphics.ColorFilter);
|
||||
method public void setOpacity(int);
|
||||
method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
|
||||
field public static final float DEFAULT_VIEW_PORT_SCALE = 0.6666667f;
|
||||
field public static final float MASK_SIZE = 100.0f;
|
||||
}
|
||||
|
||||
public class NinePatchDrawable extends android.graphics.drawable.Drawable {
|
||||
ctor public deprecated NinePatchDrawable(android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String);
|
||||
ctor public NinePatchDrawable(android.content.res.Resources, android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String);
|
||||
|
||||
@@ -14183,6 +14183,23 @@ package android.graphics.drawable {
|
||||
method public void addLevel(int, int, android.graphics.drawable.Drawable);
|
||||
}
|
||||
|
||||
public class MaskableIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
|
||||
ctor public MaskableIconDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
|
||||
method public void draw(android.graphics.Canvas);
|
||||
method public android.graphics.drawable.Drawable getBackground();
|
||||
method public android.graphics.drawable.Drawable getForeground();
|
||||
method public android.graphics.Path getIconMask();
|
||||
method public int getOpacity();
|
||||
method public void invalidateDrawable(android.graphics.drawable.Drawable);
|
||||
method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long);
|
||||
method public void setAlpha(int);
|
||||
method public void setColorFilter(android.graphics.ColorFilter);
|
||||
method public void setOpacity(int);
|
||||
method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
|
||||
field public static final float DEFAULT_VIEW_PORT_SCALE = 0.6666667f;
|
||||
field public static final float MASK_SIZE = 100.0f;
|
||||
}
|
||||
|
||||
public class NinePatchDrawable extends android.graphics.drawable.Drawable {
|
||||
ctor public deprecated NinePatchDrawable(android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String);
|
||||
ctor public NinePatchDrawable(android.content.res.Resources, android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String);
|
||||
|
||||
@@ -13672,6 +13672,23 @@ package android.graphics.drawable {
|
||||
method public void addLevel(int, int, android.graphics.drawable.Drawable);
|
||||
}
|
||||
|
||||
public class MaskableIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
|
||||
ctor public MaskableIconDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
|
||||
method public void draw(android.graphics.Canvas);
|
||||
method public android.graphics.drawable.Drawable getBackground();
|
||||
method public android.graphics.drawable.Drawable getForeground();
|
||||
method public android.graphics.Path getIconMask();
|
||||
method public int getOpacity();
|
||||
method public void invalidateDrawable(android.graphics.drawable.Drawable);
|
||||
method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long);
|
||||
method public void setAlpha(int);
|
||||
method public void setColorFilter(android.graphics.ColorFilter);
|
||||
method public void setOpacity(int);
|
||||
method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
|
||||
field public static final float DEFAULT_VIEW_PORT_SCALE = 0.6666667f;
|
||||
field public static final float MASK_SIZE = 100.0f;
|
||||
}
|
||||
|
||||
public class NinePatchDrawable extends android.graphics.drawable.Drawable {
|
||||
ctor public deprecated NinePatchDrawable(android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String);
|
||||
ctor public NinePatchDrawable(android.content.res.Resources, android.graphics.Bitmap, byte[], android.graphics.Rect, java.lang.String);
|
||||
|
||||
@@ -5843,6 +5843,14 @@
|
||||
<attr name="color" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Drawable used to draw masked icons with foreground and background layers. -->
|
||||
<declare-styleable name="MaskableIconDrawableLayer">
|
||||
<!-- The color to use for the layer, only if drawable is not defined. -->
|
||||
<attr name="color" />
|
||||
<!-- The drawable to use for the layer. -->
|
||||
<attr name="drawable" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Drawable used to show animated touch feedback. -->
|
||||
<declare-styleable name="RippleDrawable">
|
||||
<!-- The color to use for ripple effects. This attribute is required. -->
|
||||
|
||||
@@ -2711,6 +2711,9 @@
|
||||
<!-- Component name of the default cell broadcast receiver -->
|
||||
<string name="config_defaultCellBroadcastReceiverComponent" translatable="false">com.android.cellbroadcastreceiver/.PrivilegedCellBroadcastReceiver</string>
|
||||
|
||||
<!-- Specifies the path that is used by MaskableIconDrawable class to crop launcher icons. -->
|
||||
<string name="config_icon_mask" translatable="false">"M50,0L100,0 100,100 0,100 0,0z"</string>
|
||||
|
||||
<!-- The component name, flattened to a string, for the default accessibility service to be
|
||||
enabled by the accessibility shortcut. This service must be trusted, as it can be activated
|
||||
without explicit consent of the user. If no accessibility service with the specified name
|
||||
|
||||
@@ -2796,6 +2796,8 @@
|
||||
|
||||
<java-symbol type="raw" name="fallback_categories" />
|
||||
|
||||
<java-symbol type="string" name="config_icon_mask" />
|
||||
|
||||
<java-symbol type="attr" name="primaryContentAlpha" />
|
||||
|
||||
<!-- Accessibility Shortcut -->
|
||||
|
||||
@@ -147,6 +147,8 @@ public final class DrawableInflater {
|
||||
return new TransitionDrawable();
|
||||
case "ripple":
|
||||
return new RippleDrawable();
|
||||
case "maskable-icon":
|
||||
return new MaskableIconDrawable();
|
||||
case "color":
|
||||
return new ColorDrawable();
|
||||
case "shape":
|
||||
|
||||
1001
graphics/java/android/graphics/drawable/MaskableIconDrawable.java
Normal file
1001
graphics/java/android/graphics/drawable/MaskableIconDrawable.java
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user