summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-21 12:02:34 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-21 12:02:34 -0700
commit9473d9d2df3f5244af0cac247d8f715ec05a290c (patch)
treefcacb63e28c950bae7cdf489302712b67c641238
parent34313a342ed6981ac4ef6380688879030f501efb (diff)
parentc1b4af372f809e713166119b47deda0d1cc5325e (diff)
Merge "Ensure libgui classes that are held by sp<> are only constructed with sp<>::make." into main
-rw-r--r--libs/gui/include/gui/BufferQueueProducer.h5
-rw-r--r--libs/gui/include/gui/Choreographer.h6
-rw-r--r--libs/gui/include/gui/DisplayEventDispatcher.h14
-rw-r--r--libs/gui/include/gui/WindowInfosListenerReporter.h3
4 files changed, 18 insertions, 10 deletions
diff --git a/libs/gui/include/gui/BufferQueueProducer.h b/libs/gui/include/gui/BufferQueueProducer.h
index 50abadb922..6a1e9f6f03 100644
--- a/libs/gui/include/gui/BufferQueueProducer.h
+++ b/libs/gui/include/gui/BufferQueueProducer.h
@@ -36,8 +36,6 @@ class BufferQueueProducer : public BnGraphicBufferProducer {
public:
friend class BufferQueue; // Needed to access binderDied
- explicit BufferQueueProducer(const sp<BufferQueueCore>& core,
- bool consumerIsSurfaceFlinger = false);
~BufferQueueProducer() override;
// requestBuffer returns the GraphicBuffer for slot N.
@@ -219,6 +217,9 @@ public:
#endif
protected:
+ explicit BufferQueueProducer(const sp<BufferQueueCore>& core,
+ bool consumerIsSurfaceFlinger = false);
+ friend class sp<BufferQueueProducer>;
// see IGraphicsBufferProducer::setMaxDequeuedBufferCount, but with the ability to retrieve the
// total maximum buffer count for the buffer queue (dequeued AND acquired)
status_t setMaxDequeuedBufferCount(int maxDequeuedBuffers, int* maxBufferCount);
diff --git a/libs/gui/include/gui/Choreographer.h b/libs/gui/include/gui/Choreographer.h
index 5862967d4a..b436af1eb3 100644
--- a/libs/gui/include/gui/Choreographer.h
+++ b/libs/gui/include/gui/Choreographer.h
@@ -79,8 +79,6 @@ public:
};
static Context gChoreographers;
- explicit Choreographer(const sp<Looper>& looper, const sp<IBinder>& layerHandle = nullptr)
- EXCLUDES(gChoreographers.lock);
void postFrameCallbackDelayed(AChoreographer_frameCallback cb,
AChoreographer_frameCallback64 cb64,
AChoreographer_vsyncCallback vsyncCallback, void* data,
@@ -113,6 +111,10 @@ public:
private:
Choreographer(const Choreographer&) = delete;
+ explicit Choreographer(const sp<Looper>& looper, const sp<IBinder>& layerHandle = nullptr)
+ EXCLUDES(gChoreographers.lock);
+ friend class sp<Choreographer>;
+ friend AChoreographer* AChoreographer_create();
void dispatchVsync(nsecs_t timestamp, PhysicalDisplayId displayId, uint32_t count,
VsyncEventData vsyncEventData) override;
diff --git a/libs/gui/include/gui/DisplayEventDispatcher.h b/libs/gui/include/gui/DisplayEventDispatcher.h
index b06ad077f4..cdf216c945 100644
--- a/libs/gui/include/gui/DisplayEventDispatcher.h
+++ b/libs/gui/include/gui/DisplayEventDispatcher.h
@@ -23,12 +23,6 @@ using FrameRateOverride = DisplayEventReceiver::Event::FrameRateOverride;
class DisplayEventDispatcher : public LooperCallback {
public:
- explicit DisplayEventDispatcher(const sp<Looper>& looper,
- gui::ISurfaceComposer::VsyncSource vsyncSource =
- gui::ISurfaceComposer::VsyncSource::eVsyncSourceApp,
- EventRegistrationFlags eventRegistration = {},
- const sp<IBinder>& layerHandle = nullptr);
-
status_t initialize();
void dispose();
status_t scheduleVsync();
@@ -38,6 +32,14 @@ public:
status_t getLatestVsyncEventData(ParcelableVsyncEventData* outVsyncEventData) const;
protected:
+ explicit DisplayEventDispatcher(const sp<Looper>& looper,
+ gui::ISurfaceComposer::VsyncSource vsyncSource =
+ gui::ISurfaceComposer::VsyncSource::eVsyncSourceApp,
+ EventRegistrationFlags eventRegistration = {},
+ const sp<IBinder>& layerHandle = nullptr);
+
+ friend class sp<DisplayEventDispatcher>;
+
virtual ~DisplayEventDispatcher() = default;
private:
diff --git a/libs/gui/include/gui/WindowInfosListenerReporter.h b/libs/gui/include/gui/WindowInfosListenerReporter.h
index 684e21ad96..f9a3acee41 100644
--- a/libs/gui/include/gui/WindowInfosListenerReporter.h
+++ b/libs/gui/include/gui/WindowInfosListenerReporter.h
@@ -40,6 +40,9 @@ public:
void reconnect(const sp<gui::ISurfaceComposer>&);
private:
+ WindowInfosListenerReporter() = default;
+ friend class sp<WindowInfosListenerReporter>;
+
std::mutex mListenersMutex;
std::unordered_set<sp<gui::WindowInfosListener>, gui::SpHash<gui::WindowInfosListener>>
mWindowInfosListeners GUARDED_BY(mListenersMutex);