豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit dc23bdf

Browse files
committed
fix(message-reader): only use hardware layer for MessageWebView on Android 9+ with hardware acceleration (#10759)
1 parent 30eb86e commit dc23bdf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

legacy/ui/legacy/src/main/java/com/fsck/k9/view/MessageWebView.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.fsck.k9.view
22

33
import android.content.Context
44
import android.content.pm.PackageManager
5+
import android.os.Build
56
import android.util.AttributeSet
67
import android.webkit.WebView
78
import com.fsck.k9.core.BuildConfig
@@ -35,7 +36,12 @@ class MessageWebView : WebView, KoinComponent {
3536

3637
configureDarkLightMode(this, config)
3738

38-
setLayerType(LAYER_TYPE_HARDWARE, null)
39+
// LAYER_TYPE_HARDWARE forces the WebView into a GPU texture.
40+
// On API <= 26, BakedOpRenderer calls LOG_ALWAYS_FATAL on any GL error, aborting the process
41+
// and fatally crashing the app. API 28+'s SkiaPipeline handles these errors gracefully.
42+
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1 && isHardwareAccelerated) {
43+
setLayerType(LAYER_TYPE_HARDWARE, null)
44+
}
3945

4046
with(settings) {
4147
setSupportZoom(true)

0 commit comments

Comments
 (0)