FileDocCategorySizeDatePackage
ComponentInfo.javaAPI DocAndroid 5.1 API6611Thu Mar 12 22:22:10 GMT 2015android.content.pm

ComponentInfo

public class ComponentInfo extends PackageItemInfo
Base class containing information common to all application components ({@link ActivityInfo}, {@link 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.

Fields Summary
public ApplicationInfo
applicationInfo
Global information about the application/package this component is a part of.
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.
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.
public boolean
enabled
Indicates whether or not this component may be instantiated. Note that this value can be overriden by the one in its parent {@link ApplicationInfo}.
public boolean
exported
Set to true if this component is available for use by other applications. Comes from {@link android.R.attr#exported android:exported} of the <activity>, <receiver>, <service>, or <provider> tag.
Constructors Summary
public ComponentInfo()

    
      
    
protected ComponentInfo(android.os.Parcel source)

        super(source);
        applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source);
        processName = source.readString();
        descriptionRes = source.readInt();
        enabled = (source.readInt() != 0);
        exported = (source.readInt() != 0);
    
public ComponentInfo(ComponentInfo orig)

        super(orig);
        applicationInfo = orig.applicationInfo;
        processName = orig.processName;
        descriptionRes = orig.descriptionRes;
        enabled = orig.enabled;
        exported = orig.exported;
    
Methods Summary
protected voiddumpBack(android.util.Printer pw, java.lang.String prefix)

        if (applicationInfo != null) {
            pw.println(prefix + "ApplicationInfo:");
            applicationInfo.dump(pw, prefix + "  ");
        } else {
            pw.println(prefix + "ApplicationInfo: null");
        }
        super.dumpBack(pw, prefix);
    
protected voiddumpFront(android.util.Printer pw, java.lang.String prefix)

        super.dumpFront(pw, prefix);
        pw.println(prefix + "enabled=" + enabled + " exported=" + exported
                + " processName=" + processName);
        if (descriptionRes != 0) {
            pw.println(prefix + "description=" + descriptionRes);
        }
    
protected ApplicationInfogetApplicationInfo()

hide

        return applicationInfo;
    
public final intgetBannerResource()
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.

return
The banner associated with this component.

        return banner != 0 ? banner : applicationInfo.banner;
    
public final intgetIconResource()
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.

return
The icon associated with this component.

        return icon != 0 ? icon : applicationInfo.icon;
    
public final intgetLogoResource()
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.

return
The logo associated with this component.

        return logo != 0 ? logo : applicationInfo.logo;
    
public booleanisEnabled()
Return whether this component and its enclosing application are enabled.

        return enabled && applicationInfo.enabled;
    
protected android.graphics.drawable.DrawableloadDefaultBanner(PackageManager pm)

hide

        return applicationInfo.loadBanner(pm);
    
public android.graphics.drawable.DrawableloadDefaultIcon(PackageManager pm)

hide

        return applicationInfo.loadIcon(pm);
    
protected android.graphics.drawable.DrawableloadDefaultLogo(PackageManager pm)

hide

        return applicationInfo.loadLogo(pm);
    
public java.lang.CharSequenceloadLabel(PackageManager pm)

        if (nonLocalizedLabel != null) {
            return nonLocalizedLabel;
        }
        ApplicationInfo ai = applicationInfo;
        CharSequence label;
        if (labelRes != 0) {
            label = pm.getText(packageName, labelRes, ai);
            if (label != null) {
                return label;
            }
        }
        if (ai.nonLocalizedLabel != null) {
            return ai.nonLocalizedLabel;
        }
        if (ai.labelRes != 0) {
            label = pm.getText(packageName, ai.labelRes, ai);
            if (label != null) {
                return label;
            }
        }
        return name;
    
public voidwriteToParcel(android.os.Parcel dest, int parcelableFlags)

        super.writeToParcel(dest, parcelableFlags);
        applicationInfo.writeToParcel(dest, parcelableFlags);
        dest.writeString(processName);
        dest.writeInt(descriptionRes);
        dest.writeInt(enabled ? 1 : 0);
        dest.writeInt(exported ? 1 : 0);