Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4309a7b authored by wilsonshih's avatar wilsonshih
Browse files

Do not draw snapshot starting window if allocate graphic buffer fail.

Preventing NPE crash.

Bug: 271472871
Test: simulate GraphicBuffer#create fail in SnapshotDrawer, and verify
no crash.

Change-Id: If3f9ad38a9b256f59bfd96258e43decb896a3604
parent 35b0657c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -223,6 +223,11 @@ public class SnapshotDrawerUtils {
                        PixelFormat.RGBA_8888,
                        GraphicBuffer.USAGE_HW_TEXTURE | GraphicBuffer.USAGE_HW_COMPOSER
                                | GraphicBuffer.USAGE_SW_WRITE_RARELY);
                if (background == null) {
                    Log.e(TAG, "Unable to draw snapshot: failed to allocate graphic buffer for "
                            + mTitle);
                    return;
                }
                // TODO: Support this on HardwareBuffer
                final Canvas c = background.lockCanvas();
                drawBackgroundAndBars(c, frame);