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