Package org.robolectric.shadows
Class ShadowWallpaperManager
java.lang.Object
org.robolectric.shadows.ShadowWallpaperManager
@Implements(android.app.WallpaperManager.class) public class ShadowWallpaperManager extends Object
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classShadowWallpaperManager.WallpaperCommandRecordRepresents an invocation record ofWallpaperManager.sendWallpaperCommand(android.os.IBinder, java.lang.String, int, int, int, android.os.Bundle)
- 
Constructor SummaryConstructors Constructor Description ShadowWallpaperManager()
- 
Method SummaryModifier and Type Method Description BitmapgetBitmap(int which)Returns the memory cachedBitmapassociated withwhich.List<ShadowWallpaperManager.WallpaperCommandRecord>getWallpaperCommandRecords()Returns all the invocation records toWallpaperManager.sendWallpaperCommand(android.os.IBinder, java.lang.String, int, int, int, android.os.Bundle)protected floatgetWallpaperDimAmount()protected ParcelFileDescriptorgetWallpaperFile(int which)Gets a wallpaper file associated withwhich.protected WallpaperInfogetWallpaperInfo()Returns the information about the wallpaper if the current wallpaper is a live wallpaper component.protected booleanhasResourceWallpaper(int resid)Returns whether the current wallpaper has been set throughsetResource(int)orsetResource(int, int)with the same resource id.protected booleanisSetWallpaperAllowed()protected booleanisWallpaperSupported()protected voidsendWallpaperCommand(IBinder windowToken, String action, int x, int y, int z, Bundle extras)protected intsetBitmap(Bitmap fullImage, Rect visibleCropHint, boolean allowBackup, int which)CachesfullImagein the memory based onwhich.voidsetIsSetWallpaperAllowed(boolean allowed)voidsetIsWallpaperSupported(boolean supported)protected voidsetResource(int resid)Sets a resource id as the current wallpaper.protected intsetResource(int resid, int which)protected intsetStream(InputStream bitmapData, Rect visibleCropHint, boolean allowBackup, int which)CachesbitmapDatain the memory based onwhich.protected booleansetWallpaperComponent(ComponentName wallpaperService)Sets a live wallpaper,wallpaperService, as the current wallpaper.protected voidsetWallpaperDimAmount(float dimAmount)
- 
Constructor Details- 
ShadowWallpaperManagerpublic ShadowWallpaperManager()
 
- 
- 
Method Details- 
sendWallpaperCommand@Implementation protected void sendWallpaperCommand(IBinder windowToken, String action, int x, int y, int z, Bundle extras)
- 
setResourceSets a resource id as the current wallpaper.This only caches the resource id in memory. Calling this will override any previously set resource and does not differentiate between users. 
- 
setResource
- 
hasResourceWallpaperReturns whether the current wallpaper has been set throughsetResource(int)orsetResource(int, int)with the same resource id.
- 
setBitmap@Implementation(minSdk=24) protected int setBitmap(Bitmap fullImage, Rect visibleCropHint, boolean allowBackup, int which)CachesfullImagein the memory based onwhich.After a success call, any previously set live wallpaper is removed, - Parameters:
- fullImage- the bitmap image to be cached in the memory
- visibleCropHint- not used
- allowBackup- not used
- which- either- WallpaperManager.FLAG_LOCKor {WallpaperManager#FLAG_SYSTEM}
- Returns:
- 0 if fails to cache. Otherwise, 1.
 
- 
getBitmapReturns the memory cachedBitmapassociated withwhich.- Parameters:
- which- either- WallpaperManager.FLAG_LOCKor {WallpaperManager#FLAG_SYSTEM}.
- Returns:
- The memory cached Bitmapassociated withwhich.nullif no bitmap was set.
 
- 
getWallpaperFileGets a wallpaper file associated withwhich.- Parameters:
- which- either- WallpaperManager.FLAG_LOCKor {WallpaperManager#FLAG_SYSTEM}
- Returns:
- An open, readable file descriptor to the requested wallpaper image file; nullif no such wallpaper is configured.
 
- 
isSetWallpaperAllowed
- 
setIsSetWallpaperAllowedpublic void setIsSetWallpaperAllowed(boolean allowed)
- 
isWallpaperSupported
- 
setIsWallpaperSupportedpublic void setIsWallpaperSupported(boolean supported)
- 
setStream@Implementation(minSdk=24) protected int setStream(InputStream bitmapData, Rect visibleCropHint, boolean allowBackup, int which)CachesbitmapDatain the memory based onwhich.- Parameters:
- bitmapData- the input stream which contains a bitmap image to be cached in the memory
- visibleCropHint- not used
- allowBackup- not used
- which- either- WallpaperManager.FLAG_LOCKor {WallpaperManager#FLAG_SYSTEM}
- Returns:
- 0 if fails to cache. Otherwise, 1.
 
- 
setWallpaperComponent@Implementation(minSdk=23) protected boolean setWallpaperComponent(ComponentName wallpaperService) throws IOException, XmlPullParserExceptionSets a live wallpaper,wallpaperService, as the current wallpaper.This only caches the live wallpaper info in the memory. Calling this will remove any previously set static wallpaper. - Throws:
- IOException
- XmlPullParserException
 
- 
getWallpaperInfoReturns the information about the wallpaper if the current wallpaper is a live wallpaper component. Otherwise, if the wallpaper is a static image, this returns null.
- 
setWallpaperDimAmount
- 
getWallpaperDimAmount
- 
getWallpaperCommandRecordsReturns all the invocation records toWallpaperManager.sendWallpaperCommand(android.os.IBinder, java.lang.String, int, int, int, android.os.Bundle)
 
-