Source:
public static Bitmap create( final String name, final Rect outPadding, final BitmapFactory.Options options, final Point widthAndHeight) { Bitmap bitmap = Shadow.newInstanceOf(Bitmap.class); ShadowBitmap shadowBitmap = Shadow.extract(bitmap); shadowBitmap.appendDescription(name == null ? "Bitmap" : "Bitmap for " + name); Bitmap.Config config; if (options != null && options.inPreferredConfig != null) { config = options.inPreferredConfig; } else { config = Bitmap.Config.ARGB_8888; } shadowBitmap.setConfig(config); String optionsString = stringify(options); if (!optionsString.isEmpty()) { shadowBitmap.appendDescription(" with options "); shadowBitmap.appendDescription(optionsString); } Point p = new Point(selectWidthAndHeight(name, widthAndHeight)); if (options != null && options.inSampleSize > 1) { p.x = p.x / options.inSampleSize; p.y = p.y / options.inSampleSize; p.x = p.x == 0 ? 1 : p.x; p.y = p.y == 0 ? 1 : p.y; } shadowBitmap.setWidth(p.x); shadowBitmap.setHeight(p.y); shadowBitmap.setPixels(new int[p.x * p.y], 0, 0, 0, 0, p.x, p.y); if (options != null) { options.outWidth = p.x; options.outHeight = p.y; } if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.KITKAT) { ReflectionHelpers.callStaticMethod( BitmapFactory.class, "setDensityFromOptions", ClassParameter.from(Bitmap.class, bitmap), ClassParameter.from(BitmapFactory.Options.class, options)); } else { ReflectionHelpers.callStaticMethod( BitmapFactory.class, "finishDecode", ClassParameter.from(Bitmap.class, bitmap), ClassParameter.from(Rect.class, outPadding), ClassParameter.from(BitmapFactory.Options.class, options)); } return bitmap; }

Target:
private static Bitmap create( final String name, final Rect outPadding, final BitmapFactory.Options options, final Point widthAndHeight) { Bitmap bitmap = Shadow.newInstanceOf(Bitmap.class); ShadowBitmap shadowBitmap = Shadow.extract(bitmap); shadowBitmap.appendDescription(name == null ? "Bitmap" : "Bitmap for " + name); Bitmap.Config config; if (options != null && options.inPreferredConfig != null) { config = options.inPreferredConfig; } else { config = Bitmap.Config.ARGB_8888; } shadowBitmap.setConfig(config); String optionsString = stringify(options); if (!optionsString.isEmpty()) { shadowBitmap.appendDescription(" with options "); shadowBitmap.appendDescription(optionsString); } Point p = new Point(selectWidthAndHeight(name, widthAndHeight)); if (options != null && options.inSampleSize > 1) { p.x = p.x / options.inSampleSize; p.y = p.y / options.inSampleSize; p.x = p.x == 0 ? 1 : p.x; p.y = p.y == 0 ? 1 : p.y; } shadowBitmap.setWidth(p.x); shadowBitmap.setHeight(p.y); shadowBitmap.setPixels(new int[p.x * p.y], 0, 0, 0, 0, p.x, p.y); if (options != null) { options.outWidth = p.x; options.outHeight = p.y; } if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.KITKAT) { ReflectionHelpers.callStaticMethod( BitmapFactory.class, "setDensityFromOptions", ClassParameter.from(Bitmap.class, bitmap), ClassParameter.from(BitmapFactory.Options.class, options)); } else { ReflectionHelpers.callStaticMethod( BitmapFactory.class, "finishDecode", ClassParameter.from(Bitmap.class, bitmap), ClassParameter.from(Rect.class, outPadding), ClassParameter.from(BitmapFactory.Options.class, options)); } return bitmap; }