Fix two lingering Android protected content issues

In the AHardwareBuffer bug we weren't passing on the protected status to Ganesh even though we were wrapping a protected AHB.

In the GL window context bug we need to create a protected surface in order to display protected content.

Change-Id: I285393f0b947c1f557cb22038dadbcc7bda6e09a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/739056
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ganesh/gl/AHardwareBufferGL.cpp b/src/gpu/ganesh/gl/AHardwareBufferGL.cpp
index 2489c30..8d555fc 100644
--- a/src/gpu/ganesh/gl/AHardwareBufferGL.cpp
+++ b/src/gpu/ganesh/gl/AHardwareBufferGL.cpp
@@ -167,6 +167,7 @@
     SkASSERT(backendFormat.isValid());
     textureInfo.fTarget = target;
     textureInfo.fFormat = GrBackendFormats::AsGLFormatEnum(backendFormat);
+    textureInfo.fProtected = skgpu::Protected(isProtectedContent);
 
     *deleteProc = delete_gl_texture;
     *updateProc = update_gl_texture;
diff --git a/tools/window/android/GLWindowContext_android.cpp b/tools/window/android/GLWindowContext_android.cpp
index f142de1..3266860 100644
--- a/tools/window/android/GLWindowContext_android.cpp
+++ b/tools/window/android/GLWindowContext_android.cpp
@@ -113,7 +113,14 @@
 //    SkDebugf("Vendor: %s", eglQueryString(fDisplay, EGL_VENDOR));
 //    SkDebugf("Extensions: %s", eglQueryString(fDisplay, EGL_EXTENSIONS));
 
-    fSurfaceAndroid = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow, nullptr);
+    const EGLint surfaceAttribs[] = {
+        fDisplayParams.fCreateProtectedNativeBackend ? EGL_PROTECTED_CONTENT_EXT :EGL_NONE,
+        fDisplayParams.fCreateProtectedNativeBackend ? EGL_TRUE : EGL_NONE,
+        EGL_NONE
+    };
+
+    fSurfaceAndroid = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow,
+                                             surfaceAttribs);
     SkASSERT(EGL_NO_SURFACE != fSurfaceAndroid);
 
     SkAssertResult(eglMakeCurrent(fDisplay, fSurfaceAndroid, fSurfaceAndroid, fEGLContext));