From ccf00a2007a363f5847636f7b53c0c89311e09d4 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Tue, 5 Jun 2018 17:10:23 -0700 Subject: minui: Handle the failures from the drm backend in gr_init In a charger mode manual test, we encounter failures from the MinuiBackendDrm when calling DrmEnableCrtc and Flip. To make the minui more robust, we should fall back to another backend if drm's SetCrtc fails. And check the value of gr_draw before dereferencing. Bug: 80249440 Test: boot to recovery Change-Id: Ibd1ca1fb1115fe1132684586c54eccd8fb4c3ad9 --- minui/graphics.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'minui/graphics.cpp') diff --git a/minui/graphics.cpp b/minui/graphics.cpp index 3b386015a..c1aab412d 100644 --- a/minui/graphics.cpp +++ b/minui/graphics.cpp @@ -356,6 +356,10 @@ int gr_init() { gr_flip(); gr_flip(); + if (!gr_draw) { + printf("gr_init: gr_draw becomes nullptr after gr_flip\n"); + return -1; + } gr_rotate(DEFAULT_ROTATION); -- cgit v1.2.3