Removing some Launcher3 dependencies from BaseIconCache

Change-Id: Ic80ed4a5cd2fc414cd6c27096d798e7f0b8efc72
This commit is contained in:
Sunny Goyal
2018-11-06 14:51:55 -08:00
parent 066ace1b88
commit e62d2bb165
9 changed files with 86 additions and 55 deletions
-19
View File
@@ -356,25 +356,6 @@ public final class Utilities {
return null;
}
/**
* Compresses the bitmap to a byte array for serialization.
*/
public static byte[] flattenBitmap(Bitmap bitmap) {
// Try go guesstimate how much space the icon will take when serialized
// to avoid unnecessary allocations/copies during the write.
int size = bitmap.getWidth() * bitmap.getHeight() * 4;
ByteArrayOutputStream out = new ByteArrayOutputStream(size);
try {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
out.close();
return out.toByteArray();
} catch (IOException e) {
Log.w(TAG, "Could not write bitmap");
return null;
}
}
/**
* Trims the string, removing all whitespace at the beginning and end of the string.
* Non-breaking whitespaces are also removed.