ComponentInfo


public class ComponentInfo
extends PackageItemInfo

java.lang.Object
   ↳ android.content.pm.PackageItemInfo
     ↳ android.content.pm.ComponentInfo
ActivityInfo Information you can retrieve about a particular application activity or receiver. 
ProviderInfo Holds information about a specific content provider
ServiceInfo Information you can retrieve about a particular application service. 


Base class containing information common to all application components (ActivityInfo, ServiceInfo). This class is not intended to be used by itself; it is simply here to share common definitions between all application components. As such, it does not itself implement Parcelable, but does provide convenience methods to assist in the implementation of Parcelable in subclasses.

Summary

Fields

public ApplicationInfo applicationInfo

Global information about the application/package this component is a part of.

public String[] attributionTags

Set of attribution tags that should be automatically applied to this component.

public int descriptionRes

A string resource identifier (in the package's resources) containing a user-readable description of the component.

public boolean directBootAware

Indicates if this component is aware of direct boot lifecycle, and can be safely run before the user has entered their credentials (such as a lock pattern or PIN).

public boolean enabled

Indicates whether or not this component may be instantiated.

public boolean exported

Set to true if this component is available for use by other applications.

public String processName

The name of the process this component should run in.

public String splitName

The name of the split in which this component is declared.

Inherited fields

public int banner

A drawable resource identifier (in the package's resources) of this component's banner.

public int icon

A drawable resource identifier (in the package's resources) of this component's icon.

public boolean isArchived

Whether the package is currently in an archived state.

public int labelRes

A string resource identifier (in the package's resources) of this component's label.

public int logo

A drawable resource identifier (in the package's resources) of this component's logo.

public Bundle metaData

Additional meta-data associated with this component.

public String name

Public name of this item.

public CharSequence nonLocalizedLabel

The string provided in the AndroidManifest file, if any.

public String packageName

Name of the package that this item is in.

Public constructors

ComponentInfo()
ComponentInfo(ComponentInfo orig)

Protected constructors

ComponentInfo(Parcel source)

Public methods

final int getBannerResource()

Return the banner resource identifier to use for this component.

final int getIconResource()

Return the icon resource identifier to use for this component.

final int getLogoResource()

Return the logo resource identifier to use for this component.

boolean isEnabled()

Return whether this component and its enclosing application are enabled.

void writeToParcel(Parcel dest, int parcelableFlags)

Protected methods

void dumpBack(Printer pw, String prefix)
void dumpFront(Printer pw, String prefix)

Inherited methods

void dumpBack(Printer pw, String prefix)
void dumpFront(Printer pw, String prefix)
Drawable loadBanner(PackageManager pm)

Retrieve the current graphical banner associated with this item.

Drawable loadIcon(PackageManager pm)

Retrieve the current graphical icon associated with this item.

CharSequence loadLabel(PackageManager pm)

Retrieve the current textual label associated with this item.

Drawable loadLogo(PackageManager pm)

Retrieve the current graphical logo associated with this item.

Drawable loadUnbadgedIcon(PackageManager pm)

Retrieve the current graphical icon associated with this item without the addition of a work badge if applicable.

XmlResourceParser loadXmlMetaData(PackageManager pm, String name)

Load an XML resource attached to the meta-data of this item.

void writeToParcel(Parcel dest, int parcelableFlags)
Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Fields

applicationInfo

Added in API level 1
public ApplicationInfo applicationInfo

Global information about the application/package this component is a part of.

attributionTags

Added in API level 31
public String[] attributionTags

Set of attribution tags that should be automatically applied to this component.

When this component represents an Activity, Service, ContentResolver or BroadcastReceiver, each instance will be automatically configured with Context.createAttributionContext using the first attribution tag contained here.

Additionally, when this component represents a BroadcastReceiver and the sender of a broadcast requires the receiver to hold one or more specific permissions, those permission checks will be performed using each of the attributions tags contained here.

descriptionRes

Added in API level 8
public int descriptionRes

A string resource identifier (in the package's resources) containing a user-readable description of the component. From the "description" attribute or, if not set, 0.

directBootAware

Added in API level 24
public boolean directBootAware

Indicates if this component is aware of direct boot lifecycle, and can be safely run before the user has entered their credentials (such as a lock pattern or PIN).

enabled

Added in API level 1
public boolean enabled

Indicates whether or not this component may be instantiated. Note that this value can be overridden by the one in its parent ApplicationInfo.

exported

Added in API level 1
public boolean exported

Set to true if this component is available for use by other applications. Comes from android:exported of the <activity>, <receiver>, <service>, or <provider> tag.

processName

Added in API level 1
public String processName

The name of the process this component should run in. From the "android:process" attribute or, if not set, the same as applicationInfo.processName.

splitName

Added in API level 26
public String splitName

The name of the split in which this component is declared. Null if the component was declared in the base APK.

Public constructors

ComponentInfo

Added in API level 1
public ComponentInfo ()

ComponentInfo

Added in API level 1
public ComponentInfo (ComponentInfo orig)

Parameters
orig ComponentInfo

Protected constructors

ComponentInfo

Added in API level 1
protected ComponentInfo (Parcel source)

Parameters
source Parcel

Public methods

getBannerResource

Added in API level 20
public final int getBannerResource ()

Return the banner resource identifier to use for this component. If the component defines a banner, that is used; else, the application banner is used.

Returns
int The banner associated with this component.

getIconResource

Added in API level 1
public final int getIconResource ()

Return the icon resource identifier to use for this component. If the component defines an icon, that is used; else, the application icon is used.

Returns
int The icon associated with this component.

getLogoResource

Added in API level 19
public final int getLogoResource ()

Return the logo resource identifier to use for this component. If the component defines a logo, that is used; else, the application logo is used.

Returns
int The logo associated with this component.

isEnabled

Added in API level 11
public boolean isEnabled ()

Return whether this component and its enclosing application are enabled.

Returns
boolean

writeToParcel

Added in API level 1
public void writeToParcel (Parcel dest, 
                int parcelableFlags)

Parameters
dest Parcel

parcelableFlags int

Protected methods

dumpBack

Added in API level 1
protected void dumpBack (Printer pw, 
                String prefix)

Parameters
pw Printer

prefix String

dumpFront

Added in API level 1
protected void dumpFront (Printer pw, 
                String prefix)

Parameters
pw Printer

prefix String