Loading libs/gui/WindowInfosListenerReporter.cpp +11 −18 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. */ #include <android-base/logging.h> #include <android/gui/ISurfaceComposer.h> #include <android/gui/IWindowInfosListener.h> #include <gui/AidlUtil.h> Loading @@ -35,29 +36,21 @@ sp<WindowInfosListenerReporter> WindowInfosListenerReporter::getInstance() { android::base::Result<gui::WindowInfosUpdate> WindowInfosListenerReporter::addWindowInfosListener( sp<WindowInfosListener> windowInfosListener, const sp<gui::ISurfaceComposer>& surfaceComposer) { status_t status = OK; { std::scoped_lock lock(mListenersMutex); if (mWindowInfosListeners.empty()) { gui::WindowInfosListenerInfo listenerInfo; binder::Status s = surfaceComposer->addWindowInfosListener(this, &listenerInfo); status = statusTFromBinderStatus(s); if (status == OK) { binder::Status status = surfaceComposer->addWindowInfosListener(this, &listenerInfo); LOG_IF(FATAL, !status.isOk()) << "Can't register window infos listener for pid " << getpid() << ". Device won't be usable"; mWindowInfosPublisher = std::move(listenerInfo.windowInfosPublisher); mListenerId = listenerInfo.listenerId; } } if (status == OK) { mWindowInfosListeners.emplace(std::move(windowInfosListener)); } return mLastUpdate; } return android::base::Error(status); } status_t WindowInfosListenerReporter::removeWindowInfosListener( const sp<WindowInfosListener>& windowInfosListener, const sp<gui::ISurfaceComposer>& surfaceComposer) { Loading Loading
libs/gui/WindowInfosListenerReporter.cpp +11 −18 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. */ #include <android-base/logging.h> #include <android/gui/ISurfaceComposer.h> #include <android/gui/IWindowInfosListener.h> #include <gui/AidlUtil.h> Loading @@ -35,29 +36,21 @@ sp<WindowInfosListenerReporter> WindowInfosListenerReporter::getInstance() { android::base::Result<gui::WindowInfosUpdate> WindowInfosListenerReporter::addWindowInfosListener( sp<WindowInfosListener> windowInfosListener, const sp<gui::ISurfaceComposer>& surfaceComposer) { status_t status = OK; { std::scoped_lock lock(mListenersMutex); if (mWindowInfosListeners.empty()) { gui::WindowInfosListenerInfo listenerInfo; binder::Status s = surfaceComposer->addWindowInfosListener(this, &listenerInfo); status = statusTFromBinderStatus(s); if (status == OK) { binder::Status status = surfaceComposer->addWindowInfosListener(this, &listenerInfo); LOG_IF(FATAL, !status.isOk()) << "Can't register window infos listener for pid " << getpid() << ". Device won't be usable"; mWindowInfosPublisher = std::move(listenerInfo.windowInfosPublisher); mListenerId = listenerInfo.listenerId; } } if (status == OK) { mWindowInfosListeners.emplace(std::move(windowInfosListener)); } return mLastUpdate; } return android::base::Error(status); } status_t WindowInfosListenerReporter::removeWindowInfosListener( const sp<WindowInfosListener>& windowInfosListener, const sp<gui::ISurfaceComposer>& surfaceComposer) { Loading