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

Commit 0b272833 authored by Ahan Wu's avatar Ahan Wu
Browse files

Validate if the surface of wallpaper is valid before creating EglSurface.

Make sure the surface is still valid before creating egl surface, or it
might crash sysui accidently during cts and make test case fail.

Bug: 141756892
Test: make a local build
Test: acloud create --local-image
Test: atest CtsAppTestCases:android.app.cts.WallpaperManagerTest
--rerun-until-failure 10 -- --abi x86

Change-Id: I106c55a510ba30d90f797fa3419751d4b5128f8c
parent 75124194
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ public class EglHelper {
            Log.d(TAG, "createEglSurface start");
        }

        if (hasEglDisplay()) {
        if (hasEglDisplay() && surfaceHolder.getSurface().isValid()) {
            int[] attrs = null;
            int wcgCapability = getWcgCapability();
            if (wcg && checkExtensionCapability(KHR_GL_COLOR_SPACE) && wcgCapability > 0) {
@@ -214,7 +214,8 @@ public class EglHelper {
            }
            mEglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig, surfaceHolder, attrs, 0);
        } else {
            Log.w(TAG, "mEglDisplay is null");
            Log.w(TAG, "Create EglSurface failed: hasEglDisplay=" + hasEglDisplay()
                    + ", has valid surface=" + surfaceHolder.getSurface().isValid());
            return false;
        }