From b89ea9d9533864bc6f73a24a4d33d3edba6d1365 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 10 Dec 2018 13:01:14 -0800 Subject: SurfaceFlinger: Removed createScopedConnection. Scoped connections existed to constrain clients to only making surfaces with parents. However now that we support off-screen parents this is no longer required and we can use normal connections everywhere. We take however care that only priviledged clients can place layers in the current state. Test: Manual Bug: 62536731 Bug: 111373437 Bug: 111297488 Change-Id: I0a034767e92becec63071d7b1e3e71b95d505b77 --- libs/gui/ISurfaceComposer.cpp | 18 ------------------ libs/gui/SurfaceComposerClient.cpp | 9 +-------- libs/gui/SurfaceControl.cpp | 7 +++++++ libs/gui/include/gui/ISurfaceComposer.h | 16 ++-------------- libs/gui/include/gui/SurfaceComposerClient.h | 2 -- libs/gui/include/gui/SurfaceControl.h | 2 ++ libs/gui/tests/Surface_test.cpp | 4 ---- 7 files changed, 12 insertions(+), 46 deletions(-) (limited to 'libs') diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 2f6ef79af9..a481e81131 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -63,16 +63,6 @@ public: return interface_cast(reply.readStrongBinder()); } - virtual sp createScopedConnection( - const sp& parent) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(parent)); - remote()->transact(BnSurfaceComposer::CREATE_SCOPED_CONNECTION, data, &reply); - return interface_cast(reply.readStrongBinder()); - } - virtual void setTransactionState(const Vector& state, const Vector& displays, uint32_t flags, const sp& applyToken, @@ -711,14 +701,6 @@ status_t BnSurfaceComposer::onTransact( reply->writeStrongBinder(b); return NO_ERROR; } - case CREATE_SCOPED_CONNECTION: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp bufferProducer = - interface_cast(data.readStrongBinder()); - sp b = IInterface::asBinder(createScopedConnection(bufferProducer)); - reply->writeStrongBinder(b); - return NO_ERROR; - } case SET_TRANSACTION_STATE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index e043762653..824e43fb07 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -910,11 +910,6 @@ SurfaceComposerClient::SurfaceComposerClient() { } -SurfaceComposerClient::SurfaceComposerClient(const sp& root) - : mStatus(NO_INIT), mParent(root) -{ -} - SurfaceComposerClient::SurfaceComposerClient(const sp& client) : mStatus(NO_ERROR), mClient(client) { @@ -923,10 +918,8 @@ SurfaceComposerClient::SurfaceComposerClient(const sp& c void SurfaceComposerClient::onFirstRef() { sp sf(ComposerService::getComposerService()); if (sf != nullptr && mStatus == NO_INIT) { - auto rootProducer = mParent.promote(); sp conn; - conn = (rootProducer != nullptr) ? sf->createScopedConnection(rootProducer) : - sf->createConnection(); + conn = sf->createConnection(); if (conn != nullptr) { mClient = conn; mStatus = NO_ERROR; diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 3a6dfdada5..b6ef286fd4 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -54,6 +54,13 @@ SurfaceControl::SurfaceControl( { } +SurfaceControl::SurfaceControl(const sp& other) { + mClient = other->mClient; + mHandle = other->mHandle; + mGraphicBufferProducer = other->mGraphicBufferProducer; + mOwned = false; +} + SurfaceControl::~SurfaceControl() { destroy(); diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index e0ff410873..1534fca790 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -87,22 +87,11 @@ public: eVsyncSourceSurfaceFlinger = 1 }; - /* create connection with surface flinger, requires - * ACCESS_SURFACE_FLINGER permission + /* + * Create a connection with SurfaceFlinger. */ virtual sp createConnection() = 0; - /** create a scoped connection with surface flinger. - * Surfaces produced with this connection will act - * as children of the passed in GBP. That is to say - * SurfaceFlinger will draw them relative and confined to - * drawing of buffers from the layer associated with parent. - * As this is graphically equivalent in reach to just drawing - * pixels into the parent buffers, it requires no special permission. - */ - virtual sp createScopedConnection( - const sp& parent) = 0; - /* return an IDisplayEventConnection */ virtual sp createDisplayEventConnection( VsyncSource vsyncSource = eVsyncSourceApp) = 0; @@ -356,7 +345,6 @@ public: ENABLE_VSYNC_INJECTIONS, INJECT_VSYNC, GET_LAYER_DEBUG_INFO, - CREATE_SCOPED_CONNECTION, GET_COMPOSITION_PREFERENCE, GET_COLOR_MANAGEMENT, GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES, diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index 9765cdd714..4a8e01bec1 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -90,7 +90,6 @@ class SurfaceComposerClient : public RefBase public: SurfaceComposerClient(); SurfaceComposerClient(const sp& client); - SurfaceComposerClient(const sp& parent); virtual ~SurfaceComposerClient(); // Always make sure we could initialize @@ -402,7 +401,6 @@ private: mutable Mutex mLock; status_t mStatus; sp mClient; - wp mParent; }; // --------------------------------------------------------------------------- diff --git a/libs/gui/include/gui/SurfaceControl.h b/libs/gui/include/gui/SurfaceControl.h index ccb30fa8e7..9bba76674d 100644 --- a/libs/gui/include/gui/SurfaceControl.h +++ b/libs/gui/include/gui/SurfaceControl.h @@ -75,6 +75,8 @@ public: status_t getLayerFrameStats(FrameStats* outStats) const; sp getClient() const; + + explicit SurfaceControl(const sp& other); private: // can't be copied diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index 13fac7fa04..afc30d17b0 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -545,10 +545,6 @@ public: } sp createConnection() override { return nullptr; } - sp createScopedConnection( - const sp& /* parent */) override { - return nullptr; - } sp createDisplayEventConnection(ISurfaceComposer::VsyncSource) override { return nullptr; -- cgit v1.2.3-59-g8ed1b