From 984827cc9c170b1092a30931b08c7a0d18865fd3 Mon Sep 17 00:00:00 2001 From: "Ivan.liu" Date: Wed, 24 Aug 2016 17:19:03 +0800 Subject: [PATCH] Fix suspend crash issue on no GPU platform. eglChooseConfig should return false only if an error occured. If eglChooseConfig is called with a valid attribute list, no internal EGL errors occur. And if no available config matches the requested attribute list, no configs are returned. Not only the return value of eglChooseConfig should be checked, the 'num_config' out-param must be inspected too. If no configs were returned, and no error occurred, then 'num_config' will be 0. Change-Id: Id36d88820b8e33713bc83e0d4b90c3fee7f005fd Signed-off-by: Xiaowen Liu --- services/core/java/com/android/server/display/ColorFade.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/display/ColorFade.java b/services/core/java/com/android/server/display/ColorFade.java index a16fcd2fa112e..2541050f406d1 100644 --- a/services/core/java/com/android/server/display/ColorFade.java +++ b/services/core/java/com/android/server/display/ColorFade.java @@ -547,6 +547,11 @@ final class ColorFade { logEglError("eglChooseConfig"); return false; } + if (numEglConfigs[0] <= 0) { + Slog.e(TAG, "no valid config found"); + return false; + } + mEglConfig = eglConfigs[0]; }