Ensure consistent attach/detach callback on transient view

- Not allow to add as transient view if it still has a parent.
  (The normal usage of addTransientView should be after removeView)
- If a view container is not attached, its transient view should
  not be attached.
- If a transient view is already detached from parent, no need
  to detach again when removing the transient view.

Bug: 109814657
Test: atest FrameworksCoreTests:ViewGroupTransientViewTest
Change-Id: I243cc292e4aaba987d48eeb202559de866a8c208
2 files changed