diff options
author | Jamie Gennis <jgennis@google.com> | 2011-03-14 15:34:04 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2011-03-15 10:37:37 -0700 |
commit | bae716bc153962c3ac79660bf32e5c50f0de343d (patch) | |
tree | 2ee7aa6eddbd9789b1b561143927c274004e0977 /native/android/native_window.cpp | |
parent | 75597105e6e03f656bdc1e40acac44afb9a3b01b (diff) | |
download | frameworks_base-bae716bc153962c3ac79660bf32e5c50f0de343d.zip frameworks_base-bae716bc153962c3ac79660bf32e5c50f0de343d.tar.gz frameworks_base-bae716bc153962c3ac79660bf32e5c50f0de343d.tar.bz2 |
SurfaceTexture: disallow unsupported uses.
This change makes the ANativeWindow_lock NDK function error out if it is
passed an ANativeWindow with a concrete type that is not Surface. It
also makes eglCreateWindowSurface fail if it is passed a
SurfaceTextureClient as its 'window' argument.
Bug: 4087277
Change-Id: Ie68c50c52d88f72d8a387f6c094908044c83a88c
Diffstat (limited to 'native/android/native_window.cpp')
-rw-r--r-- | native/android/native_window.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/native/android/native_window.cpp b/native/android/native_window.cpp index 219cd196..ae1993d 100644 --- a/native/android/native_window.cpp +++ b/native/android/native_window.cpp @@ -74,6 +74,12 @@ int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds) { + int type = -1; + if (window->query(window, NATIVE_WINDOW_CONCRETE_TYPE, &type) != 0 || + type != NATIVE_WINDOW_SURFACE) { + return BAD_VALUE; + } + Region dirtyRegion; Region* dirtyParam = NULL; if (inOutDirtyBounds != NULL) { |