Loading libs/gui/SurfaceComposerClient.cpp +5 −42 Original line number Diff line number Diff line Loading @@ -636,8 +636,7 @@ SurfaceComposerClient::Transaction::Transaction(const Transaction& other) mDesiredPresentTime(other.mDesiredPresentTime), mIsAutoTimestamp(other.mIsAutoTimestamp), mFrameTimelineInfo(other.mFrameTimelineInfo), mApplyToken(other.mApplyToken), mWindowInfosReportedEvent(other.mWindowInfosReportedEvent) { mApplyToken(other.mApplyToken) { mDisplayStates = other.mDisplayStates; mComposerStates = other.mComposerStates; mInputWindowCommands = other.mInputWindowCommands; Loading Loading @@ -881,9 +880,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr mEarlyWakeupStart = mEarlyWakeupStart || other.mEarlyWakeupStart; mEarlyWakeupEnd = mEarlyWakeupEnd || other.mEarlyWakeupEnd; mApplyToken = other.mApplyToken; if (other.mWindowInfosReportedEvent) { mWindowInfosReportedEvent = std::move(other.mWindowInfosReportedEvent); } mergeFrameTimelineInfo(mFrameTimelineInfo, other.mFrameTimelineInfo); Loading @@ -906,7 +902,6 @@ void SurfaceComposerClient::Transaction::clear() { mIsAutoTimestamp = true; clearFrameTimelineInfo(mFrameTimelineInfo); mApplyToken = nullptr; mWindowInfosReportedEvent = nullptr; } uint64_t SurfaceComposerClient::Transaction::getId() { Loading Loading @@ -1053,10 +1048,6 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay hasListenerCallbacks, listenerCallbacks, mId); mId = generateId(); if (mWindowInfosReportedEvent && !mWindowInfosReportedEvent->wait()) { ALOGE("Timed out waiting for window infos to be reported."); } // Clear the current states and flags clear(); Loading Loading @@ -1743,25 +1734,10 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFocus return *this; } class NotifyWindowInfosReported : public gui::BnWindowInfosReportedListener { public: NotifyWindowInfosReported( std::shared_ptr<SurfaceComposerClient::Event> windowInfosReportedEvent) : mWindowInfosReportedEvent(windowInfosReportedEvent) {} binder::Status onWindowInfosReported() { mWindowInfosReportedEvent->set(); return binder::Status::ok(); } private: std::shared_ptr<SurfaceComposerClient::Event> mWindowInfosReportedEvent; }; SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::syncInputWindows() { mWindowInfosReportedEvent = std::make_shared<Event>(); mInputWindowCommands.windowInfosReportedListeners.insert( sp<NotifyWindowInfosReported>::make(mWindowInfosReportedEvent)); SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::addWindowInfosReportedListener( sp<gui::IWindowInfosReportedListener> windowInfosReportedListener) { mInputWindowCommands.windowInfosReportedListeners.insert(windowInfosReportedListener); return *this; } Loading Loading @@ -2849,17 +2825,4 @@ void ReleaseCallbackThread::threadMain() { } } // --------------------------------------------------------------------------------- void SurfaceComposerClient::Event::set() { std::lock_guard<std::mutex> lock(mMutex); mComplete = true; mConditionVariable.notify_all(); } bool SurfaceComposerClient::Event::wait() { std::unique_lock<std::mutex> lock(mMutex); return mConditionVariable.wait_for(lock, sTimeout, [this] { return mComplete; }); } } // namespace android libs/gui/include/gui/SurfaceComposerClient.h +3 −19 Original line number Diff line number Diff line Loading @@ -387,22 +387,6 @@ public: std::unordered_set<sp<SurfaceControl>, SCHash> surfaceControls; }; // TODO(b/222421815) this class should be removed when // SurfaceComposerClient::Transaction::syncInputWindows is removed and replaced with a method // for adding callbacks to InputWindowCommands. class Event { private: static constexpr std::chrono::seconds sTimeout{5}; bool mComplete = false; std::condition_variable mConditionVariable; std::mutex mMutex; public: void set(); bool wait(); }; class Transaction : public Parcelable { private: void releaseBufferIfOverwriting(const layer_state_t& state); Loading Loading @@ -452,8 +436,6 @@ public: InputWindowCommands mInputWindowCommands; int mStatus = NO_ERROR; std::shared_ptr<Event> mWindowInfosReportedEvent = nullptr; layer_state_t* getLayerState(const sp<SurfaceControl>& sc); DisplayState& getDisplayState(const sp<IBinder>& token); Loading Loading @@ -588,7 +570,9 @@ public: Transaction& setInputWindowInfo(const sp<SurfaceControl>& sc, const gui::WindowInfo& info); Transaction& setFocusedWindow(const gui::FocusRequest& request); Transaction& syncInputWindows(); Transaction& addWindowInfosReportedListener( sp<gui::IWindowInfosReportedListener> windowInfosReportedListener); // Set a color transform matrix on the given layer on the built-in display. Transaction& setColorTransform(const sp<SurfaceControl>& sc, const mat3& matrix, Loading Loading
libs/gui/SurfaceComposerClient.cpp +5 −42 Original line number Diff line number Diff line Loading @@ -636,8 +636,7 @@ SurfaceComposerClient::Transaction::Transaction(const Transaction& other) mDesiredPresentTime(other.mDesiredPresentTime), mIsAutoTimestamp(other.mIsAutoTimestamp), mFrameTimelineInfo(other.mFrameTimelineInfo), mApplyToken(other.mApplyToken), mWindowInfosReportedEvent(other.mWindowInfosReportedEvent) { mApplyToken(other.mApplyToken) { mDisplayStates = other.mDisplayStates; mComposerStates = other.mComposerStates; mInputWindowCommands = other.mInputWindowCommands; Loading Loading @@ -881,9 +880,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr mEarlyWakeupStart = mEarlyWakeupStart || other.mEarlyWakeupStart; mEarlyWakeupEnd = mEarlyWakeupEnd || other.mEarlyWakeupEnd; mApplyToken = other.mApplyToken; if (other.mWindowInfosReportedEvent) { mWindowInfosReportedEvent = std::move(other.mWindowInfosReportedEvent); } mergeFrameTimelineInfo(mFrameTimelineInfo, other.mFrameTimelineInfo); Loading @@ -906,7 +902,6 @@ void SurfaceComposerClient::Transaction::clear() { mIsAutoTimestamp = true; clearFrameTimelineInfo(mFrameTimelineInfo); mApplyToken = nullptr; mWindowInfosReportedEvent = nullptr; } uint64_t SurfaceComposerClient::Transaction::getId() { Loading Loading @@ -1053,10 +1048,6 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay hasListenerCallbacks, listenerCallbacks, mId); mId = generateId(); if (mWindowInfosReportedEvent && !mWindowInfosReportedEvent->wait()) { ALOGE("Timed out waiting for window infos to be reported."); } // Clear the current states and flags clear(); Loading Loading @@ -1743,25 +1734,10 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFocus return *this; } class NotifyWindowInfosReported : public gui::BnWindowInfosReportedListener { public: NotifyWindowInfosReported( std::shared_ptr<SurfaceComposerClient::Event> windowInfosReportedEvent) : mWindowInfosReportedEvent(windowInfosReportedEvent) {} binder::Status onWindowInfosReported() { mWindowInfosReportedEvent->set(); return binder::Status::ok(); } private: std::shared_ptr<SurfaceComposerClient::Event> mWindowInfosReportedEvent; }; SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::syncInputWindows() { mWindowInfosReportedEvent = std::make_shared<Event>(); mInputWindowCommands.windowInfosReportedListeners.insert( sp<NotifyWindowInfosReported>::make(mWindowInfosReportedEvent)); SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::addWindowInfosReportedListener( sp<gui::IWindowInfosReportedListener> windowInfosReportedListener) { mInputWindowCommands.windowInfosReportedListeners.insert(windowInfosReportedListener); return *this; } Loading Loading @@ -2849,17 +2825,4 @@ void ReleaseCallbackThread::threadMain() { } } // --------------------------------------------------------------------------------- void SurfaceComposerClient::Event::set() { std::lock_guard<std::mutex> lock(mMutex); mComplete = true; mConditionVariable.notify_all(); } bool SurfaceComposerClient::Event::wait() { std::unique_lock<std::mutex> lock(mMutex); return mConditionVariable.wait_for(lock, sTimeout, [this] { return mComplete; }); } } // namespace android
libs/gui/include/gui/SurfaceComposerClient.h +3 −19 Original line number Diff line number Diff line Loading @@ -387,22 +387,6 @@ public: std::unordered_set<sp<SurfaceControl>, SCHash> surfaceControls; }; // TODO(b/222421815) this class should be removed when // SurfaceComposerClient::Transaction::syncInputWindows is removed and replaced with a method // for adding callbacks to InputWindowCommands. class Event { private: static constexpr std::chrono::seconds sTimeout{5}; bool mComplete = false; std::condition_variable mConditionVariable; std::mutex mMutex; public: void set(); bool wait(); }; class Transaction : public Parcelable { private: void releaseBufferIfOverwriting(const layer_state_t& state); Loading Loading @@ -452,8 +436,6 @@ public: InputWindowCommands mInputWindowCommands; int mStatus = NO_ERROR; std::shared_ptr<Event> mWindowInfosReportedEvent = nullptr; layer_state_t* getLayerState(const sp<SurfaceControl>& sc); DisplayState& getDisplayState(const sp<IBinder>& token); Loading Loading @@ -588,7 +570,9 @@ public: Transaction& setInputWindowInfo(const sp<SurfaceControl>& sc, const gui::WindowInfo& info); Transaction& setFocusedWindow(const gui::FocusRequest& request); Transaction& syncInputWindows(); Transaction& addWindowInfosReportedListener( sp<gui::IWindowInfosReportedListener> windowInfosReportedListener); // Set a color transform matrix on the given layer on the built-in display. Transaction& setColorTransform(const sp<SurfaceControl>& sc, const mat3& matrix, Loading