Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3215 Additional secure DummySurface device exclusions #3225

Merged
merged 1 commit into from
Sep 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted this change by accident (sorry!), although having looked at it some more I'm not sure it's right that this method returns false on API levels below 24 just because we can't check the VR flag. If secure dummy surface didn't work reliably on devices without the VR flag on API levels 24 and 25, I doubt it worked reliable prior to the flag even having existed :).

It's likely that EGL_EXT_protected_content wasn't advertised prior to API level 24, so perhaps this is a hypothetical case, but seems worth disabling anyway. I'll push a new CL to un-revert and make this change (and will ref it in the related issue). Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No probs, whatever works is good by me. Previously it would only ever return true if the SDK was 24 and it was a Samsung device, so I figured it was safe to return false <24 until we found a <24 device that required the secure dummy surface workaround.

&& !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