Loading libs/gui/WindowInfosListenerReporter.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ status_t WindowInfosListenerReporter::removeWindowInfosListener( binder::Status WindowInfosListenerReporter::onWindowInfosChanged( const std::vector<WindowInfo>& windowInfos, const std::vector<DisplayInfo>& displayInfos, const sp<IWindowInfosReportedListener>& windowInfosReportedListener) { std::unordered_set<sp<WindowInfosListener>, ISurfaceComposer::SpHash<WindowInfosListener>> windowInfosListeners; std::unordered_set<sp<WindowInfosListener>, SpHash<WindowInfosListener>> windowInfosListeners; { std::scoped_lock lock(mListenersMutex); Loading libs/gui/include/gui/ISurfaceComposer.h +2 −5 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <ftl/Flags.h> #include <gui/FrameTimelineInfo.h> #include <gui/ITransactionCompletedListener.h> #include <gui/SpHash.h> #include <math/vec4.h> #include <stdint.h> #include <sys/types.h> Loading Loading @@ -70,6 +71,7 @@ enum class FrameEvent; using gui::IDisplayEventConnection; using gui::IRegionSamplingListener; using gui::IScreenCaptureListener; using gui::SpHash; namespace ui { Loading Loading @@ -118,11 +120,6 @@ public: using EventRegistrationFlags = Flags<EventRegistration>; template <typename T> struct SpHash { size_t operator()(const sp<T>& k) const { return std::hash<T*>()(k.get()); } }; /* * Create a connection with SurfaceFlinger. */ Loading libs/gui/include/gui/LayerState.h +2 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <gui/ISurfaceComposer.h> #include <gui/LayerMetadata.h> #include <gui/SpHash.h> #include <gui/SurfaceControl.h> #include <gui/WindowInfo.h> #include <math/vec3.h> Loading Loading @@ -412,7 +413,7 @@ struct DisplayCaptureArgs : CaptureArgs { struct LayerCaptureArgs : CaptureArgs { sp<IBinder> layerHandle; std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>> excludeHandles; std::unordered_set<sp<IBinder>, SpHash<IBinder>> excludeHandles; bool childrenOnly{false}; status_t write(Parcel& output) const override; Loading libs/gui/include/gui/SpHash.h 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <stdint.h> #include <sys/types.h> #include <functional> namespace android::gui { template <typename T> struct SpHash { size_t operator()(const sp<T>& k) const { return std::hash<T*>()(k.get()); } }; }; // namespace android::gui libs/gui/include/gui/WindowInfosListenerReporter.h +3 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <android/gui/IWindowInfosReportedListener.h> #include <binder/IBinder.h> #include <gui/ISurfaceComposer.h> #include <gui/SpHash.h> #include <gui/WindowInfosListener.h> #include <unordered_set> Loading @@ -41,8 +42,7 @@ public: private: std::mutex mListenersMutex; std::unordered_set<sp<gui::WindowInfosListener>, ISurfaceComposer::SpHash<gui::WindowInfosListener>> std::unordered_set<sp<gui::WindowInfosListener>, SpHash<gui::WindowInfosListener>> mWindowInfosListeners GUARDED_BY(mListenersMutex); }; } // namespace android Loading
libs/gui/WindowInfosListenerReporter.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ status_t WindowInfosListenerReporter::removeWindowInfosListener( binder::Status WindowInfosListenerReporter::onWindowInfosChanged( const std::vector<WindowInfo>& windowInfos, const std::vector<DisplayInfo>& displayInfos, const sp<IWindowInfosReportedListener>& windowInfosReportedListener) { std::unordered_set<sp<WindowInfosListener>, ISurfaceComposer::SpHash<WindowInfosListener>> windowInfosListeners; std::unordered_set<sp<WindowInfosListener>, SpHash<WindowInfosListener>> windowInfosListeners; { std::scoped_lock lock(mListenersMutex); Loading
libs/gui/include/gui/ISurfaceComposer.h +2 −5 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <ftl/Flags.h> #include <gui/FrameTimelineInfo.h> #include <gui/ITransactionCompletedListener.h> #include <gui/SpHash.h> #include <math/vec4.h> #include <stdint.h> #include <sys/types.h> Loading Loading @@ -70,6 +71,7 @@ enum class FrameEvent; using gui::IDisplayEventConnection; using gui::IRegionSamplingListener; using gui::IScreenCaptureListener; using gui::SpHash; namespace ui { Loading Loading @@ -118,11 +120,6 @@ public: using EventRegistrationFlags = Flags<EventRegistration>; template <typename T> struct SpHash { size_t operator()(const sp<T>& k) const { return std::hash<T*>()(k.get()); } }; /* * Create a connection with SurfaceFlinger. */ Loading
libs/gui/include/gui/LayerState.h +2 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <gui/ISurfaceComposer.h> #include <gui/LayerMetadata.h> #include <gui/SpHash.h> #include <gui/SurfaceControl.h> #include <gui/WindowInfo.h> #include <math/vec3.h> Loading Loading @@ -412,7 +413,7 @@ struct DisplayCaptureArgs : CaptureArgs { struct LayerCaptureArgs : CaptureArgs { sp<IBinder> layerHandle; std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>> excludeHandles; std::unordered_set<sp<IBinder>, SpHash<IBinder>> excludeHandles; bool childrenOnly{false}; status_t write(Parcel& output) const override; Loading
libs/gui/include/gui/SpHash.h 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <stdint.h> #include <sys/types.h> #include <functional> namespace android::gui { template <typename T> struct SpHash { size_t operator()(const sp<T>& k) const { return std::hash<T*>()(k.get()); } }; }; // namespace android::gui
libs/gui/include/gui/WindowInfosListenerReporter.h +3 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <android/gui/IWindowInfosReportedListener.h> #include <binder/IBinder.h> #include <gui/ISurfaceComposer.h> #include <gui/SpHash.h> #include <gui/WindowInfosListener.h> #include <unordered_set> Loading @@ -41,8 +42,7 @@ public: private: std::mutex mListenersMutex; std::unordered_set<sp<gui::WindowInfosListener>, ISurfaceComposer::SpHash<gui::WindowInfosListener>> std::unordered_set<sp<gui::WindowInfosListener>, SpHash<gui::WindowInfosListener>> mWindowInfosListeners GUARDED_BY(mListenersMutex); }; } // namespace android