Loading api/current.xml +284 −13 Original line number Diff line number Diff line Loading @@ -2136,7 +2136,7 @@ type="int" transient="false" volatile="false" value="16843454" value="16843521" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -2356,7 +2356,7 @@ type="int" transient="false" volatile="false" value="16843460" value="16843527" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -3027,7 +3027,7 @@ type="int" transient="false" volatile="false" value="16843463" value="16843530" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -4204,7 +4204,7 @@ type="int" transient="false" volatile="false" value="16843458" value="16843525" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -4237,7 +4237,7 @@ type="int" transient="false" volatile="false" value="16843461" value="16843528" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -5861,6 +5861,50 @@ visibility="public" > </field> <field name="kraken_resource_pad56" type="int" transient="false" volatile="false" value="16843465" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad57" type="int" transient="false" volatile="false" value="16843464" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad58" type="int" transient="false" volatile="false" value="16843463" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad59" type="int" transient="false" volatile="false" value="16843462" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad6" type="int" transient="false" Loading @@ -5872,6 +5916,83 @@ visibility="public" > </field> <field name="kraken_resource_pad60" type="int" transient="false" volatile="false" value="16843461" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad61" type="int" transient="false" volatile="false" value="16843460" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad62" type="int" transient="false" volatile="false" value="16843459" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad63" type="int" transient="false" volatile="false" value="16843458" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad64" type="int" transient="false" volatile="false" value="16843457" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad65" type="int" transient="false" volatile="false" value="16843456" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad66" type="int" transient="false" volatile="false" value="16843455" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad7" type="int" transient="false" Loading Loading @@ -6455,6 +6576,17 @@ visibility="public" > </field> <field name="logo" type="int" transient="false" volatile="false" value="16843454" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="longClickable" type="int" transient="false" Loading Loading @@ -8241,7 +8373,7 @@ type="int" transient="false" volatile="false" value="16843455" value="16843522" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -8439,7 +8571,7 @@ type="int" transient="false" volatile="false" value="16843456" value="16843523" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -9638,7 +9770,7 @@ type="int" transient="false" volatile="false" value="16843459" value="16843526" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -9671,7 +9803,7 @@ type="int" transient="false" volatile="false" value="16843462" value="16843529" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -9858,7 +9990,7 @@ type="int" transient="false" volatile="false" value="16843457" value="16843524" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -10419,7 +10551,7 @@ type="int" transient="false" volatile="false" value="16843465" value="16843532" static="true" final="true" deprecated="not deprecated" Loading @@ -10430,7 +10562,7 @@ type="int" transient="false" volatile="false" value="16843464" value="16843531" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -47848,6 +47980,19 @@ <parameter name="pm" type="android.content.pm.PackageManager"> </parameter> </method> <method name="loadLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="pm" type="android.content.pm.PackageManager"> </parameter> </method> <method name="loadXmlMetaData" return="android.content.res.XmlResourceParser" abstract="false" Loading Loading @@ -47898,6 +48043,16 @@ visibility="public" > </field> <field name="logo" type="int" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="metaData" type="android.os.Bundle" transient="false" Loading Loading @@ -48180,6 +48335,36 @@ <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activityName" type="android.content.ComponentName"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="intent" type="android.content.Intent"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getAllPermissionGroups" return="java.util.List<android.content.pm.PermissionGroupInfo>" abstract="true" Loading Loading @@ -48264,6 +48449,34 @@ <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="packageName" type="java.lang.String"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getComponentEnabledSetting" return="int" abstract="true" Loading Loading @@ -153121,6 +153334,36 @@ <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activityName" type="android.content.ComponentName"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="intent" type="android.content.Intent"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getAllPermissionGroups" return="java.util.List<android.content.pm.PermissionGroupInfo>" abstract="false" Loading Loading @@ -153205,6 +153448,34 @@ <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="packageName" type="java.lang.String"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getComponentEnabledSetting" return="int" abstract="false" Loading Loading @@ -158851,7 +159122,7 @@ > <parameter name="text" type="java.lang.CharSequence"> </parameter> <parameter name="p" type="android.text.TextPaint"> <parameter name="paint" type="android.text.TextPaint"> </parameter> <parameter name="avail" type="float"> </parameter> core/java/android/app/ContextImpl.java +33 −0 Original line number Diff line number Diff line Loading @@ -2174,6 +2174,39 @@ class ContextImpl extends Context { return getApplicationIcon(getApplicationInfo(packageName, 0)); } @Override public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException { return getActivityInfo(activityName, 0).loadLogo(this); } @Override public Drawable getActivityLogo(Intent intent) throws NameNotFoundException { if (intent.getComponent() != null) { return getActivityLogo(intent.getComponent()); } ResolveInfo info = resolveActivity( intent, PackageManager.MATCH_DEFAULT_ONLY); if (info != null) { return info.activityInfo.loadLogo(this); } throw new NameNotFoundException(intent.toUri(0)); } @Override public Drawable getApplicationLogo(ApplicationInfo info) { return info.loadLogo(this); } @Override public Drawable getApplicationLogo(String packageName) throws NameNotFoundException { return getApplicationLogo(getApplicationInfo(packageName, 0)); } @Override public Resources getResourcesForActivity( ComponentName activityName) throws NameNotFoundException { return getResourcesForApplication( Loading core/java/android/content/pm/ComponentInfo.java +8 −0 Original line number Diff line number Diff line Loading @@ -154,6 +154,14 @@ public class ComponentInfo extends PackageItemInfo { return applicationInfo.loadIcon(pm); } /** * @hide */ @Override protected Drawable loadDefaultLogo(PackageManager pm) { return applicationInfo.loadLogo(pm); } /** * @hide */ Loading core/java/android/content/pm/PackageItemInfo.java +47 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ public class PackageItemInfo { */ public int icon; /** * A drawable resource identifier (in the package's resources) of this * component's logo. Logos may be larger/wider than icons and are * displayed by certain UI elements in place of a name or name/icon * combination. From the "logo" attribute or, if not set, 0. */ public int logo; /** * Additional meta-data associated with this component. This field * will only be filled in if you set the Loading @@ -84,6 +92,7 @@ public class PackageItemInfo { nonLocalizedLabel = orig.nonLocalizedLabel; if (nonLocalizedLabel != null) nonLocalizedLabel = nonLocalizedLabel.toString().trim(); icon = orig.icon; logo = orig.logo; metaData = orig.metaData; } Loading Loading @@ -151,6 +160,42 @@ public class PackageItemInfo { return pm.getDefaultActivityIcon(); } /** * Retrieve the current graphical logo associated with this item. This * will call back on the given PackageManager to load the logo from * the application. * * @param pm A PackageManager from which the logo can be loaded; usually * the PackageManager from which you originally retrieved this item. * * @return Returns a Drawable containing the item's logo. If the item * does not have a logo, this method will return null. */ public Drawable loadLogo(PackageManager pm) { if (logo != 0) { Drawable d = pm.getDrawable(packageName, logo, getApplicationInfo()); if (d != null) { return d; } } return loadDefaultLogo(pm); } /** * Retrieve the default graphical logo associated with this item. * * @param pm A PackageManager from which the logo can be loaded; usually * the PackageManager from which you originally retrieved this item. * * @return Returns a Drawable containing the item's default logo * or null if no default logo is available. * * @hide */ protected Drawable loadDefaultLogo(PackageManager pm) { return null; } /** * Load an XML resource attached to the meta-data of this item. This will * retrieved the name meta-data entry, and if defined call back on the Loading Loading @@ -196,6 +241,7 @@ public class PackageItemInfo { dest.writeInt(labelRes); TextUtils.writeToParcel(nonLocalizedLabel, dest, parcelableFlags); dest.writeInt(icon); dest.writeInt(logo); dest.writeBundle(metaData); } Loading @@ -206,6 +252,7 @@ public class PackageItemInfo { nonLocalizedLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); icon = source.readInt(); logo = source.readInt(); metaData = source.readBundle(); } Loading core/java/android/content/pm/PackageManager.java +73 −0 Original line number Diff line number Diff line Loading @@ -1596,6 +1596,79 @@ public abstract class PackageManager { public abstract Drawable getApplicationIcon(String packageName) throws NameNotFoundException; /** * Retrieve the logo associated with an activity. Given the full name of * an activity, retrieves the information about it and calls * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo. * If the activity can not be found, NameNotFoundException is thrown. * * @param activityName Name of the activity whose logo is to be retrieved. * * @return Returns the image of the logo or null if the activity has no * logo specified. * * @throws NameNotFoundException Thrown if the resources for the given * activity could not be loaded. * * @see #getActivityLogo(Intent) */ public abstract Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException; /** * Retrieve the logo associated with an Intent. If intent.getClassName() is * set, this simply returns the result of * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's * component and returns the logo associated with the resolved component. * If intent.getClassName() can not be found or the Intent can not be resolved * to a component, NameNotFoundException is thrown. * * @param intent The intent for which you would like to retrieve a logo. * * @return Returns the image of the logo, or null if the activity has no * logo specified. * * @throws NameNotFoundException Thrown if the resources for application * matching the given intent could not be loaded. * * @see #getActivityLogo(ComponentName) */ public abstract Drawable getActivityLogo(Intent intent) throws NameNotFoundException; /** * Retrieve the logo associated with an application. If it has not specified * a logo, this method returns null. * * @param info Information about application being queried. * * @return Returns the image of the logo, or null if no logo is specified * by the application. * * @see #getApplicationLogo(String) */ public abstract Drawable getApplicationLogo(ApplicationInfo info); /** * Retrieve the logo associated with an application. Given the name of the * application's package, retrieves the information about it and calls * getApplicationLogo() to return its logo. If the application can not be * found, NameNotFoundException is thrown. * * @param packageName Name of the package whose application logo is to be * retrieved. * * @return Returns the image of the logo, or null if no application logo * has been specified. * * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded. * * @see #getApplicationLogo(ApplicationInfo) */ public abstract Drawable getApplicationLogo(String packageName) throws NameNotFoundException; /** * Retrieve text from a package. This is a low-level API used by * the various package manager info structures (such as Loading Loading
api/current.xml +284 −13 Original line number Diff line number Diff line Loading @@ -2136,7 +2136,7 @@ type="int" transient="false" volatile="false" value="16843454" value="16843521" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -2356,7 +2356,7 @@ type="int" transient="false" volatile="false" value="16843460" value="16843527" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -3027,7 +3027,7 @@ type="int" transient="false" volatile="false" value="16843463" value="16843530" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -4204,7 +4204,7 @@ type="int" transient="false" volatile="false" value="16843458" value="16843525" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -4237,7 +4237,7 @@ type="int" transient="false" volatile="false" value="16843461" value="16843528" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -5861,6 +5861,50 @@ visibility="public" > </field> <field name="kraken_resource_pad56" type="int" transient="false" volatile="false" value="16843465" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad57" type="int" transient="false" volatile="false" value="16843464" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad58" type="int" transient="false" volatile="false" value="16843463" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad59" type="int" transient="false" volatile="false" value="16843462" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad6" type="int" transient="false" Loading @@ -5872,6 +5916,83 @@ visibility="public" > </field> <field name="kraken_resource_pad60" type="int" transient="false" volatile="false" value="16843461" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad61" type="int" transient="false" volatile="false" value="16843460" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad62" type="int" transient="false" volatile="false" value="16843459" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad63" type="int" transient="false" volatile="false" value="16843458" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad64" type="int" transient="false" volatile="false" value="16843457" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad65" type="int" transient="false" volatile="false" value="16843456" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad66" type="int" transient="false" volatile="false" value="16843455" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="kraken_resource_pad7" type="int" transient="false" Loading Loading @@ -6455,6 +6576,17 @@ visibility="public" > </field> <field name="logo" type="int" transient="false" volatile="false" value="16843454" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="longClickable" type="int" transient="false" Loading Loading @@ -8241,7 +8373,7 @@ type="int" transient="false" volatile="false" value="16843455" value="16843522" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -8439,7 +8571,7 @@ type="int" transient="false" volatile="false" value="16843456" value="16843523" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -9638,7 +9770,7 @@ type="int" transient="false" volatile="false" value="16843459" value="16843526" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -9671,7 +9803,7 @@ type="int" transient="false" volatile="false" value="16843462" value="16843529" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -9858,7 +9990,7 @@ type="int" transient="false" volatile="false" value="16843457" value="16843524" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -10419,7 +10551,7 @@ type="int" transient="false" volatile="false" value="16843465" value="16843532" static="true" final="true" deprecated="not deprecated" Loading @@ -10430,7 +10562,7 @@ type="int" transient="false" volatile="false" value="16843464" value="16843531" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -47848,6 +47980,19 @@ <parameter name="pm" type="android.content.pm.PackageManager"> </parameter> </method> <method name="loadLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="pm" type="android.content.pm.PackageManager"> </parameter> </method> <method name="loadXmlMetaData" return="android.content.res.XmlResourceParser" abstract="false" Loading Loading @@ -47898,6 +48043,16 @@ visibility="public" > </field> <field name="logo" type="int" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="metaData" type="android.os.Bundle" transient="false" Loading Loading @@ -48180,6 +48335,36 @@ <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activityName" type="android.content.ComponentName"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="intent" type="android.content.Intent"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getAllPermissionGroups" return="java.util.List<android.content.pm.PermissionGroupInfo>" abstract="true" Loading Loading @@ -48264,6 +48449,34 @@ <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="packageName" type="java.lang.String"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getComponentEnabledSetting" return="int" abstract="true" Loading Loading @@ -153121,6 +153334,36 @@ <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activityName" type="android.content.ComponentName"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getActivityLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="intent" type="android.content.Intent"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getAllPermissionGroups" return="java.util.List<android.content.pm.PermissionGroupInfo>" abstract="false" Loading Loading @@ -153205,6 +153448,34 @@ <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="info" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="getApplicationLogo" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="packageName" type="java.lang.String"> </parameter> <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException"> </exception> </method> <method name="getComponentEnabledSetting" return="int" abstract="false" Loading Loading @@ -158851,7 +159122,7 @@ > <parameter name="text" type="java.lang.CharSequence"> </parameter> <parameter name="p" type="android.text.TextPaint"> <parameter name="paint" type="android.text.TextPaint"> </parameter> <parameter name="avail" type="float"> </parameter>
core/java/android/app/ContextImpl.java +33 −0 Original line number Diff line number Diff line Loading @@ -2174,6 +2174,39 @@ class ContextImpl extends Context { return getApplicationIcon(getApplicationInfo(packageName, 0)); } @Override public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException { return getActivityInfo(activityName, 0).loadLogo(this); } @Override public Drawable getActivityLogo(Intent intent) throws NameNotFoundException { if (intent.getComponent() != null) { return getActivityLogo(intent.getComponent()); } ResolveInfo info = resolveActivity( intent, PackageManager.MATCH_DEFAULT_ONLY); if (info != null) { return info.activityInfo.loadLogo(this); } throw new NameNotFoundException(intent.toUri(0)); } @Override public Drawable getApplicationLogo(ApplicationInfo info) { return info.loadLogo(this); } @Override public Drawable getApplicationLogo(String packageName) throws NameNotFoundException { return getApplicationLogo(getApplicationInfo(packageName, 0)); } @Override public Resources getResourcesForActivity( ComponentName activityName) throws NameNotFoundException { return getResourcesForApplication( Loading
core/java/android/content/pm/ComponentInfo.java +8 −0 Original line number Diff line number Diff line Loading @@ -154,6 +154,14 @@ public class ComponentInfo extends PackageItemInfo { return applicationInfo.loadIcon(pm); } /** * @hide */ @Override protected Drawable loadDefaultLogo(PackageManager pm) { return applicationInfo.loadLogo(pm); } /** * @hide */ Loading
core/java/android/content/pm/PackageItemInfo.java +47 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ public class PackageItemInfo { */ public int icon; /** * A drawable resource identifier (in the package's resources) of this * component's logo. Logos may be larger/wider than icons and are * displayed by certain UI elements in place of a name or name/icon * combination. From the "logo" attribute or, if not set, 0. */ public int logo; /** * Additional meta-data associated with this component. This field * will only be filled in if you set the Loading @@ -84,6 +92,7 @@ public class PackageItemInfo { nonLocalizedLabel = orig.nonLocalizedLabel; if (nonLocalizedLabel != null) nonLocalizedLabel = nonLocalizedLabel.toString().trim(); icon = orig.icon; logo = orig.logo; metaData = orig.metaData; } Loading Loading @@ -151,6 +160,42 @@ public class PackageItemInfo { return pm.getDefaultActivityIcon(); } /** * Retrieve the current graphical logo associated with this item. This * will call back on the given PackageManager to load the logo from * the application. * * @param pm A PackageManager from which the logo can be loaded; usually * the PackageManager from which you originally retrieved this item. * * @return Returns a Drawable containing the item's logo. If the item * does not have a logo, this method will return null. */ public Drawable loadLogo(PackageManager pm) { if (logo != 0) { Drawable d = pm.getDrawable(packageName, logo, getApplicationInfo()); if (d != null) { return d; } } return loadDefaultLogo(pm); } /** * Retrieve the default graphical logo associated with this item. * * @param pm A PackageManager from which the logo can be loaded; usually * the PackageManager from which you originally retrieved this item. * * @return Returns a Drawable containing the item's default logo * or null if no default logo is available. * * @hide */ protected Drawable loadDefaultLogo(PackageManager pm) { return null; } /** * Load an XML resource attached to the meta-data of this item. This will * retrieved the name meta-data entry, and if defined call back on the Loading Loading @@ -196,6 +241,7 @@ public class PackageItemInfo { dest.writeInt(labelRes); TextUtils.writeToParcel(nonLocalizedLabel, dest, parcelableFlags); dest.writeInt(icon); dest.writeInt(logo); dest.writeBundle(metaData); } Loading @@ -206,6 +252,7 @@ public class PackageItemInfo { nonLocalizedLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); icon = source.readInt(); logo = source.readInt(); metaData = source.readBundle(); } Loading
core/java/android/content/pm/PackageManager.java +73 −0 Original line number Diff line number Diff line Loading @@ -1596,6 +1596,79 @@ public abstract class PackageManager { public abstract Drawable getApplicationIcon(String packageName) throws NameNotFoundException; /** * Retrieve the logo associated with an activity. Given the full name of * an activity, retrieves the information about it and calls * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo. * If the activity can not be found, NameNotFoundException is thrown. * * @param activityName Name of the activity whose logo is to be retrieved. * * @return Returns the image of the logo or null if the activity has no * logo specified. * * @throws NameNotFoundException Thrown if the resources for the given * activity could not be loaded. * * @see #getActivityLogo(Intent) */ public abstract Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException; /** * Retrieve the logo associated with an Intent. If intent.getClassName() is * set, this simply returns the result of * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's * component and returns the logo associated with the resolved component. * If intent.getClassName() can not be found or the Intent can not be resolved * to a component, NameNotFoundException is thrown. * * @param intent The intent for which you would like to retrieve a logo. * * @return Returns the image of the logo, or null if the activity has no * logo specified. * * @throws NameNotFoundException Thrown if the resources for application * matching the given intent could not be loaded. * * @see #getActivityLogo(ComponentName) */ public abstract Drawable getActivityLogo(Intent intent) throws NameNotFoundException; /** * Retrieve the logo associated with an application. If it has not specified * a logo, this method returns null. * * @param info Information about application being queried. * * @return Returns the image of the logo, or null if no logo is specified * by the application. * * @see #getApplicationLogo(String) */ public abstract Drawable getApplicationLogo(ApplicationInfo info); /** * Retrieve the logo associated with an application. Given the name of the * application's package, retrieves the information about it and calls * getApplicationLogo() to return its logo. If the application can not be * found, NameNotFoundException is thrown. * * @param packageName Name of the package whose application logo is to be * retrieved. * * @return Returns the image of the logo, or null if no application logo * has been specified. * * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded. * * @see #getApplicationLogo(ApplicationInfo) */ public abstract Drawable getApplicationLogo(String packageName) throws NameNotFoundException; /** * Retrieve text from a package. This is a low-level API used by * the various package manager info structures (such as Loading