WallpaperManager getDrawable & al clarifications
By "getDrawable & al", I mean all wallpaper read methods with a which flag
The exhaustive list (reviewers, please check that I did not miss one):
- getDrawable(which)
- peekDrawable(which)
- getFastDrawable(which)
- peekFastDrawable(which)
- peekWallpaperDimensions(which)
- getBitmap(hardware, which)
- getBitmapAsUser(userId, hardware, which)
This CL does a couple things:
- Clarify the javadoc of getDrawable & al public methods. In particular
clarify when the method will return null and when it will return the
default built-in wallpaper, and that getDrawable/getFastDrawable are
the same as peekDrawable/peekFastDrawable respectively. Also
deduplicate some copied/pasted javadoc, and mention all equivalences
between functions.
- Replace duplicated code in peekDrawable/peekFastDrawable
- Adapt the API of get|peek(Fast)Drawable|Bitmap to return null with FLAG_LOCK
when there is no static lock-only wallpaper.
- Add a hidden overload of getBitmap with a "boolean returnDefault" argument
(to always return the default wallpaper instead of null) and use it
in ImageWallpaper
- Small nit: use a try-with-resource and refactor getDefaultWallpaper
slightly (it is now used in two places after recent changes, but one
was not using the cached mDefaultWallpaper)
Bug: 253507223
Test: atest WallpaperManagerTest
Change-Id: I3acd46ec76df5035940f2af360dda145d98b5901
4 files changed