Skip to content
Commit fa48ffe6 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

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
parent b26be926
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment