tgkill - native error on Android 8.0 Samsung S8

Logcat analysis

This is where your code is crashing EglManager.cpp:

void EglManager::damageFrame(const Frame& frame, const SkRect& dirty) {
#ifdef EGL_KHR_partial_update
    if (EglExtensions.setDamage && mSwapBehavior == SwapBehavior::BufferAge) {
        EGLint rects[4];
        frame.map(dirty, rects);
        if (!eglSetDamageRegionKHR(mEglDisplay, frame.mSurface, rects, 1)) {
            LOG_ALWAYS_FATAL("Failed to set damage region on surface %p, error=%s",
                    (void*)frame.mSurface, egl_error_str());
        }
    }
#endif
}

Called from SkiaOpenGLPipeline.cpp:

SkiaOpenGLPipeline::draw //method

mEglManager.damageFrame(frame, dirty);

Why ?

It seems you may have a 'Failed to set damage region on surface', probably after onResume() from screen rotation or onPause() in your Activity. See fixing-common-android-lifecycle-issues

Fixes

I started getting this crash after updating to Oreo, every-time I started my app, with the message "Failed to set damage region on surface" followed by all those lines about libhwui.so and EglManager And it turned out that, for some obscure reason, it was somehow caused by a totally unrelated problem in my app (too many open files [forgot to close them]). After fixing this my own bug, no more crashes on the EglManager. [also note that crashes only happen if hardware acceleration is turned on] Ref: issuetracker.google.com { issue 70259031}

See also: eglCreateWindowSurface {SO problem}, Logging, native-crashes-on-abort-in-developer-console-with-oreo-8-1 {SO problem}, hardware-acceleration, opengl, GLSurfaceView

This problem seems to be restricted to Samsung devices with Android 8.0, it is some bug about text selection and/or entering text and/or closing a dialog containing EditTexts and/or rotating the screen.

It seems that there is a workaround. Create a xml file in the res/drawable folder defining an empty shape, as follows.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<!-- nothing -->
</shape>

In the layout file, add the following attributes to the EditTexts:

android:textSelectHandle="@drawable/empty"
android:textSelectHandleRight="@drawable/empty"
android:textSelectHandleLeft="@drawable/empty"

source: Samsung developers forum crash Samsung Galaxy S8 libhwui.so