diff options
| author | 2011-11-01 14:56:27 -0700 | |
|---|---|---|
| committer | 2011-11-01 15:03:23 -0700 | |
| commit | cfe9aee72836b80b94465621374c2eff915e9a1b (patch) | |
| tree | 75241594af50f1de0990de1fce543b9cfd28fab2 | |
| parent | a0d5bece38f3b8fb430f3fb996e7baefb78d8602 (diff) | |
Fix bug 5528574 - "View not attached to window manager" upon
orientation change when there is a dialog with ActionMode on
Fix a bug closing down active action modes as dialogs are closing.
Change-Id: I0d28e3b3845d5ed50fbb55b180dafa1b11957b81
| -rw-r--r-- | core/java/android/app/Dialog.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index 7a6941924f03..72e63836447e 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -110,6 +110,8 @@ public class Dialog implements DialogInterface, Window.Callback, private Handler mListenersHandler; + private ActionMode mActionMode; + private final Runnable mDismissAction = new Runnable() { public void run() { dismissDialog(); @@ -310,6 +312,9 @@ public class Dialog implements DialogInterface, Window.Callback, try { mWindowManager.removeView(mDecor); } finally { + if (mActionMode != null) { + mActionMode.finish(); + } mDecor = null; mWindow.closeAllPanels(); onStop(); @@ -952,10 +957,26 @@ public class Dialog implements DialogInterface, Window.Callback, return null; } + /** + * {@inheritDoc} + * + * Note that if you override this method you should always call through + * to the superclass implementation by calling super.onActionModeStarted(mode). + */ public void onActionModeStarted(ActionMode mode) { + mActionMode = mode; } + /** + * {@inheritDoc} + * + * Note that if you override this method you should always call through + * to the superclass implementation by calling super.onActionModeFinished(mode). + */ public void onActionModeFinished(ActionMode mode) { + if (mode == mActionMode) { + mActionMode = null; + } } /** |