Loading services/surfaceflinger/tests/utils/WindowInfosListenerUtils.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. * limitations under the License. */ */ #include <android-base/properties.h> #include <gtest/gtest.h> #include <gtest/gtest.h> #include <gui/SurfaceComposerClient.h> #include <gui/SurfaceComposerClient.h> #include <private/android_filesystem_config.h> #include <private/android_filesystem_config.h> Loading @@ -21,7 +22,8 @@ #include <future> #include <future> namespace android { namespace android { using Transaction = SurfaceComposerClient::Transaction; using base::HwTimeoutMultiplier; using gui::DisplayInfo; using gui::DisplayInfo; using gui::WindowInfo; using gui::WindowInfo; Loading @@ -36,7 +38,8 @@ public: auto listener = sp<WindowInfosListener>::make(std::move(predicate), promise); auto listener = sp<WindowInfosListener>::make(std::move(predicate), promise); mClient->addWindowInfosListener(listener); mClient->addWindowInfosListener(listener); auto future = promise.get_future(); auto future = promise.get_future(); bool satisfied = future.wait_for(std::chrono::seconds{1}) == std::future_status::ready; bool satisfied = future.wait_for(std::chrono::seconds{5 * HwTimeoutMultiplier()}) == std::future_status::ready; mClient->removeWindowInfosListener(listener); mClient->removeWindowInfosListener(listener); return satisfied; return satisfied; } } Loading Loading
services/surfaceflinger/tests/utils/WindowInfosListenerUtils.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. * limitations under the License. */ */ #include <android-base/properties.h> #include <gtest/gtest.h> #include <gtest/gtest.h> #include <gui/SurfaceComposerClient.h> #include <gui/SurfaceComposerClient.h> #include <private/android_filesystem_config.h> #include <private/android_filesystem_config.h> Loading @@ -21,7 +22,8 @@ #include <future> #include <future> namespace android { namespace android { using Transaction = SurfaceComposerClient::Transaction; using base::HwTimeoutMultiplier; using gui::DisplayInfo; using gui::DisplayInfo; using gui::WindowInfo; using gui::WindowInfo; Loading @@ -36,7 +38,8 @@ public: auto listener = sp<WindowInfosListener>::make(std::move(predicate), promise); auto listener = sp<WindowInfosListener>::make(std::move(predicate), promise); mClient->addWindowInfosListener(listener); mClient->addWindowInfosListener(listener); auto future = promise.get_future(); auto future = promise.get_future(); bool satisfied = future.wait_for(std::chrono::seconds{1}) == std::future_status::ready; bool satisfied = future.wait_for(std::chrono::seconds{5 * HwTimeoutMultiplier()}) == std::future_status::ready; mClient->removeWindowInfosListener(listener); mClient->removeWindowInfosListener(listener); return satisfied; return satisfied; } } Loading