summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2019-07-30 13:40:26 -0700
committerJon Miranda <jonmiranda@google.com>2019-08-01 16:17:37 -0700
commit40bce3efe497190b91a87b7f82d6568d96d28919 (patch)
tree65a208ae3383be5d653dbf08ddf9d261df2d7134 /src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java
parentc302baced05a39ac908a106998d300b9989df750 (diff)
downloadandroid_packages_apps_Trebuchet-40bce3efe497190b91a87b7f82d6568d96d28919.tar.gz
android_packages_apps_Trebuchet-40bce3efe497190b91a87b7f82d6568d96d28919.tar.bz2
android_packages_apps_Trebuchet-40bce3efe497190b91a87b7f82d6568d96d28919.zip
Bandage fix for bitmap fatal exception where width / height !> 0.
Bug: 135558924 Change-Id: I0a22ba849b50eee87abd52ab9ec3211294a6c40b
Diffstat (limited to 'src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java')
-rw-r--r--src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java b/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java
index 0c5a1fc5a..d8a1f9951 100644
--- a/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java
+++ b/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java
@@ -28,6 +28,8 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
@@ -66,15 +68,19 @@ public class FolderAdaptiveIcon extends AdaptiveIconDrawable {
return mBadge;
}
- public static FolderAdaptiveIcon createFolderAdaptiveIcon(
+ public static @Nullable FolderAdaptiveIcon createFolderAdaptiveIcon(
Launcher launcher, int folderId, Point dragViewSize) {
Preconditions.assertNonUiThread();
int margin = launcher.getResources()
.getDimensionPixelSize(R.dimen.blur_size_medium_outline);
// Allocate various bitmaps on the background thread, because why not!
- final Bitmap badge = Bitmap.createBitmap(
- dragViewSize.x - margin, dragViewSize.y - margin, Bitmap.Config.ARGB_8888);
+ int width = dragViewSize.x - margin;
+ int height = dragViewSize.y - margin;
+ if (width <= 0 || height <= 0) {
+ return null;
+ }
+ final Bitmap badge = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
// Create the actual drawable on the UI thread to avoid race conditions with
// FolderIcon draw pass