I use this Script to convert YUV_420_888 images to Bitmap. Everything works fine on my Samsung S8. I tried the RenderScript on my S9+ and the result is a black Bitmap. No error, no warning just a black Bitmap. I updated the S9+ to Android Pie but everything is still black. I really can`t explain what is wrong with the S9+ devices...
int W = mImage.getWidth();
int H = mImage.getHeight();
Image.Plane Y = mImage.getPlanes()[0];
Image.Plane U = mImage.getPlanes()[1];
Image.Plane V = mImage.getPlanes()[2];
int Yb = Y.getBuffer().remaining();
int Ub = U.getBuffer().remaining();
int Vb = V.getBuffer().remaining();
byte[] data = new byte[Yb + Ub + Vb];
Y.getBuffer().get(data, 0, Yb);
V.getBuffer().get(data, Yb, Vb);
U.getBuffer().get(data, Yb + Vb, Ub);
RenderScript rs = RenderScript.create(Main2Activity.this);
ScriptIntrinsicYuvToRGB yuvToRgbIntrinsic = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs));
Type.Builder yuvType = new Type.Builder(rs, Element.U8(rs)).setX(data.length);
Allocation in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);
Type.Builder rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs)).setX(W).setY(H);
Allocation out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);
final Bitmap bmpout = Bitmap.createBitmap(W, H, Bitmap.Config.ARGB_8888);
in.copyFromUnchecked(data);
yuvToRgbIntrinsic.setInput(in);
yuvToRgbIntrinsic.forEach(out);
out.copyTo(bmpout);
**Edit:**I changed the resolution of my mImage to 2.960 x 1.440 Pixel and received some crashes. While the App was crashing I installed the App again and while crashing the App showed the Bitmaps. I think the problem is not the code. I think the S9+ has some problem running renderscript properly.