Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -11842,6 +11842,7 @@ package android.content.pm { method public boolean hasSigningCertificate(int, @NonNull byte[], int); method public abstract boolean hasSystemFeature(@NonNull String); method public abstract boolean hasSystemFeature(@NonNull String, int); method public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable); method public boolean isDeviceUpgrading(); method public abstract boolean isInstantApp(); method public abstract boolean isInstantApp(@NonNull String); core/java/android/content/pm/PackageManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.content.pm.dex.ArtManager; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.graphics.Rect; import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.Drawable; import android.net.wifi.WifiManager; import android.os.Build; Loading Loading @@ -7619,4 +7620,19 @@ public abstract class PackageManager { "sendDeviceCustomizationReadyBroadcast not implemented in subclass"); } /** * Returns if the provided drawable represents the default activity icon provided by the system. * * PackageManager provides a default icon for any package/activity if the app itself does not * define one or if the system encountered any error when loading the icon. * * @return true if the drawable represents the default activity icon, false otherwise * @see #getDefaultActivityIcon() */ public boolean isDefaultApplicationIcon(@NonNull Drawable drawable) { int resId = drawable instanceof AdaptiveIconDrawable ? ((AdaptiveIconDrawable) drawable).getSourceDrawableResId() : Resources.ID_NULL; return resId == com.android.internal.R.drawable.sym_def_app_icon || resId == com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon; } } graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.graphics.drawable; import android.annotation.DrawableRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; Loading Loading @@ -223,6 +224,7 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback final int deviceDensity = Drawable.resolveDensity(r, 0); state.setDensity(deviceDensity); state.mSrcDensityOverride = mSrcDensityOverride; state.mSourceDrawableId = Resources.getAttributeSetSourceResId(attrs); final ChildDrawable[] array = state.mChildren; for (int i = 0; i < state.mChildren.length; i++) { Loading Loading @@ -445,6 +447,17 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback } } /** * If the drawable was inflated from XML, this returns the resource ID for the drawable * * @hide */ @DrawableRes public int getSourceDrawableResId() { final LayerState state = mLayerState; return state == null ? Resources.ID_NULL : state.mSourceDrawableId; } /** * Inflates child layers using the specified parser. */ Loading Loading @@ -944,6 +957,8 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback @Config int mChangingConfigurations; @Config int mChildrenChangingConfigurations; @DrawableRes int mSourceDrawableId = Resources.ID_NULL; private boolean mCheckedOpacity; private int mOpacity; Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -11842,6 +11842,7 @@ package android.content.pm { method public boolean hasSigningCertificate(int, @NonNull byte[], int); method public abstract boolean hasSystemFeature(@NonNull String); method public abstract boolean hasSystemFeature(@NonNull String, int); method public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable); method public boolean isDeviceUpgrading(); method public abstract boolean isInstantApp(); method public abstract boolean isInstantApp(@NonNull String);
core/java/android/content/pm/PackageManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.content.pm.dex.ArtManager; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.graphics.Rect; import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.Drawable; import android.net.wifi.WifiManager; import android.os.Build; Loading Loading @@ -7619,4 +7620,19 @@ public abstract class PackageManager { "sendDeviceCustomizationReadyBroadcast not implemented in subclass"); } /** * Returns if the provided drawable represents the default activity icon provided by the system. * * PackageManager provides a default icon for any package/activity if the app itself does not * define one or if the system encountered any error when loading the icon. * * @return true if the drawable represents the default activity icon, false otherwise * @see #getDefaultActivityIcon() */ public boolean isDefaultApplicationIcon(@NonNull Drawable drawable) { int resId = drawable instanceof AdaptiveIconDrawable ? ((AdaptiveIconDrawable) drawable).getSourceDrawableResId() : Resources.ID_NULL; return resId == com.android.internal.R.drawable.sym_def_app_icon || resId == com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon; } }
graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.graphics.drawable; import android.annotation.DrawableRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; Loading Loading @@ -223,6 +224,7 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback final int deviceDensity = Drawable.resolveDensity(r, 0); state.setDensity(deviceDensity); state.mSrcDensityOverride = mSrcDensityOverride; state.mSourceDrawableId = Resources.getAttributeSetSourceResId(attrs); final ChildDrawable[] array = state.mChildren; for (int i = 0; i < state.mChildren.length; i++) { Loading Loading @@ -445,6 +447,17 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback } } /** * If the drawable was inflated from XML, this returns the resource ID for the drawable * * @hide */ @DrawableRes public int getSourceDrawableResId() { final LayerState state = mLayerState; return state == null ? Resources.ID_NULL : state.mSourceDrawableId; } /** * Inflates child layers using the specified parser. */ Loading Loading @@ -944,6 +957,8 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback @Config int mChangingConfigurations; @Config int mChildrenChangingConfigurations; @DrawableRes int mSourceDrawableId = Resources.ID_NULL; private boolean mCheckedOpacity; private int mOpacity; Loading