From 579b3f88d03d06b897b778bd11818f5104677d1d Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 8 Jun 2010 19:54:15 -0700 Subject: allow re-targetting of surfaces Surfaces can now be parcelized and sent to remote processes. When a surface crosses a process boundary, it looses its connection with the current process and gets attached to the new one. Change-Id: I39c7b055bcd3ea1162ef2718d3d4b866bf7c81c0 --- libs/surfaceflinger/SurfaceFlinger.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'libs/surfaceflinger/SurfaceFlinger.cpp') diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index 49268588b5..4dea62f410 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -1718,7 +1718,10 @@ void UserClient::detachLayer(const Layer* layer) { int32_t name = layer->getToken(); if (name >= 0) { - android_atomic_and(~(1LU<& sur) const sp layer(mFlinger->getLayer(sur)); if (layer == 0) return name; - // this layer already has a token, just return it - // FIXME: we should check that this token is for the same client + // if this layer already has a token, just return it name = layer->getToken(); - if (name >= 0) return name; + if ((name >= 0) && (layer->getClient() == this)) + return name; name = 0; do { int32_t mask = 1LU<setToken(const_cast(this), ctrlblk, name); + status_t err = layer->setToken( + const_cast(this), ctrlblk, name); + if (err != NO_ERROR) { + // free the name + android_atomic_and(~mask, &mBitmap); + name = err; + } break; } if (++name > 31) -- cgit v1.2.3-59-g8ed1b