summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/surfaceflinger/Layer.h1
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 4cdd8fa24b..0f72a46d7e 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -98,6 +98,7 @@ struct LayerCreationArgs {
uid_t callingUid;
uint32_t textureName;
std::optional<uint32_t> sequence = std::nullopt;
+ bool addToRoot = true;
};
class Layer : public virtual RefBase, compositionengine::LayerFE {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 38d9f109dc..e308c80b37 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4571,7 +4571,7 @@ status_t SurfaceFlinger::mirrorLayer(const LayerCreationArgs& args,
args.name, mirrorFrom->sequence);
}
return addClientLayer(args.client, *outHandle, mirrorLayer /* layer */, nullptr /* parent */,
- false /* addAsRoot */, nullptr /* outTransformHint */);
+ false /* addToRoot */, nullptr /* outTransformHint */);
}
status_t SurfaceFlinger::createLayer(LayerCreationArgs& args, sp<IBinder>* outHandle,
@@ -4611,7 +4611,7 @@ status_t SurfaceFlinger::createLayer(LayerCreationArgs& args, sp<IBinder>* outHa
return result;
}
- bool addToRoot = callingThreadHasUnscopedSurfaceFlingerAccess();
+ bool addToRoot = args.addToRoot && callingThreadHasUnscopedSurfaceFlingerAccess();
wp<Layer> parent(parentHandle != nullptr ? fromHandle(parentHandle) : parentLayer);
if (parentHandle != nullptr && parent == nullptr) {
ALOGE("Invalid parent handle %p.", parentHandle.get());