WallpaperInfo


public final class WallpaperInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.WallpaperInfo


This class is used to specify meta information of a wallpaper service.

Summary

XML attributes

android:shouldUseDefaultUnfoldTransition Indicates that this wallpaper service should receive zoom transition updates when changing the structural state of the device (e.g. 
android:supportsMultipleDisplays Indicates that this wallpaper service can support multiple engines to render on each surface independently. 

Inherited constants

Fields

public static final Creator<WallpaperInfo> CREATOR

Used to make this class parcelable.

Public constructors

WallpaperInfo(Context context, ResolveInfo service)

Constructor.

Public methods

int describeContents()

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

void dump(Printer pw, String prefix)
ComponentName getComponent()

Return the component of the service that implements this wallpaper.

String getPackageName()

Return the .apk package that implements this wallpaper.

ServiceInfo getServiceInfo()

Return the raw information about the Service implementing this wallpaper.

String getServiceName()

Return the class name of the service component that implements this wallpaper.

String getSettingsActivity()

Return the class name of an activity that provides a settings UI for the wallpaper.

Uri getSettingsSliceUri()

Returns an URI that provides a settings Slice for this wallpaper.

boolean getShowMetadataInPreview()

Queries whether any metadata should be shown when previewing the wallpaper.

CharSequence loadAuthor(PackageManager pm)

Return a string indicating the author(s) of this wallpaper.

CharSequence loadContextDescription(PackageManager pm)

Retrieves a title of the URI that specifies a link for further context about this wallpaper.

Uri loadContextUri(PackageManager pm)

Returns an URI that specifies a link for further context about this wallpaper.

CharSequence loadDescription(PackageManager pm)

Return a brief summary of this wallpaper's behavior.

Drawable loadIcon(PackageManager pm)

Load the user-displayed icon for this wallpaper.

CharSequence loadLabel(PackageManager pm)

Load the user-displayed label for this wallpaper.

Drawable loadThumbnail(PackageManager pm)

Load the thumbnail image for this wallpaper.

boolean shouldUseDefaultUnfoldTransition()

Returns whether this wallpaper should receive default zooming updates when the device changes its state (e.g. when folding or unfolding a foldable device).

boolean supportsMultipleDisplays()

Returns whether this wallpaper service can support multiple engines to render on each surface independently.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Used to package this object into a Parcel.

Inherited methods

XML attributes

android:shouldUseDefaultUnfoldTransition

Indicates that this wallpaper service should receive zoom transition updates when changing the structural state of the device (e.g. when folding or unfolding a foldable device). When this value is set to true WallpaperService.Engine could receive zoom updates before or after changing the device state. Wallpapers receive zoom updates using WallpaperService.Engine.onZoomChanged(float) and zoom rendering should be handled manually. Zoom updates are delivered only when WallpaperService.Engine is created and not destroyed. Default value is true. Corresponds to WallpaperInfo.shouldUseDefaultUnfoldTransition()

May be a boolean value, such as "true" or "false".

Related methods:

android:supportsMultipleDisplays

Indicates that this wallpaper service can support multiple engines to render on each surface independently. An example use case is a multi-display set-up where the wallpaper service can render surfaces to each of the connected displays. Corresponds to WallpaperInfo.supportsMultipleDisplays()

May be a boolean value, such as "true" or "false".

Related methods:

Fields

CREATOR

Added in API level 7
public static final Creator<WallpaperInfo> CREATOR

Used to make this class parcelable.

Public constructors

WallpaperInfo

Added in API level 7
public WallpaperInfo (Context context, 
                ResolveInfo service)

Constructor.

Parameters
context Context: The Context in which we are parsing the wallpaper.

service ResolveInfo: The ResolveInfo returned from the package manager about this wallpaper's component.

Throws
IOException
XmlPullParserException

Public methods

describeContents

Added in API level 7
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

dump

Added in API level 7
public void dump (Printer pw, 
                String prefix)

Parameters
pw Printer

prefix String

getComponent

Added in API level 7
public ComponentName getComponent ()

Return the component of the service that implements this wallpaper.

Returns
ComponentName

getPackageName

Added in API level 7
public String getPackageName ()

Return the .apk package that implements this wallpaper.

Returns
String

getServiceInfo

Added in API level 7
public ServiceInfo getServiceInfo ()

Return the raw information about the Service implementing this wallpaper. Do not modify the returned object.

Returns
ServiceInfo

getServiceName

Added in API level 7
public String getServiceName ()

Return the class name of the service component that implements this wallpaper.

Returns
String

getSettingsActivity

Added in API level 7
public String getSettingsActivity ()

Return the class name of an activity that provides a settings UI for the wallpaper. You can launch this activity be starting it with an Intent whose action is MAIN and with an explicit ComponentName composed of getPackageName() and the class name returned here.

null will be returned if there is no settings activity associated with the wallpaper.

Returns
String

getSettingsSliceUri

Added in API level 29
public Uri getSettingsSliceUri ()

Returns an URI that provides a settings Slice for this wallpaper. The wallpaper should implement a SliceProvider associated with this URI. The system will display the Slice in the customization section while previewing the live wallpaper. Because this URI is accessible to other apps, it is recommended to protect it with the android.permission.BIND_WALLPAPER permission.

null will be returned if there is no settings Slice URI associated with the wallpaper.

Returns
Uri The URI.

getShowMetadataInPreview

Added in API level 25
public boolean getShowMetadataInPreview ()

Queries whether any metadata should be shown when previewing the wallpaper. If this value is set to true, any component that shows a preview of this live wallpaper should also show accompanying information like loadLabel(PackageManager), loadDescription(PackageManager), loadAuthor(PackageManager) and loadContextDescription(android.content.pm.PackageManager), so the user gets to know further information about this wallpaper.

Returns
boolean Whether any metadata should be shown when previewing the wallpaper.

loadAuthor

Added in API level 7
public CharSequence loadAuthor (PackageManager pm)

Return a string indicating the author(s) of this wallpaper.

Parameters
pm PackageManager

Returns
CharSequence

Throws
Resources.NotFoundException

loadContextDescription

Added in API level 25
public CharSequence loadContextDescription (PackageManager pm)

Retrieves a title of the URI that specifies a link for further context about this wallpaper.

Parameters
pm PackageManager: An instance of PackageManager to retrieve the title.

Returns
CharSequence The title.

Throws
Resources.NotFoundException

loadContextUri

Added in API level 25
public Uri loadContextUri (PackageManager pm)

Returns an URI that specifies a link for further context about this wallpaper.

Parameters
pm PackageManager: An instance of PackageManager to retrieve the URI.

Returns
Uri The URI.

Throws
Resources.NotFoundException

loadDescription

Added in API level 7
public CharSequence loadDescription (PackageManager pm)

Return a brief summary of this wallpaper's behavior.

Parameters
pm PackageManager

Returns
CharSequence

Throws
Resources.NotFoundException

loadIcon

Added in API level 7
public Drawable loadIcon (PackageManager pm)

Load the user-displayed icon for this wallpaper.

Parameters
pm PackageManager: Supply a PackageManager used to load the wallpaper's resources.

Returns
Drawable

loadLabel

Added in API level 7
public CharSequence loadLabel (PackageManager pm)

Load the user-displayed label for this wallpaper.

Parameters
pm PackageManager: Supply a PackageManager used to load the wallpaper's resources.

Returns
CharSequence

loadThumbnail

Added in API level 7
public Drawable loadThumbnail (PackageManager pm)

Load the thumbnail image for this wallpaper.

Parameters
pm PackageManager: Supply a PackageManager used to load the wallpaper's resources.

Returns
Drawable

shouldUseDefaultUnfoldTransition

Added in API level 32
public boolean shouldUseDefaultUnfoldTransition ()

Returns whether this wallpaper should receive default zooming updates when the device changes its state (e.g. when folding or unfolding a foldable device). If set to false the wallpaper will not receive zoom events when changing the device state, so it can implement its own transition instead.

This corresponds to the value R.styleable.Wallpaper_shouldUseDefaultUnfoldTransition in the XML description of the wallpaper.

The default value is true.

Related XML Attributes:

Returns
boolean true if wallpaper should receive default device state change transition updates

supportsMultipleDisplays

Added in API level 29
public boolean supportsMultipleDisplays ()

Returns whether this wallpaper service can support multiple engines to render on each surface independently. An example use case is a multi-display set-up where the wallpaper service can render surfaces to each of the connected displays.

This corresponds to the value R.styleable.Wallpaper_supportsMultipleDisplays in the XML description of the wallpaper.

The default value is false.

Related XML Attributes:

Returns
boolean true if multiple engines can render independently on each surface.

toString

Added in API level 7
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 7
public void writeToParcel (Parcel dest, 
                int flags)

Used to package this object into a Parcel.

Parameters
dest Parcel: The Parcel to be written.

flags int: The flags used for parceling.