am b86f0769: use PNG as the transport encoding for images
* commit 'b86f07696cd85c0b441b48895392da636ea601cb': use PNG as the transport encoding for images
This commit is contained in:
@@ -61,8 +61,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
import static android.graphics.Bitmap.CompressFormat.WEBP;
|
||||
|
||||
/**
|
||||
* Persist the launcher home state across calamities.
|
||||
*/
|
||||
@@ -81,6 +79,9 @@ public class LauncherBackupAgent extends BackupAgent {
|
||||
|
||||
public static final int IMAGE_COMPRESSION_QUALITY = 75;
|
||||
|
||||
private static final Bitmap.CompressFormat IMAGE_FORMAT =
|
||||
android.graphics.Bitmap.CompressFormat.PNG;
|
||||
|
||||
private static BackupManager sBackupManager;
|
||||
|
||||
private static final String[] FAVORITE_PROJECTION = {
|
||||
@@ -776,7 +777,7 @@ public class LauncherBackupAgent extends BackupAgent {
|
||||
Resource res = new Resource();
|
||||
res.dpi = dpi;
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
if (icon.compress(WEBP, IMAGE_COMPRESSION_QUALITY, os)) {
|
||||
if (icon.compress(IMAGE_FORMAT, IMAGE_COMPRESSION_QUALITY, os)) {
|
||||
res.data = os.toByteArray();
|
||||
}
|
||||
return writeCheckedBytes(res);
|
||||
@@ -803,7 +804,7 @@ public class LauncherBackupAgent extends BackupAgent {
|
||||
Drawable fullResIcon = iconCache.getFullResIcon(provider.getPackageName(), info.icon);
|
||||
Bitmap icon = Utilities.createIconBitmap(fullResIcon, this);
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
if (icon.compress(WEBP, IMAGE_COMPRESSION_QUALITY, os)) {
|
||||
if (icon.compress(IMAGE_FORMAT, IMAGE_COMPRESSION_QUALITY, os)) {
|
||||
widget.icon.data = os.toByteArray();
|
||||
widget.icon.dpi = dpi;
|
||||
}
|
||||
@@ -812,7 +813,7 @@ public class LauncherBackupAgent extends BackupAgent {
|
||||
widget.preview = new Resource();
|
||||
Bitmap preview = previewLoader.generateWidgetPreview(info, null);
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
if (preview.compress(WEBP, IMAGE_COMPRESSION_QUALITY, os)) {
|
||||
if (preview.compress(IMAGE_FORMAT, IMAGE_COMPRESSION_QUALITY, os)) {
|
||||
widget.preview.data = os.toByteArray();
|
||||
widget.preview.dpi = dpi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user