diff options
author | Jamie Gennis <jgennis@google.com> | 2012-10-19 18:19:11 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2012-10-22 13:41:21 -0700 |
commit | dd3cb84cfbe8068790c6233b5829fae9c4a0ee93 (patch) | |
tree | 366d14c7147f365dd47f85f418e262dec0427141 /libs | |
parent | 60393d45207b6548e1f61ca104fa59aecee87d30 (diff) | |
download | frameworks_native-dd3cb84cfbe8068790c6233b5829fae9c4a0ee93.zip frameworks_native-dd3cb84cfbe8068790c6233b5829fae9c4a0ee93.tar.gz frameworks_native-dd3cb84cfbe8068790c6233b5829fae9c4a0ee93.tar.bz2 |
SurfaceFlinger: add support for secure displays
This change adds support for displays that are not allowed to display surfaces
with the eSecure flag set. All non-virtual displays are considered secure,
while virtual displays have their secure-ness specified at creation time.
Bug: 7368436
Change-Id: I81ad535d2d1e5a7ff78269017e85b111f0098500
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 20 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 12 |
2 files changed, 11 insertions, 21 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index aff1b45..85a9488 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -179,11 +179,12 @@ public: return result; } - virtual sp<IBinder> createDisplay(const String8& displayName) + virtual sp<IBinder> createDisplay(const String8& displayName, bool secure) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); data.writeString8(displayName); + data.writeInt32(secure ? 1 : 0); remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply); return reply.readStrongBinder(); } @@ -222,14 +223,6 @@ public: memcpy(info, reply.readInplace(sizeof(DisplayInfo)), sizeof(DisplayInfo)); return reply.readInt32(); } - - - virtual void connectDisplay(const sp<ISurfaceTexture>& display) { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display->asBinder()); - remote()->transact(BnSurfaceComposer::CONNECT_DISPLAY, data, &reply); - } }; IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer"); @@ -309,7 +302,8 @@ status_t BnSurfaceComposer::onTransact( case CREATE_DISPLAY: { CHECK_INTERFACE(ISurfaceComposer, data, reply); String8 displayName = data.readString8(); - sp<IBinder> display(createDisplay(displayName)); + bool secure = bool(data.readInt32()); + sp<IBinder> display(createDisplay(displayName, secure)); reply->writeStrongBinder(display); return NO_ERROR; } break; @@ -338,12 +332,6 @@ status_t BnSurfaceComposer::onTransact( memcpy(reply->writeInplace(sizeof(DisplayInfo)), &info, sizeof(DisplayInfo)); reply->writeInt32(result); } break; - case CONNECT_DISPLAY: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp<ISurfaceTexture> surfaceTexture = - interface_cast<ISurfaceTexture>(data.readStrongBinder()); - connectDisplay(surfaceTexture); - } break; default: return BBinder::onTransact(code, data, reply, flags); } diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 8586ed2..80dd6ee 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -131,7 +131,7 @@ class Composer : public Singleton<Composer> DisplayState& getDisplayStateLocked(const sp<IBinder>& token); public: - sp<IBinder> createDisplay(const String8& displayName); + sp<IBinder> createDisplay(const String8& displayName, bool secure); sp<IBinder> getBuiltInDisplay(int32_t id); status_t setPosition(const sp<SurfaceComposerClient>& client, SurfaceID id, @@ -175,8 +175,9 @@ ANDROID_SINGLETON_STATIC_INSTANCE(Composer); // --------------------------------------------------------------------------- -sp<IBinder> Composer::createDisplay(const String8& displayName) { - return ComposerService::getComposerService()->createDisplay(displayName); +sp<IBinder> Composer::createDisplay(const String8& displayName, bool secure) { + return ComposerService::getComposerService()->createDisplay(displayName, + secure); } sp<IBinder> Composer::getBuiltInDisplay(int32_t id) { @@ -459,8 +460,9 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface( return result; } -sp<IBinder> SurfaceComposerClient::createDisplay(const String8& displayName) { - return Composer::getInstance().createDisplay(displayName); +sp<IBinder> SurfaceComposerClient::createDisplay(const String8& displayName, + bool secure) { + return Composer::getInstance().createDisplay(displayName, secure); } sp<IBinder> SurfaceComposerClient::getBuiltInDisplay(int32_t id) { |