Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f665a329 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

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
parent a132bbd5
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -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);
+17 −0
Original line number Diff line number Diff line
@@ -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);
+17 −0
Original line number Diff line number Diff line
@@ -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);
+8 −0
Original line number Diff line number Diff line
@@ -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. -->
+3 −0
Original line number Diff line number Diff line
@@ -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
Loading