summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-03-02 22:24:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-02 22:24:25 +0000
commit445e1c5ddda15c7118e4b52f9c7a7c77267efb34 (patch)
tree04e24f7a359a9386a43917ef329910a273f400d8
parentf55187767ed06acd52ddbc0e8de19b4d69db97bd (diff)
parentdf4639a0135ea643b493067b3f7cd1e092346c78 (diff)
downloadframeworks_base-445e1c5ddda15c7118e4b52f9c7a7c77267efb34.zip
frameworks_base-445e1c5ddda15c7118e4b52f9c7a7c77267efb34.tar.gz
frameworks_base-445e1c5ddda15c7118e4b52f9c7a7c77267efb34.tar.bz2
Merge "Improve handling of activity destroy during popup exit animation"
-rw-r--r--core/java/android/widget/PopupWindow.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index a929f3d..399f4c5 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -160,14 +160,14 @@ public class PopupWindow {
private final EpicenterCallback mEpicenterCallback = new EpicenterCallback() {
@Override
public Rect onGetEpicenter(Transition transition) {
- final View anchor = mAnchor.get();
+ final View anchor = mAnchor != null ? mAnchor.get() : null;
final View decor = mDecorView;
if (anchor == null || decor == null) {
return null;
}
final Rect anchorBounds = mAnchorBounds;
- final int[] anchorLocation = mAnchor.get().getLocationOnScreen();
+ final int[] anchorLocation = anchor.getLocationOnScreen();
final int[] popupLocation = mDecorView.getLocationOnScreen();
// Compute the position of the anchor relative to the popup.
@@ -1632,8 +1632,14 @@ public class PopupWindow {
* view hierarchy, if necessary.
*/
private void dismissImmediate(View contentView) {
+ if (mDecorView == null || mBackgroundView == null) {
+ throw new RuntimeException("Popup window already dismissed");
+ }
+
try {
- mWindowManager.removeViewImmediate(mDecorView);
+ if (mDecorView.isAttachedToWindow()) {
+ mWindowManager.removeViewImmediate(mDecorView);
+ }
} finally {
mDecorView.removeView(mBackgroundView);
mDecorView = null;