Loading services/core/java/com/android/server/wm/TaskSnapshotConvertUtil.java +12 −2 Original line number Diff line number Diff line Loading @@ -171,14 +171,24 @@ public class TaskSnapshotConvertUtil { final Image.Plane plane = planes[0]; final int rowPadding = plane.getRowStride() - plane.getPixelStride() * image.getWidth(); final int widthPadding = rowPadding / plane.getPixelStride(); final Bitmap swBitmap = Bitmap.createBitmap( image.getWidth() + rowPadding / plane.getPixelStride() /* width */, image.getWidth() + widthPadding /* width */, image.getHeight() /* height */, pixelFormat == PixelFormat.RGB_565 ? Bitmap.Config.RGB_565 : Bitmap.Config.ARGB_8888); swBitmap.copyPixelsFromBuffer(plane.getBuffer()); if (widthPadding == 0) { return swBitmap; } // Crop the full memory width of the image data (rowStride), which often includes // extra padding bytes on the side for memory alignment. final Bitmap finalBitmap = Bitmap.createBitmap(swBitmap, 0 /* x */, 0 /* y */, width, // Crop to the required width of the image. height); swBitmap.recycle(); return finalBitmap; } } } } Loading
services/core/java/com/android/server/wm/TaskSnapshotConvertUtil.java +12 −2 Original line number Diff line number Diff line Loading @@ -171,14 +171,24 @@ public class TaskSnapshotConvertUtil { final Image.Plane plane = planes[0]; final int rowPadding = plane.getRowStride() - plane.getPixelStride() * image.getWidth(); final int widthPadding = rowPadding / plane.getPixelStride(); final Bitmap swBitmap = Bitmap.createBitmap( image.getWidth() + rowPadding / plane.getPixelStride() /* width */, image.getWidth() + widthPadding /* width */, image.getHeight() /* height */, pixelFormat == PixelFormat.RGB_565 ? Bitmap.Config.RGB_565 : Bitmap.Config.ARGB_8888); swBitmap.copyPixelsFromBuffer(plane.getBuffer()); if (widthPadding == 0) { return swBitmap; } // Crop the full memory width of the image data (rowStride), which often includes // extra padding bytes on the side for memory alignment. final Bitmap finalBitmap = Bitmap.createBitmap(swBitmap, 0 /* x */, 0 /* y */, width, // Crop to the required width of the image. height); swBitmap.recycle(); return finalBitmap; } } } }