SurfaceTextureClient: Add ISurfaceTexture getter.

This change adds a getter method to SurfaceTextureClient to get the
ISurfaceTexture object with which the SurfaceTextureClient is
communicating.

Bug: 4086509
Change-Id: Ifec621e0fe5392a5be56b2348fdc54067cbebcdd
This commit is contained in:
Jamie Gennis 2011-03-14 15:08:53 -07:00
parent 391bbe2246
commit bae774eb20
3 changed files with 11 additions and 0 deletions

View File

@ -33,6 +33,8 @@ class SurfaceTextureClient
public:
SurfaceTextureClient(const sp<ISurfaceTexture>& surfaceTexture);
sp<ISurfaceTexture> getISurfaceTexture() const;
private:
// can't be copied

View File

@ -40,6 +40,10 @@ SurfaceTextureClient::SurfaceTextureClient(
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);

View File

@ -35,6 +35,11 @@ protected:
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;