From 9709687463dc5f1255f435e57b3d2beed8b70330 Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Wed, 13 Jul 2011 19:12:20 -0700 Subject: SurfaceTexture: make (dis)connect into an IPC This change makes the ANativeWindow connect and disconnect calls result in an IPC to the SurfaceTexture object. This will allow us to prevent multiple simultaneous connections from different processes. Change-Id: Id9aa1003b1335b96ca6bd4a1f5a67aa433d42efb --- libs/gui/ISurfaceTexture.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libs/gui/ISurfaceTexture.cpp') diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp index 16e37802b2af..ec06bc0b69a9 100644 --- a/libs/gui/ISurfaceTexture.cpp +++ b/libs/gui/ISurfaceTexture.cpp @@ -41,6 +41,8 @@ enum { GET_ALLOCATOR, QUERY, SET_SYNCHRONOUS_MODE, + CONNECT, + DISCONNECT, }; @@ -154,7 +156,23 @@ public: return result; } + virtual status_t connect(int api) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(api); + remote()->transact(CONNECT, data, &reply); + status_t result = reply.readInt32(); + return result; + } + virtual status_t disconnect(int api) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(api); + remote()->transact(DISCONNECT, data, &reply); + status_t result = reply.readInt32(); + return result; + } }; IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); @@ -248,6 +266,20 @@ status_t BnSurfaceTexture::onTransact( reply->writeInt32(res); return NO_ERROR; } break; + case CONNECT: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int api = data.readInt32(); + status_t res = connect(api); + reply->writeInt32(res); + return NO_ERROR; + } break; + case DISCONNECT: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int api = data.readInt32(); + status_t res = connect(api); + reply->writeInt32(res); + return NO_ERROR; + } break; } return BBinder::onTransact(code, data, reply, flags); } -- cgit v1.2.3-59-g8ed1b