Fail createVirtualDisplay with single-buffered Surface
Bug 30106031
Change-Id: I434df329eb3c162dd9ef01245ac5e0da97216e70
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 0d8a95c..73b3f52 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -371,7 +371,12 @@
if (sur != NULL) {
bufferProducer = sur->getIGraphicBufferProducer();
}
- SurfaceComposerClient::setDisplaySurface(token, bufferProducer);
+ status_t err = SurfaceComposerClient::setDisplaySurface(token,
+ bufferProducer);
+ if (err != NO_ERROR) {
+ doThrowIAE(env, "Illegal Surface, could not enable async mode. Was this"
+ " Surface created with singleBufferMode?");
+ }
}
static void nativeSetDisplayLayerStack(JNIEnv* env, jclass clazz,