From 88b6df1d083eeabd783274b17c706cb09ff027e5 Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 25 Oct 2017 04:32:27 -0700 Subject: [PATCH] Disable secure DummySurface on Samsung devices on API level 25 Issue: #3373 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=173381588 --- .../android/exoplayer2/video/DummySurface.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java b/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java index 450b4af38c..2d7a9dfd33 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/DummySurface.java @@ -150,14 +150,9 @@ public final class DummySurface extends Surface { */ @TargetApi(24) private static boolean enableSecureDummySurfaceV24(Context context) { - EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS); - if (eglExtensions == null || !eglExtensions.contains("EGL_EXT_protected_content")) { - // EGL_EXT_protected_content is required to enable secure dummy surfaces. - return false; - } - if (Util.SDK_INT == 24 && "samsung".equals(Util.MANUFACTURER)) { - // Samsung devices running API level 24 are known to be broken [Internal: b/37197802]. + if (Util.SDK_INT < 26 && "samsung".equals(Util.MANUFACTURER)) { + // Samsung devices running Nougat are known to be broken. See + // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802]. return false; } if (Util.SDK_INT < 26 && !context.getPackageManager().hasSystemFeature( @@ -165,6 +160,12 @@ public final class DummySurface extends Surface { // Pre API level 26 devices were not well tested unless they supported VR mode. return false; } + EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); + String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS); + if (eglExtensions == null || !eglExtensions.contains("EGL_EXT_protected_content")) { + // EGL_EXT_protected_content is required to enable secure dummy surfaces. + return false; + } return true; }