private Bitmap reduceLargeIconSize(Bitmap icon) {
            if (icon == null || Build.VERSION.SDK_INT >= 27) {
                return icon;
            }

            Resources res = mContext.getResources();
            int maxWidth = (int) ResUtils.convertDpToPixel(320f, mContext);
            int maxHeight = (int) ResUtils.convertDpToPixel(320f, mContext);

            if (icon.getWidth() <= maxWidth && icon.getHeight() <= maxHeight) {
                return icon;
            }

            double scale = Math.min(
                    maxWidth / (double) Math.max(1, icon.getWidth()),
                    maxHeight / (double) Math.max(1, icon.getHeight()));
            return Bitmap.createScaledBitmap(
                    icon,
                    (int) Math.ceil(icon.getWidth() * scale),
                    (int) Math.ceil(icon.getHeight() * scale),
                    true /* filtered */);
        }
Reduce the size of a notification icon if it's overly large. The framework does
this automatically starting from API 27.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/compat/NotificationCompat.java