diff options
Diffstat (limited to 'libs/gui')
| -rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 20 | ||||
| -rw-r--r-- | libs/gui/aidl/android/gui/ISurfaceComposer.aidl | 4 | ||||
| -rw-r--r-- | libs/gui/include/gui/ISurfaceComposer.h | 4 | ||||
| -rw-r--r-- | libs/gui/include/gui/SurfaceComposerClient.h | 8 | ||||
| -rw-r--r-- | libs/gui/tests/EndToEndNativeInputTest.cpp | 7 | ||||
| -rw-r--r-- | libs/gui/tests/Surface_test.cpp | 9 |
6 files changed, 28 insertions, 24 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 7aaaebbc8e..0a85cf8d8a 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1280,18 +1280,22 @@ status_t SurfaceComposerClient::Transaction::sendSurfaceFlushJankDataTransaction } // --------------------------------------------------------------------------- -sp<IBinder> SurfaceComposerClient::createDisplay(const String8& displayName, bool isSecure, - const std::string& uniqueId, - float requestedRefreshRate) { +sp<IBinder> SurfaceComposerClient::createVirtualDisplay(const std::string& displayName, + bool isSecure, const std::string& uniqueId, + float requestedRefreshRate) { sp<IBinder> display = nullptr; - binder::Status status = ComposerServiceAIDL::getComposerService() - ->createDisplay(std::string(displayName.c_str()), isSecure, - uniqueId, requestedRefreshRate, &display); + binder::Status status = + ComposerServiceAIDL::getComposerService()->createVirtualDisplay(displayName, isSecure, + uniqueId, + requestedRefreshRate, + &display); return status.isOk() ? display : nullptr; } -void SurfaceComposerClient::destroyDisplay(const sp<IBinder>& display) { - ComposerServiceAIDL::getComposerService()->destroyDisplay(display); +status_t SurfaceComposerClient::destroyVirtualDisplay(const sp<IBinder>& displayToken) { + return ComposerServiceAIDL::getComposerService() + ->destroyVirtualDisplay(displayToken) + .transactionError(); } std::vector<PhysicalDisplayId> SurfaceComposerClient::getPhysicalDisplayIds() { diff --git a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl index c6e7197f24..11ccc9c2fa 100644 --- a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl +++ b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl @@ -105,14 +105,14 @@ interface ISurfaceComposer { * * requires ACCESS_SURFACE_FLINGER permission. */ - @nullable IBinder createDisplay(@utf8InCpp String displayName, boolean isSecure, + @nullable IBinder createVirtualDisplay(@utf8InCpp String displayName, boolean isSecure, @utf8InCpp String uniqueId, float requestedRefreshRate); /** * Destroy a virtual display. * requires ACCESS_SURFACE_FLINGER permission. */ - void destroyDisplay(IBinder display); + void destroyVirtualDisplay(IBinder displayToken); /** * Get stable IDs for connected physical displays. diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index 738c73a24b..eb4a802c17 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -130,8 +130,8 @@ public: CREATE_CONNECTION, // Deprecated. Autogenerated by .aidl now. GET_STATIC_DISPLAY_INFO, // Deprecated. Autogenerated by .aidl now. CREATE_DISPLAY_EVENT_CONNECTION, // Deprecated. Autogenerated by .aidl now. - CREATE_DISPLAY, // Deprecated. Autogenerated by .aidl now. - DESTROY_DISPLAY, // Deprecated. Autogenerated by .aidl now. + CREATE_VIRTUAL_DISPLAY, // Deprecated. Autogenerated by .aidl now. + DESTROY_VIRTUAL_DISPLAY, // Deprecated. Autogenerated by .aidl now. GET_PHYSICAL_DISPLAY_TOKEN, // Deprecated. Autogenerated by .aidl now. SET_TRANSACTION_STATE, AUTHENTICATE_SURFACE, // Deprecated. Autogenerated by .aidl now. diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index 987efe01ba..e2307ed60a 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -376,11 +376,11 @@ public: sp<SurfaceControl> mirrorDisplay(DisplayId displayId); static const std::string kEmpty; - static sp<IBinder> createDisplay(const String8& displayName, bool isSecure, - const std::string& uniqueId = kEmpty, - float requestedRefreshRate = 0); + static sp<IBinder> createVirtualDisplay(const std::string& displayName, bool isSecure, + const std::string& uniqueId = kEmpty, + float requestedRefreshRate = 0); - static void destroyDisplay(const sp<IBinder>& display); + static status_t destroyVirtualDisplay(const sp<IBinder>& displayToken); static std::vector<PhysicalDisplayId> getPhysicalDisplayIds(); diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp index 45e33902c7..7d0b512cb4 100644 --- a/libs/gui/tests/EndToEndNativeInputTest.cpp +++ b/libs/gui/tests/EndToEndNativeInputTest.cpp @@ -1184,9 +1184,8 @@ public: MultiDisplayTests() : InputSurfacesTest() { ProcessState::self()->startThreadPool(); } void TearDown() override { - for (auto& token : mVirtualDisplays) { - SurfaceComposerClient::destroyDisplay(token); - } + std::for_each(mVirtualDisplays.begin(), mVirtualDisplays.end(), + SurfaceComposerClient::destroyVirtualDisplay); InputSurfacesTest::TearDown(); } @@ -1201,7 +1200,7 @@ public: std::string name = "VirtualDisplay"; name += std::to_string(mVirtualDisplays.size()); - sp<IBinder> token = SurfaceComposerClient::createDisplay(String8(name.c_str()), isSecure); + sp<IBinder> token = SurfaceComposerClient::createVirtualDisplay(name, isSecure); SurfaceComposerClient::Transaction t; t.setDisplaySurface(token, producer); t.setDisplayFlags(token, receivesInput ? 0x01 /* DisplayDevice::eReceivesInput */ : 0); diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index eee4fb93c9..6c6a849544 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -673,13 +673,14 @@ public: return binder::Status::ok(); } - binder::Status createDisplay(const std::string& /*displayName*/, bool /*isSecure*/, - const std::string& /*uniqueId*/, float /*requestedRefreshRate*/, - sp<IBinder>* /*outDisplay*/) override { + binder::Status createVirtualDisplay(const std::string& /*displayName*/, bool /*isSecure*/, + const std::string& /*uniqueId*/, + float /*requestedRefreshRate*/, + sp<IBinder>* /*outDisplay*/) override { return binder::Status::ok(); } - binder::Status destroyDisplay(const sp<IBinder>& /*display*/) override { + binder::Status destroyVirtualDisplay(const sp<IBinder>& /*displayToken*/) override { return binder::Status::ok(); } |