diff options
author | 2022-10-28 06:31:21 +0000 | |
---|---|---|
committer | 2022-10-28 22:52:34 +0000 | |
commit | 9d77a5cf9d05b87b547f139dedf50ccfbebb140e (patch) | |
tree | 78c2af43ec414e0a2e475acd29eb49ed2a23bb21 /services/surfaceflinger/RegionSamplingThread.cpp | |
parent | bb26732f6fe79100bcf648461d9104a97967666f (diff) |
SF: Use layer id for region sampling stop layer
Cleanup before layer refbase removal. We
can lookup the stop layer by using a unique id.
Bug: 238781169
Test: presubmit
Change-Id: I33da6899adebc33c814656591f78187f08c53e80
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
-rw-r--r-- | services/surfaceflinger/RegionSamplingThread.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 8dd3b0f59d..6e64e0a13b 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -40,6 +40,7 @@ #include "DisplayDevice.h" #include "DisplayRenderArea.h" +#include "FrontEnd/LayerCreationArgs.h" #include "Layer.h" #include "Scheduler/VsyncController.h" #include "SurfaceFlinger.h" @@ -129,12 +130,12 @@ RegionSamplingThread::~RegionSamplingThread() { } } -void RegionSamplingThread::addListener(const Rect& samplingArea, const wp<Layer>& stopLayer, +void RegionSamplingThread::addListener(const Rect& samplingArea, uint32_t stopLayerId, const sp<IRegionSamplingListener>& listener) { sp<IBinder> asBinder = IInterface::asBinder(listener); asBinder->linkToDeath(sp<DeathRecipient>::fromExisting(this)); std::lock_guard lock(mSamplingMutex); - mDescriptors.emplace(wp<IBinder>(asBinder), Descriptor{samplingArea, stopLayer, listener}); + mDescriptors.emplace(wp<IBinder>(asBinder), Descriptor{samplingArea, stopLayerId, listener}); } void RegionSamplingThread::removeListener(const sp<IRegionSamplingListener>& listener) { @@ -291,8 +292,8 @@ void RegionSamplingThread::captureSample() { if (stopLayerFound) return; // Likewise if we just found a stop layer, set the flag and abort - for (const auto& [area, stopLayer, listener] : descriptors) { - if (layer == stopLayer.promote().get()) { + for (const auto& [area, stopLayerId, listener] : descriptors) { + if (stopLayerId != UNASSIGNED_LAYER_ID && layer->getSequence() == stopLayerId) { stopLayerFound = true; return; } |