Skip to content

Commit

Permalink
#3215 Additional secure DummySurface device exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrain authored and Oliver Woodman committed Sep 8, 2017
1 parent 3137fcd commit 219ad8a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

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;
Expand Down Expand Up @@ -152,9 +153,16 @@ private static void assertApiLevel17OrHigher() {
*
* @param context Any {@link Context}.
*/
@SuppressWarnings("unused") // Context may be needed in the future for better targeting.
@SuppressWarnings("unused")
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 >= 24 && 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,
Expand Down

0 comments on commit 219ad8a

Please sign in to comment.