Merge "Dispatch onDetachedFromWindow before destroying everything Bug #5245686"
This commit is contained in:
@@ -344,9 +344,9 @@ public abstract class HardwareRenderer {
|
||||
static final int EGL_SURFACE_TYPE = 0x3033;
|
||||
static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400;
|
||||
|
||||
private static final int SURFACE_STATE_ERROR = 0;
|
||||
private static final int SURFACE_STATE_SUCCESS = 1;
|
||||
private static final int SURFACE_STATE_UPDATED = 2;
|
||||
static final int SURFACE_STATE_ERROR = 0;
|
||||
static final int SURFACE_STATE_SUCCESS = 1;
|
||||
static final int SURFACE_STATE_UPDATED = 2;
|
||||
|
||||
static EGL10 sEgl;
|
||||
static EGLDisplay sEglDisplay;
|
||||
@@ -913,8 +913,7 @@ public abstract class HardwareRenderer {
|
||||
|
||||
@Override
|
||||
void destroyLayers(View view) {
|
||||
if (view != null && isEnabled()) {
|
||||
checkCurrent();
|
||||
if (view != null && isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) {
|
||||
destroyHardwareLayer(view);
|
||||
GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
|
||||
}
|
||||
|
||||
@@ -285,6 +285,11 @@ public class TextureView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean destroyLayer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
HardwareLayer getHardwareLayer() {
|
||||
if (mLayer == null) {
|
||||
|
||||
@@ -2141,6 +2141,10 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
|
||||
void dispatchDetachedFromWindow() {
|
||||
if (mView != null && mView.mAttachInfo != null) {
|
||||
if (mAttachInfo.mHardwareRenderer != null &&
|
||||
mAttachInfo.mHardwareRenderer.isEnabled()) {
|
||||
mAttachInfo.mHardwareRenderer.validate();
|
||||
}
|
||||
mView.dispatchDetachedFromWindow();
|
||||
}
|
||||
|
||||
@@ -3568,6 +3572,11 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
checkThread();
|
||||
if (LOCAL_LOGV) Log.v(TAG, "DIE in " + this + " of " + mSurface);
|
||||
synchronized (this) {
|
||||
if (mAdded) {
|
||||
mAdded = false;
|
||||
dispatchDetachedFromWindow();
|
||||
}
|
||||
|
||||
if (mAdded && !mFirst) {
|
||||
destroyHardwareRenderer();
|
||||
|
||||
@@ -3588,10 +3597,6 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
|
||||
mSurface.release();
|
||||
}
|
||||
if (mAdded) {
|
||||
mAdded = false;
|
||||
dispatchDetachedFromWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user