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

Commit e247d369 authored by wilsonshih's avatar wilsonshih
Browse files

Do not draw snapshot starting window if can't get a valid Canvas.

GraphicBuffer may lock canvas failed under heavy memory presure.

Bug: 300201497
Test: presubmit
Change-Id: Iec34061a95326de013603eec129bc7b46aac7fe9
parent 35bfcec9
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -237,13 +237,14 @@ public class SnapshotDrawerUtils {
                        PixelFormat.RGBA_8888,
                        GraphicBuffer.USAGE_HW_TEXTURE | GraphicBuffer.USAGE_HW_COMPOSER
                                | GraphicBuffer.USAGE_SW_WRITE_RARELY);
                if (background == null) {
                final Canvas c = background != null ? background.lockCanvas() : null;
                if (c == null) {
                    Log.e(TAG, "Unable to draw snapshot: failed to allocate graphic buffer for "
                            + mTitle);
                    mTransaction.clear();
                    childSurfaceControl.release();
                    return;
                }
                // TODO: Support this on HardwareBuffer
                final Canvas c = background.lockCanvas();
                drawBackgroundAndBars(c, frame);
                background.unlockCanvasAndPost(c);
                mTransaction.setBuffer(mRootSurface,