Don't invoke transactions on layers that will be removed.

A layer can be marked as removed, but still be present in memory.
This check ensures that transactions aren't invoked on layers that
will be removed on the next commitTransaction.

Normally, this would be harmless since the layer will get removed
as soon as a commitTransaction is called. However, for cases like
re-parenting, a removed child layer can be re-parented to a non-removed
layer, which prevents the child from getting removed.

Test: Added code that would destroy a layer before the re-parent was
called. Ensure that the re-parent was ignored. There doesn't
seem to be an easy way to write a test case right now.

Change-Id: I17614447fc4253bdbbb0c06469bb09117b55c1ab
3 files changed