diff options
Diffstat (limited to 'core/java/android/view/ViewRoot.java')
-rw-r--r-- | core/java/android/view/ViewRoot.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index ccaef40..afec1c3 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -176,6 +176,7 @@ public final class ViewRoot extends Handler implements ViewParent, private final Surface mSurface = new Surface(); boolean mAdded; + private boolean mAttached; boolean mAddedTouchMode; /*package*/ int mAddNesting; @@ -762,7 +763,10 @@ public final class ViewRoot extends Handler implements ViewParent, attachInfo.mKeepScreenOn = false; viewVisibilityChanged = false; mLastConfiguration.setTo(host.getResources().getConfiguration()); - host.dispatchAttachedToWindow(attachInfo, 0); + if (!mAttached) { + host.dispatchAttachedToWindow(attachInfo, 0); + mAttached = true; + } //Log.i(TAG, "Screen on initialized: " + attachInfo.mKeepScreenOn); } else { @@ -1743,8 +1747,9 @@ public final class ViewRoot extends Handler implements ViewParent, void dispatchDetachedFromWindow() { if (Config.LOGV) Log.v(TAG, "Detaching in " + this + " of " + mSurface); - if (mView != null) { + if (mView != null && mAttached) { mView.dispatchDetachedFromWindow(); + mAttached = false; } mView = null; |