fix [1968839] tap on phonetop search couple of times will cause the runtime restart
ViewRoot wasn't calling Surface.clear() when releasing the Surface.
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index ce25913..5776851 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -151,7 +151,8 @@
boolean mWindowAttributesChanged = false;
// These can be accessed by any thread, must be protected with a lock.
- Surface mSurface;
+ // Surface can never be reassigned or cleared (use Surface.clear()).
+ private final Surface mSurface = new Surface();
boolean mAdded;
boolean mAddedTouchMode;
@@ -231,7 +232,6 @@
mTransparentRegion = new Region();
mPreviousTransparentRegion = new Region();
mFirst = true; // true for the first time the view is added
- mSurface = new Surface();
mAdded = false;
mAttachInfo = new View.AttachInfo(sWindowSession, mWindow, this, this);
mViewConfiguration = ViewConfiguration.get(context);
@@ -1533,10 +1533,12 @@
mView = null;
mAttachInfo.mRootView = null;
+ mAttachInfo.mSurface = null;
if (mUseGL) {
destroyGL();
}
+ mSurface.clear();
try {
sWindowSession.remove(mWindow);
@@ -2495,7 +2497,7 @@
}
}
- mSurface = null;
+ mSurface.clear();
}
if (mAdded) {
mAdded = false;