SharedLibraryInfo

public final class SharedLibraryInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.content.pm.SharedLibraryInfo


This class provides information for a shared library. There are four types of shared libraries: builtin - non-updatable part of the OS; dynamic - updatable backwards-compatible dynamically linked; static - non backwards-compatible emulating static linking; SDK - updatable backwards-incompatible dynamically loaded.

Summary

Constants

int TYPE_BUILTIN

Shared library type: this library is a part of the OS and cannot be updated or uninstalled.

int TYPE_DYNAMIC

Shared library type: this library is backwards-compatible, can be updated, and updates can be uninstalled.

int TYPE_SDK_PACKAGE

SDK package shared library type: this library is not compatible between versions, can be updated and updates can be uninstalled.

int TYPE_STATIC

Shared library type: this library is not backwards -compatible, can be updated and updates can be uninstalled.

int VERSION_UNDEFINED

Constant for referring to an undefined version.

Inherited constants

Fields

public static final Creator<SharedLibraryInfo> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

VersionedPackage getDeclaringPackage()

Gets the package that declares the library.

List<VersionedPackage> getDependentPackages()

Gets the packages that depend on the library.

long getLongVersion()

Gets the version of the library.

String getName()

Gets the library name an app defines in its manifest to depend on the library.

List<VersionedPackage> getOptionalDependentPackages()

Gets the packages that optionally depend on the library.

int getType()

Gets the type of this library.

int getVersion()

This method was deprecated in API level 28. Use getLongVersion() instead.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel parcel, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

TYPE_BUILTIN

Added in API level 26
public static final int TYPE_BUILTIN

Shared library type: this library is a part of the OS and cannot be updated or uninstalled.

Constant Value: 0 (0x00000000)

TYPE_DYNAMIC

Added in API level 26
public static final int TYPE_DYNAMIC

Shared library type: this library is backwards-compatible, can be updated, and updates can be uninstalled. Clients link against the latest version of the library.

Constant Value: 1 (0x00000001)

TYPE_SDK_PACKAGE

Added in API level 33
public static final int TYPE_SDK_PACKAGE

SDK package shared library type: this library is not compatible between versions, can be updated and updates can be uninstalled. Clients depend on a specific version of the library. SDK packages are not loaded automatically by the OS and rely e.g. on 3P libraries to make them available for the clients.

Constant Value: 3 (0x00000003)

TYPE_STATIC

Added in API level 26
public static final int TYPE_STATIC

Shared library type: this library is not backwards -compatible, can be updated and updates can be uninstalled. Clients link against a specific version of the library. Static shared libraries simulate static linking while allowing for multiple clients to reuse the same instance of the library.

Constant Value: 2 (0x00000002)

VERSION_UNDEFINED

Added in API level 26
public static final int VERSION_UNDEFINED

Constant for referring to an undefined version.

Constant Value: -1 (0xffffffff)

Fields

CREATOR

Added in API level 26
public static final Creator<SharedLibraryInfo> CREATOR

Public methods

describeContents

Added in API level 26
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getDeclaringPackage

Added in API level 26
public VersionedPackage getDeclaringPackage ()

Gets the package that declares the library.

Returns
VersionedPackage The package declaring the library. This value cannot be null.

getDependentPackages

Added in API level 26
public List<VersionedPackage> getDependentPackages ()

Gets the packages that depend on the library. NOTE: the list also contains the result of getOptionalDependentPackages().

Returns
List<VersionedPackage> The dependent packages. This value cannot be null.

getLongVersion

Added in API level 28
public long getLongVersion ()

Gets the version of the library. For static libraries this is the declared version and for dynamic and builtin it is VERSION_UNDEFINED as these are not versioned.

Returns
long The version. Value is -1 or greater

getName

Added in API level 26
public String getName ()

Gets the library name an app defines in its manifest to depend on the library.

Returns
String The name.

getOptionalDependentPackages

public List<VersionedPackage> getOptionalDependentPackages ()

Gets the packages that optionally depend on the library.

Returns
List<VersionedPackage> The dependent packages. This value cannot be null.

getType

Added in API level 26
public int getType ()

Gets the type of this library.

Returns
int The library type. Value is either 0 or a combination of TYPE_BUILTIN, TYPE_DYNAMIC, TYPE_STATIC, and TYPE_SDK_PACKAGE

getVersion

Added in API level 26
Deprecated in API level 28
public int getVersion ()

This method was deprecated in API level 28.
Use getLongVersion() instead.

Returns
int Value is -1 or greater

toString

Added in API level 26
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 26
public void writeToParcel (Parcel parcel, 
                int flags)

Flatten this object in to a Parcel.

Parameters
parcel Parcel: The Parcel in which the object should be written. This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES