From 472df08f0837ebbdcd0b1c7e8269ad816b13269b Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 4 Sep 2017 08:55:20 -0700 Subject: [PATCH] Additional secure DummySurface device exclusions Merge: https://github.com/google/ExoPlayer/pull/3225 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167502127 --- .../google/android/exoplayer2/video/DummySurface.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 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 a1820ed7a1..d623ea33ea 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 @@ -43,6 +43,7 @@ import static android.opengl.GLES20.glGenTextures; import android.annotation.TargetApi; import android.content.Context; +import android.content.pm.PackageManager; import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture.OnFrameAvailableListener; import android.opengl.EGL14; @@ -152,9 +153,15 @@ public final class DummySurface extends Surface { * * @param context Any {@link Context}. */ - @SuppressWarnings("unused") // Context may be needed in the future for better targeting. private static boolean deviceNeedsSecureDummySurfaceWorkaround(Context context) { - return Util.SDK_INT == 24 && "samsung".equals(Util.MANUFACTURER); + return (Util.SDK_INT == 24 && "samsung".equals(Util.MANUFACTURER)) + || (Util.SDK_INT < 26 + && !hasVrModeHighPerformanceSystemFeatureV24(context.getPackageManager())); + } + + @TargetApi(24) + private static boolean hasVrModeHighPerformanceSystemFeatureV24(PackageManager packageManager) { + return packageManager.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE); } private static class DummySurfaceThread extends HandlerThread implements OnFrameAvailableListener,