summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2019-08-01 16:52:13 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-08-01 16:52:13 -0700
commit0b257d3e202a2b0a0c6039861d579d3e7700802d (patch)
treeca1dd52f4666dc87a68e7600cde1176304b94b51 /src/com/android
parent29e8ef3611cc763f9af00e0cc6eeb24582ab2678 (diff)
parentb1d8ad6be5d4f02bec05e9b496c6d06b9331b716 (diff)
downloadandroid_packages_apps_Trebuchet-0b257d3e202a2b0a0c6039861d579d3e7700802d.tar.gz
android_packages_apps_Trebuchet-0b257d3e202a2b0a0c6039861d579d3e7700802d.tar.bz2
android_packages_apps_Trebuchet-0b257d3e202a2b0a0c6039861d579d3e7700802d.zip
Merge "Bandage fix for bitmap fatal exception where width / height !> 0." into ub-launcher3-qt-r1-dev am: cf92f3edb0
am: b1d8ad6be5 Change-Id: Ifb3662ee293ff5eace912be50e622171a0bcaaa6
Diffstat (limited to 'src/com/android')
-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