Handle defer transactions on a detached layer

If a defer transaction is applied on a detached layer, the barrier layer
cannot dequeue its buffer since it incorrectly waits for the detached
layer to commit its dependent pending states. When a layer is detached
we remove all remove sync points. This fix ensures that an already
detached layer does not add any pending states or sync points.

Test: atest SurfaceFlinger_test:DetachChildren#DeferredTransactionOnDetachedChildren
Fixes: 150924737

Change-Id: Iefe4248b1c2f4273d07a0324697a82d0fe9c5e52
2 files changed