catch exception when hardware renderer can not be set up

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 9 ++
1 file changed, 7 insertions(+), 2 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java 🔗

@@ -13,6 +13,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
+import android.opengl.GLException;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
@@ -836,8 +837,12 @@ public class RtpSessionActivity extends XmppActivity
         surfaceViewRenderer.setVisibility(View.VISIBLE);
         try {
             surfaceViewRenderer.init(requireRtpConnection().getEglBaseContext(), null);
-        } catch (final IllegalStateException e) {
-            // Log.d(Config.LOGTAG, "SurfaceViewRenderer was already initialized");
+        } catch (final IllegalStateException ignored) {
+            // SurfaceViewRenderer was already initialized
+        } catch (final RuntimeException e) {
+            if (Throwables.getRootCause(e) instanceof GLException glException) {
+                Log.w(Config.LOGTAG, "could not set up hardware renderer", glException);
+            }
         }
         surfaceViewRenderer.setEnableHardwareScaler(true);
     }