OSDN Git Service

Appease the simians
authorAdam Powell <adamp@google.com>
Tue, 15 May 2012 21:33:13 +0000 (14:33 -0700)
committerAdam Powell <adamp@google.com>
Tue, 15 May 2012 21:33:13 +0000 (14:33 -0700)
Ensure that the shown panel view is not currently attached to a parent
before adding it to the panel decor view.

Bug 6430928

Change-Id: Ic64ec4222db4754e64afdf06d7d2b77fb5ef825a

policy/src/com/android/internal/policy/impl/PhoneWindow.java

index cc7050a..9629f0a 100644 (file)
@@ -79,6 +79,7 @@ import android.view.SurfaceHolder;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewManager;
+import android.view.ViewParent;
 import android.view.ViewStub;
 import android.view.Window;
 import android.view.WindowManager;
@@ -582,7 +583,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
             st.decorView.setWindowBackground(getContext().getResources().getDrawable(
                     backgroundResId));
 
-
+            ViewParent shownPanelParent = st.shownPanelView.getParent();
+            if (shownPanelParent != null && shownPanelParent instanceof ViewGroup) {
+                ((ViewGroup) shownPanelParent).removeView(st.shownPanelView);
+            }
             st.decorView.addView(st.shownPanelView, lp);
 
             /*