Merge "SurfaceTextureClient: Add ISurfaceTexture getter." into honeycomb-mr1
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
index 4cdece9..7992105 100644
--- a/include/gui/SurfaceTextureClient.h
+++ b/include/gui/SurfaceTextureClient.h
@@ -33,6 +33,8 @@
public:
SurfaceTextureClient(const sp<ISurfaceTexture>& surfaceTexture);
+ sp<ISurfaceTexture> getISurfaceTexture() const;
+
private:
// can't be copied
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 111141f..7f1d9cb 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -40,6 +40,10 @@
mAllocator = mSurfaceTexture->getAllocator();
}
+sp<ISurfaceTexture> SurfaceTextureClient::getISurfaceTexture() const {
+ return mSurfaceTexture;
+}
+
int SurfaceTextureClient::setSwapInterval(ANativeWindow* window, int interval) {
SurfaceTextureClient* c = getSelf(window);
return c->setSwapInterval(interval);
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index 359b71c..25109f6 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -35,6 +35,11 @@
sp<SurfaceTextureClient> mSTC;
};
+TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) {
+ sp<ISurfaceTexture> ist(mSTC->getISurfaceTexture());
+ ASSERT_TRUE(ist != NULL);
+}
+
TEST_F(SurfaceTextureClientTest, QueuesToWindowCompositorIsFalse) {
sp<ANativeWindow> anw(mSTC);
int result = -123;