Android 15: i.MX8MP: WebGL rendering issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Android 15: i.MX8MP: WebGL rendering issue

跳至解决方案
973 次查看
pierluigi_p
Senior Contributor I

Hi @Bio_TICFSL,

in a previous post, I can read about a known WebGL rendering issue on Android 15.0.0 v1.0.0.

Is there any new release fixing this ?

If yes, can you share the actual fix ?

Thanks

Best Regards

Pier

标签 (2)
0 项奖励
回复
1 解答
919 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Regarding the WebGL rendering issue on Android 15.0.0 v1.0.0 for i.MX8MP that you mentioned, there is currently no new release that specifically fixes this issue.

This WebGL rendering problem appears to be related to security features in Android's WebView implementation that restrict WebGL access based on application package naming. The issue occurs because WebGL functionality is only available when application package IDs contain the word "chromium" but fails with other naming conventions.

While we don't have a new release addressing this issue yet, the following workaround can be implemented in your application code before initializing the WebView:

```java
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
WebView.setWebContentsDebuggingEnabled(true);
}
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
// Add this line to enable WebGL for all applications
webSettings.setMediaPlaybackRequiresUserGesture(false);
```

This configuration bypasses the package name restriction, allowing WebGL to function properly in applications with non-chromium package names.

Regards

在原帖中查看解决方案

2 回复数
915 次查看
pierluigi_p
Senior Contributor I

Thanks @Bio_TICFSL 

0 项奖励
回复
920 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Regarding the WebGL rendering issue on Android 15.0.0 v1.0.0 for i.MX8MP that you mentioned, there is currently no new release that specifically fixes this issue.

This WebGL rendering problem appears to be related to security features in Android's WebView implementation that restrict WebGL access based on application package naming. The issue occurs because WebGL functionality is only available when application package IDs contain the word "chromium" but fails with other naming conventions.

While we don't have a new release addressing this issue yet, the following workaround can be implemented in your application code before initializing the WebView:

```java
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
WebView.setWebContentsDebuggingEnabled(true);
}
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
// Add this line to enable WebGL for all applications
webSettings.setMediaPlaybackRequiresUserGesture(false);
```

This configuration bypasses the package name restriction, allowing WebGL to function properly in applications with non-chromium package names.

Regards

