Ensure view is attached to window before removing it

I'm not able to reproduce the bug, but we can avoid calling removeView
if the view isn't attached.

Bug: 180114844
Test: Manual verification of existing behavior
Change-Id: I1173f7d3656aaa10815f07717c09d3a3869d9878
This commit is contained in:
Matt Casey
2021-03-09 13:28:30 -05:00
parent 8d90f15a45
commit dd278eba33

View File

@@ -170,7 +170,9 @@ public class AssistManager {
boolean visible = false;
if (mView != null) {
visible = mView.isShowing();
mWindowManager.removeView(mView);
if (mView.isAttachedToWindow()) {
mWindowManager.removeView(mView);
}
}
mView = (AssistOrbContainer) LayoutInflater.from(mContext).inflate(