Android 15: i.MX8MP: WebGL rendering issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android 15: i.MX8MP: WebGL rendering issue

Jump to solution
522 Views
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

Labels (2)
0 Kudos
Reply
1 Solution
468 Views
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

View solution in original post

2 Replies
464 Views
pierluigi_p
Senior Contributor I

Thanks @Bio_TICFSL 

0 Kudos
Reply
469 Views
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%3A%20i.MX8MP%3A%20WebGL%20rendering%20issue%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2207131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%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%2C%3C%2FP%3E%3CP%3Ein%20a%20%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%3Eprevious%20post%3C%2FA%3E%2C%20I%20can%20read%20about%20a%20known%26nbsp%3B%3CSPAN%3EWebGL%20rendering%20issue%20on%20Android%2015.0.0%20v1.0.0.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIs%20there%20any%20new%20release%20fixing%20this%20%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20yes%2C%20can%20you%20share%20the%20actual%20fix%20%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EBest%20Regards%3C%2FP%3E%3CP%3EPier%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%3EGraphics%20%26amp%3B%20Display%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%3EThanks%26nbsp%3B%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%26nbsp%3B%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%3EHello%2C%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ERegarding%20the%20WebGL%20rendering%20issue%20on%20Android%2015.0.0%20v1.0.0%20for%20i.MX8MP%20that%20you%20mentioned%2C%20there%20is%20currently%20no%20new%20release%20that%20specifically%20fixes%20this%20issue.%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20WebGL%20rendering%20problem%20appears%20to%20be%20related%20to%20security%20features%20in%20Android's%20WebView%20implementation%20that%20restrict%20WebGL%20access%20based%20on%20application%20package%20naming.%20The%20issue%20occurs%20because%20WebGL%20functionality%20is%20only%20available%20when%20application%20package%20IDs%20contain%20the%20word%20%22chromium%22%20but%20fails%20with%20other%20naming%20conventions.%3CBR%20%2F%3E%3CBR%20%2F%3EWhile%20we%20don't%20have%20a%20new%20release%20addressing%20this%20issue%20yet%2C%20the%20following%20workaround%20can%20be%20implemented%20in%20your%20application%20code%20before%20initializing%20the%20WebView%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%60%60%60java%3CBR%20%2F%3Eif%20(Build.VERSION.SDK_INT%20%26gt%3B%3D%20Build.VERSION_CODES.O)%20%7B%3CBR%20%2F%3EWebView.setWebContentsDebuggingEnabled(true)%3B%3CBR%20%2F%3E%7D%3CBR%20%2F%3EWebSettings%20webSettings%20%3D%20webView.getSettings()%3B%3CBR%20%2F%3EwebSettings.setJavaScriptEnabled(true)%3B%3CBR%20%2F%3EwebView.setWebChromeClient(new%20WebChromeClient())%3B%3CBR%20%2F%3EwebSettings.setAllowFileAccessFromFileURLs(true)%3B%3CBR%20%2F%3EwebSettings.setAllowUniversalAccessFromFileURLs(true)%3B%3CBR%20%2F%3E%2F%2F%20Add%20this%20line%20to%20enable%20WebGL%20for%20all%20applications%3CBR%20%2F%3EwebSettings.setMediaPlaybackRequiresUserGesture(false)%3B%3CBR%20%2F%3E%60%60%60%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20configuration%20bypasses%20the%20package%20name%20restriction%2C%20allowing%20WebGL%20to%20function%20properly%20in%20applications%20with%20non-chromium%20package%20names.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ERegards%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E