%3CLINGO-SUB%20id%3D%22lingo-sub-2207131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EAndroid%2015%EF%BC%9Ai.MX8MP%EF%BC%9AWebGL%20%E6%B8%B2%E6%9F%93%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2207131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F34846%22%20target%3D%22_blank%22%3E%40Bio_TICFSL%3C%2FA%3E%E3%80%81%3C%2FP%3E%3CP%3E%E5%9C%A8%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-Processors%2Fimx8mp-android-WebGL-Aquarium-rendering-issue%2Fm-p%2F2064430%22%20target%3D%22_self%22%3E%20%E4%B8%8A%3C%2FA%3E%20%E4%B8%80%E7%AF%87%20%E6%96%87%E7%AB%A0%20%E4%B8%AD%EF%BC%8C%E6%88%91%E8%AF%BB%E5%88%B0%E4%BA%86%E5%85%B3%E4%BA%8E%3CSPAN%3E%20Android%2015.0.0%20v1.0.0%20%E4%B8%8A%20%E4%B8%80%E4%B8%AA%E5%B7%B2%E7%9F%A5%E7%9A%84%20WebGL%20%E6%B8%B2%E6%9F%93%E9%97%AE%E9%A2%98%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%E6%9C%89%E4%BB%BB%E4%BD%95%E6%96%B0%E7%89%88%E6%9C%AC%E5%8F%AF%E4%BB%A5%E8%A7%A3%E5%86%B3%E8%BF%99%E4%B8%AA%E9%97%AE%E9%A2%98%E5%90%97%EF%BC%9F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%E5%A6%82%E6%9E%9C%E6%98%AF%EF%BC%8C%E6%82%A8%E8%83%BD%E5%88%86%E4%BA%AB%E5%AE%9E%E9%99%85%E7%9A%84%E4%BF%AE%E5%A4%8D%E6%96%B9%E6%B3%95%E5%90%97%EF%BC%9F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%EF%BC%81%3C%2FP%3E%3CP%3E%E9%A1%BA%E7%A5%9D%E5%95%86%E7%A5%BA%EF%BC%81%3C%2FP%3E%3CP%3E%E7%A0%81%E5%A4%B4%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2207131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAndroid%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E5%9B%BE%E5%BD%A2%E4%B8%8E%E6%98%BE%E7%A4%BA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2212783%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Android%2015%3A%20i.MX8MP%3A%20WebGL%20rendering%20issue%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2212783%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E8%B0%A2%E8%B0%A2%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F34846%22%20target%3D%22_blank%22%3E%40Bio_TICFSL%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2212631%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Android%2015%3A%20i.MX8MP%3A%20WebGL%20rendering%20issue%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2212631%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%E5%85%B3%E4%BA%8E%E4%BD%A0%E6%8F%90%E5%88%B0%E7%9A%84%E9%80%82%E7%94%A8%E4%BA%8E%20i.mx8MP%20%E7%9A%84%E5%AE%89%E5%8D%93%2015.0.0%20v1.0.0%20%E4%B8%8A%E7%9A%84%20WebGL%20%E6%B8%B2%E6%9F%93%E9%97%AE%E9%A2%98%EF%BC%8C%E7%9B%AE%E5%89%8D%E6%B2%A1%E6%9C%89%E4%B8%93%E9%97%A8%E4%BF%AE%E5%A4%8D%E8%BF%99%E4%B8%AA%E9%97%AE%E9%A2%98%E7%9A%84%E6%96%B0%E7%89%88%E6%9C%AC%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E8%BF%99%E4%B8%AA%20WebGL%20%E6%B8%B2%E6%9F%93%E9%97%AE%E9%A2%98%E4%BC%BC%E4%B9%8E%E4%B8%8E%E5%AE%89%E5%8D%93%E7%9A%84%20WebView%20%E5%AE%9E%E7%8E%B0%E4%B8%AD%E7%9A%84%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8A%9F%E8%83%BD%E6%9C%89%E5%85%B3%EF%BC%8C%E8%BF%99%E4%BA%9B%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8A%9F%E8%83%BD%E5%9F%BA%E4%BA%8E%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%BB%A3%E7%A0%81%E5%8C%85%E5%91%BD%E5%90%8D%E9%99%90%E5%88%B6%20WebGL%20%E7%9A%84%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90%E3%80%82%E4%B9%8B%E6%89%80%E4%BB%A5%E5%87%BA%E7%8E%B0%E6%AD%A4%E9%97%AE%E9%A2%98%EF%BC%8C%E6%98%AF%E5%9B%A0%E4%B8%BA%E5%8F%AA%E6%9C%89%E5%BD%93%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%BB%A3%E7%A0%81%E5%8C%85%20ID%20%E4%B8%AD%E5%8C%85%E5%90%AB%20%22%20chromium%20%22%20%E4%B8%80%E8%AF%8D%E6%97%B6%20WebGL%20%E5%8A%9F%E8%83%BD%E6%89%8D%E5%8F%AF%E7%94%A8%EF%BC%8C%E4%BD%86%E5%9C%A8%E4%BD%BF%E7%94%A8%E5%85%B6%E4%BB%96%E5%91%BD%E5%90%8D%E7%BA%A6%E5%AE%9A%E6%97%B6%E5%A4%B1%E8%B4%A5%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E8%99%BD%E7%84%B6%E6%88%91%E4%BB%AC%E8%BF%98%E6%B2%A1%E6%9C%89%E8%A7%A3%E5%86%B3%E6%AD%A4%E9%97%AE%E9%A2%98%E7%9A%84%E6%96%B0%E7%89%88%E6%9C%AC%EF%BC%8C%E4%BD%86%E5%9C%A8%E5%88%9D%E5%A7%8B%E5%8C%96%20WebView%20%E4%B9%8B%E5%89%8D%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%9C%A8%E6%82%A8%E7%9A%84%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%BB%A3%E7%A0%81%E4%B8%AD%E5%AE%9E%E7%8E%B0%E4%BB%A5%E4%B8%8B%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95%EF%BC%9A%3CBR%20%2F%3E%3CBR%20%2F%3E%60%60java%20i%20%3CBR%20%2F%3E%20f%20(build.version.sdk_int%20%26gt%3B%20%3D%20build.version_codes.O)%20%7Bwebview.setWebContentsDebuggingEnabled%20(true)%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3EWebSettings%20webSettings%20%3D%20webView.getSettings()%EF%BC%9B%3CBR%20%2F%3EwebSettings.setJavaScriptEnabled(true)%EF%BC%9B%3CBR%20%2F%3EwebView.setWebChromeClient(newWebChromeClient())%3B%3CBR%20%2F%3EwebSettings.setAllowFileAccessFromFileURLs(true)%EF%BC%9B%3CBR%20%2F%3EwebSettings.setAllowUniversalAccessFromFileURLs(true)%EF%BC%9B%3CBR%20%2F%3E%2F%2F%20%E6%B7%BB%E5%8A%A0%E6%AD%A4%E8%A1%8C%EF%BC%8C%E4%B8%BA%E6%89%80%E6%9C%89%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E5%90%AF%E7%94%A8%20WebGL%3CBR%20%2F%3EwebSettings.setMediaPlaybackRequiresUserGesture(false)%EF%BC%9B%3CBR%20%2F%3E%60%60%60%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%AD%A4%E9%85%8D%E7%BD%AE%E7%BB%95%E8%BF%87%E4%BA%86%E4%BB%A3%E7%A0%81%E5%8C%85%E5%90%8D%E7%A7%B0%E9%99%90%E5%88%B6%EF%BC%8C%E5%85%81%E8%AE%B8WebGL%E5%9C%A8%E5%85%B7%E6%9C%89%E9%9D%9E%E9%93%AC%E5%8C%85%E5%90%8D%E7%9A%84%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%B8%AD%E6%AD%A3%E5%B8%B8%E8%BF%90%E8%A1%8C%E3%80%82%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%E6%AD%A4%E8%87%B4%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E