* commit '83aec80fb49000b2f32268590de5971c055febe9': Fix hardware layers lifecycle Bug #10075732
This commit is contained in:
@@ -3865,7 +3865,7 @@ public final class ActivityThread {
|
||||
}
|
||||
}
|
||||
|
||||
final void freeTextLayoutCachesIfNeeded(int configDiff) {
|
||||
static void freeTextLayoutCachesIfNeeded(int configDiff) {
|
||||
if (configDiff != 0) {
|
||||
// Ask text layout engine to free its caches if there is a locale change
|
||||
boolean hasLocaleConfigChange = ((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
|
||||
|
||||
@@ -486,6 +486,7 @@ public class GestureOverlayView extends FrameLayout {
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
cancelClearAnimation();
|
||||
}
|
||||
|
||||
|
||||
@@ -208,9 +208,22 @@ public abstract class DisplayList {
|
||||
* {@link #isValid()} will return false.
|
||||
*
|
||||
* @see #isValid()
|
||||
* @see #reset()
|
||||
*/
|
||||
public abstract void clear();
|
||||
|
||||
|
||||
/**
|
||||
* Reset native resources. This is called when cleaning up the state of display lists
|
||||
* during destruction of hardware resources, to ensure that we do not hold onto
|
||||
* obsolete resources after related resources are gone.
|
||||
*
|
||||
* @see #clear()
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void reset();
|
||||
|
||||
/**
|
||||
* Sets the dirty flag. When a display list is dirty, {@link #clear()} should
|
||||
* be invoked whenever possible.
|
||||
@@ -670,13 +683,4 @@ public abstract class DisplayList {
|
||||
* @see View#offsetTopAndBottom(int)
|
||||
*/
|
||||
public abstract void offsetTopAndBottom(float offset);
|
||||
|
||||
/**
|
||||
* Reset native resources. This is called when cleaning up the state of display lists
|
||||
* during destruction of hardware resources, to ensure that we do not hold onto
|
||||
* obsolete resources after related resources are gone.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void reset();
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ class GLES20DisplayList extends DisplayList {
|
||||
if (hasNativeDisplayList()) {
|
||||
nReset(mFinalizer.mNativeDisplayList);
|
||||
}
|
||||
clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,6 +59,9 @@ abstract class GLES20Layer extends HardwareLayer {
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (mDisplayList != null) {
|
||||
mDisplayList.reset();
|
||||
}
|
||||
if (mFinalizer != null) {
|
||||
mFinalizer.destroy();
|
||||
mFinalizer = null;
|
||||
|
||||
@@ -12144,7 +12144,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
removeSendViewScrolledAccessibilityEventCallback();
|
||||
|
||||
destroyDrawingCache();
|
||||
|
||||
destroyLayer(false);
|
||||
|
||||
cleanupDraw();
|
||||
@@ -12162,7 +12161,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
mAttachInfo.mViewRootImpl.cancelInvalidate(this);
|
||||
} else {
|
||||
// Should never happen
|
||||
clearDisplayList();
|
||||
resetDisplayList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12773,9 +12772,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
mHardwareLayer.destroy();
|
||||
mHardwareLayer = null;
|
||||
|
||||
if (mDisplayList != null) {
|
||||
mDisplayList.reset();
|
||||
}
|
||||
invalidate(true);
|
||||
invalidateParentCaches();
|
||||
}
|
||||
@@ -12796,7 +12792,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @hide
|
||||
*/
|
||||
protected void destroyHardwareResources() {
|
||||
clearDisplayList();
|
||||
resetDisplayList();
|
||||
destroyLayer(true);
|
||||
}
|
||||
|
||||
@@ -13044,6 +13040,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
}
|
||||
}
|
||||
|
||||
private void resetDisplayList() {
|
||||
if (mDisplayList != null) {
|
||||
mDisplayList.reset();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Calling this method is equivalent to calling <code>getDrawingCache(false)</code>.</p>
|
||||
*
|
||||
|
||||
@@ -614,15 +614,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
void destroyHardwareResources() {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
if (mAttachInfo.mHardwareRenderer.isEnabled()) {
|
||||
mAttachInfo.mHardwareRenderer.destroyLayers(mView);
|
||||
}
|
||||
mAttachInfo.mHardwareRenderer.destroy(false);
|
||||
}
|
||||
}
|
||||
|
||||
void terminateHardwareResources() {
|
||||
invalidateDisplayLists();
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.destroyHardwareResources(mView);
|
||||
mAttachInfo.mHardwareRenderer.destroy(false);
|
||||
@@ -636,6 +628,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
|
||||
}
|
||||
} else {
|
||||
invalidateDisplayLists();
|
||||
if (mAttachInfo.mHardwareRenderer != null &&
|
||||
mAttachInfo.mHardwareRenderer.isEnabled()) {
|
||||
mAttachInfo.mHardwareRenderer.destroyLayers(mView);
|
||||
@@ -2554,7 +2547,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
for (int i = 0; i < count; i++) {
|
||||
final DisplayList displayList = displayLists.get(i);
|
||||
if (displayList.isDirty()) {
|
||||
displayList.clear();
|
||||
displayList.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.app.ActivityManager;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.res.Configuration;
|
||||
import android.opengl.ManagedEGLContext;
|
||||
import android.os.Debug;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
@@ -29,7 +28,6 @@ import android.os.SystemProperties;
|
||||
import android.util.AndroidRuntimeException;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import com.android.internal.util.FastPrintWriter;
|
||||
|
||||
@@ -385,7 +383,7 @@ public final class WindowManagerGlobal {
|
||||
// known windows
|
||||
synchronized (mLock) {
|
||||
for (int i = mRoots.size() - 1; i >= 0; --i) {
|
||||
mRoots.get(i).terminateHardwareResources();
|
||||
mRoots.get(i).destroyHardwareResources();
|
||||
}
|
||||
}
|
||||
// Force a full memory flush
|
||||
|
||||
@@ -1425,6 +1425,7 @@ public class NumberPicker extends LinearLayout {
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
removeAllCallbacks();
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +226,8 @@ void Caches::terminate() {
|
||||
|
||||
patchCache.clear();
|
||||
|
||||
clearGarbage();
|
||||
|
||||
mInitialized = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user