BlastBufferQueue: Handle queue to window composer queries
When queuing protected buffers, libstagefright queries
ANativeWindow to check if the ANativeWindow sends buffers
directly to SurfaceFlinger. This check works by verifying
the IGBP matches one of the tracked IGBPs in SurfaceFlinger.
This does not apply to blast layers since SurfaceFlinger does
not create IGBPs and there may not be any IGBP used to
submit buffers. To fix this for the blast adapter, we query the
blast buffer queue producer to see if it queues to
SurfaceFlinger.
Bug: b/175904021, b/168917217
Test: atest BlastBufferQueueTest
Test: Play protected content via Google Play on AndroidTV
Change-Id: Id1affce09742c6b438c7499b525615b8bd294b9a
diff --git a/libs/gui/tests/BLASTBufferQueue_test.cpp b/libs/gui/tests/BLASTBufferQueue_test.cpp
index 17f8b97..170ad87 100644
--- a/libs/gui/tests/BLASTBufferQueue_test.cpp
+++ b/libs/gui/tests/BLASTBufferQueue_test.cpp
@@ -24,6 +24,7 @@
#include <gui/FrameTimestamps.h>
#include <gui/IGraphicBufferProducer.h>
#include <gui/IProducerListener.h>
+#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
#include <gui/SyncScreenCaptureListener.h>
#include <private/gui/ComposerService.h>
@@ -515,6 +516,18 @@
adapter.waitForCallbacks();
}
+TEST_F(BLASTBufferQueueTest, QueryNativeWindowQueuesToWindowComposer) {
+ BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight);
+
+ sp<android::Surface> surface = new Surface(adapter.getIGraphicBufferProducer());
+ ANativeWindow* nativeWindow = (ANativeWindow*)(surface.get());
+ int queuesToNativeWindow = 0;
+ int err = nativeWindow->query(nativeWindow, NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
+ &queuesToNativeWindow);
+ ASSERT_EQ(NO_ERROR, err);
+ ASSERT_EQ(queuesToNativeWindow, 1);
+}
+
class BLASTBufferQueueTransformTest : public BLASTBufferQueueTest {
public:
void test(uint32_t tr) {