Compress wallpaper to PNG instead of JPEG when setting wallpaper

JPEG is a 'lossy' format, meaning, when image bytes are encoded to JPEG,
the decoded JPEG's image bytes won't match the input, no matter how high
the compression quality.

Using PNG ensures the same pixels Wallpaper Picker used to generate the
image preview are the same pixels the system will use to quantize the
image, ensuring any colors Wallpaper Picker shows will be the same
colors applied to the system.

Alternatively, WallpaperPicker could compress
to JPEG then decompress, and use that Bitmap with
WallpaperColors.fromBitmap, but that adds unnecessary work IMHO. It is
better to have the image bytes always match what the user is seeing in
the preview than use lossy compression + add latency.

Bug: 189931209
Test: Log lines in WallpaperColors/WallpaperManagerService/
WallpaperPicker/Palette log the hash of their version of the Bitmap's
bytes. Without this change, the hash differs between the preview and
framework's view of it.

Change-Id: I1ca71ccfc62d203ef65d4dfec661e36f91c2c221
1 file changed