Class ShadowWallpaperManager


  • @Implements(android.app.WallpaperManager.class)
    public class ShadowWallpaperManager
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      android.graphics.Bitmap getBitmap​(int which)
      Returns the memory cached Bitmap associated with which.
      protected android.os.ParcelFileDescriptor getWallpaperFile​(int which)
      Gets a wallpaper file associated with which.
      protected android.app.WallpaperInfo getWallpaperInfo()
      Returns the information about the wallpaper if the current wallpaper is a live wallpaper component.
      protected boolean isSetWallpaperAllowed()  
      protected boolean isWallpaperSupported()  
      protected void sendWallpaperCommand​(android.os.IBinder windowToken, java.lang.String action, int x, int y, int z, android.os.Bundle extras)  
      protected int setBitmap​(android.graphics.Bitmap fullImage, android.graphics.Rect visibleCropHint, boolean allowBackup, int which)
      Caches fullImage in the memory based on which.
      void setIsSetWallpaperAllowed​(boolean allowed)  
      void setIsWallpaperSupported​(boolean supported)  
      protected int setStream​(java.io.InputStream bitmapData, android.graphics.Rect visibleCropHint, boolean allowBackup, int which)
      Caches bitmapData in the memory based on which.
      protected boolean setWallpaperComponent​(android.content.ComponentName wallpaperService)
      Sets a live wallpaper, wallpaperService, as the current wallpaper.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShadowWallpaperManager

        public ShadowWallpaperManager()
    • Method Detail

      • sendWallpaperCommand

        @Implementation
        protected void sendWallpaperCommand​(android.os.IBinder windowToken,
                                            java.lang.String action,
                                            int x,
                                            int y,
                                            int z,
                                            android.os.Bundle extras)
      • setBitmap

        @Implementation(minSdk=28)
        protected int setBitmap​(android.graphics.Bitmap fullImage,
                                android.graphics.Rect visibleCropHint,
                                boolean allowBackup,
                                int which)
        Caches fullImage in the memory based on which.

        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_LOCK or {WallpaperManager#FLAG_SYSTEM}
        Returns:
        0 if fails to cache. Otherwise, 1.
      • getBitmap

        @Nullable
        public android.graphics.Bitmap getBitmap​(int which)
        Returns the memory cached Bitmap associated with which.
        Parameters:
        which - either WallpaperManager.FLAG_LOCK or {WallpaperManager#FLAG_SYSTEM}.
        Returns:
        The memory cached Bitmap associated with which. null if no bitmap was set.
      • getWallpaperFile

        @Implementation(minSdk=28)
        @Nullable
        protected android.os.ParcelFileDescriptor getWallpaperFile​(int which)
        Gets a wallpaper file associated with which.
        Parameters:
        which - either WallpaperManager.FLAG_LOCK or {WallpaperManager#FLAG_SYSTEM}
        Returns:
        An open, readable file descriptor to the requested wallpaper image file; null if no such wallpaper is configured.
      • isSetWallpaperAllowed

        @Implementation(minSdk=24)
        protected boolean isSetWallpaperAllowed()
      • setIsSetWallpaperAllowed

        public void setIsSetWallpaperAllowed​(boolean allowed)
      • isWallpaperSupported

        @Implementation(minSdk=23)
        protected boolean isWallpaperSupported()
      • setIsWallpaperSupported

        public void setIsWallpaperSupported​(boolean supported)
      • setStream

        @Implementation(minSdk=24)
        protected int setStream​(java.io.InputStream bitmapData,
                                android.graphics.Rect visibleCropHint,
                                boolean allowBackup,
                                int which)
        Caches bitmapData in the memory based on which.
        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_LOCK or {WallpaperManager#FLAG_SYSTEM}
        Returns:
        0 if fails to cache. Otherwise, 1.
      • setWallpaperComponent

        @Implementation(minSdk=23)
        protected boolean setWallpaperComponent​(android.content.ComponentName wallpaperService)
                                         throws java.io.IOException,
                                                org.xmlpull.v1.XmlPullParserException
        Sets 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:
        java.io.IOException
        org.xmlpull.v1.XmlPullParserException
      • getWallpaperInfo

        @Implementation(minSdk=23)
        protected android.app.WallpaperInfo getWallpaperInfo()
        Returns 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.