Revert "services: surfaceflinger: ASAN fix" am: 598f6d5429 am: d5156b70ff am: 12924419de
am: 6d2eb659a5
Change-Id: I609bac956dff460334942bd348c0eedc53a42123
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e5b57f5..a0e040b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1836,12 +1836,9 @@
void SurfaceFlinger::commitTransaction()
{
- sp<const DisplayDevice> hw = getDefaultDisplayDevice();
-
- if (!mLayersPendingRemoval.isEmpty() && hw->isDisplayOn()) {
+ if (!mLayersPendingRemoval.isEmpty()) {
// Notify removed layers now that they can't be drawn from
for (size_t i = 0; i < mLayersPendingRemoval.size(); i++) {
- mCurrentState.layersSortedByZ.remove(mLayersPendingRemoval[i]);
recordBufferingStats(mLayersPendingRemoval[i]->getName().string(),
mLayersPendingRemoval[i]->getOccupancyHistory(true));
mLayersPendingRemoval[i]->onRemoved();
@@ -2288,10 +2285,14 @@
return NO_ERROR;
}
- mLayersPendingRemoval.push(layer);
- mLayersRemoved = true;
- setTransactionFlags(eTransactionNeeded);
- return NO_ERROR;
+ ssize_t index = mCurrentState.layersSortedByZ.remove(layer);
+ if (index >= 0) {
+ mLayersPendingRemoval.push(layer);
+ mLayersRemoved = true;
+ setTransactionFlags(eTransactionNeeded);
+ return NO_ERROR;
+ }
+ return status_t(index);
}
uint32_t SurfaceFlinger::peekTransactionFlags(uint32_t /* flags */) {