Class: WallpaperManager

WallpaperManager

new WallpaperManager()

This system module reads the system wallpaper setting on startup and monitors changes to that setting, broadcasting a 'wallpaperchange' event with a blob: URL to tell the system and lockscreen about the new wallpaper.

This system module reads the system wallpaper setting on startup and monitors changes to that setting, broadcasting a 'wallpaperchange' event with a blob: URL to tell the system and lockscreen about the new wallpaper.

If the wallpaper value read from the settings DB is a URL this module converts it to a blob. If the wallpaper image does not exactly match the size of the screen, this module resizes it (lazy-loading shared/js/image_utils.js when needed). If the wallpaper value is converted to a blob or resized, the modified value is saved back to the settings DB so that it will not need to be modified the next time it is read.

start(), stop(), and getBlobURL() are the only public methods, and stop() is only exposed for the benefit of unit tests. _setWallpaper() is called on startup and whenever the wallpaper.image setting changes. Each call to _setWallpaper() eventually causes a call to _publish() which broadcasts the new wallpaper event to the lockscreen and the rest of the system app. The call to _publish() does not always happen directly, however: _setWallpaper() may call _checkSize(), which calls _publish(), or it may call _toBlob() which calls _checkSize(). Unless the build is mis-configured and the wallpaper in the settings db and the fallback default wallpaper is broken, every call to _setWallpaper() ends up broadcasting a 'wallpaperchange' event with a valid blob: url for a wallpaper image that has the same size as the screen.

Source:

WallpaperManager

new WallpaperManager()

This system module reads the system wallpaper setting on startup and monitors changes to that setting, broadcasting a 'wallpaperchange' event with a blob: URL to tell the system and lockscreen about the new wallpaper.

This system module reads the system wallpaper setting on startup and monitors changes to that setting, broadcasting a 'wallpaperchange' event with a blob: URL to tell the system and lockscreen about the new wallpaper.

If the wallpaper value read from the settings DB is a URL this module converts it to a blob. If the wallpaper image does not exactly match the size of the screen, this module resizes it (lazy-loading shared/js/image_utils.js when needed). If the wallpaper value is converted to a blob or resized, the modified value is saved back to the settings DB so that it will not need to be modified the next time it is read.

start(), stop(), and getBlobURL() are the only public methods, and stop() is only exposed for the benefit of unit tests. _setWallpaper() is called on startup and whenever the wallpaper.image setting changes. Each call to _setWallpaper() eventually causes a call to _publish() which broadcasts the new wallpaper event to the lockscreen and the rest of the system app. The call to _publish() does not always happen directly, however: _setWallpaper() may call _checkSize(), which calls _publish(), or it may call _toBlob() which calls _checkSize(). Unless the build is mis-configured and the wallpaper in the settings db and the fallback default wallpaper is broken, every call to _setWallpaper() ends up broadcasting a 'wallpaperchange' event with a valid blob: url for a wallpaper image that has the same size as the screen.

Source: