}
}
- 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);
@Override
protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
cancelClearAnimation();
}
* {@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.
* @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();
}
if (hasNativeDisplayList()) {
nReset(mFinalizer.mNativeDisplayList);
}
+ clear();
}
@Override
@Override
public void destroy() {
+ if (mDisplayList != null) {
+ mDisplayList.reset();
+ }
if (mFinalizer != null) {
mFinalizer.destroy();
mFinalizer = null;
removeSendViewScrolledAccessibilityEventCallback();
destroyDrawingCache();
-
destroyLayer(false);
cleanupDraw();
mAttachInfo.mViewRootImpl.cancelInvalidate(this);
} else {
// Should never happen
- clearDisplayList();
+ resetDisplayList();
}
}
mHardwareLayer.destroy();
mHardwareLayer = null;
- if (mDisplayList != null) {
- mDisplayList.reset();
- }
invalidate(true);
invalidateParentCaches();
}
* @hide
*/
protected void destroyHardwareResources() {
- clearDisplayList();
+ resetDisplayList();
destroyLayer(true);
}
}
}
+ private void resetDisplayList() {
+ if (mDisplayList != null) {
+ mDisplayList.reset();
+ }
+ }
+
/**
* <p>Calling this method is equivalent to calling <code>getDrawingCache(false)</code>.</p>
*
}
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);
HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
}
} else {
+ invalidateDisplayLists();
if (mAttachInfo.mHardwareRenderer != null &&
mAttachInfo.mHardwareRenderer.isEnabled()) {
mAttachInfo.mHardwareRenderer.destroyLayers(mView);
for (int i = 0; i < count; i++) {
final DisplayList displayList = displayLists.get(i);
if (displayList.isDirty()) {
- displayList.clear();
+ displayList.reset();
}
}
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;
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;
// 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
@Override
protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
removeAllCallbacks();
}
patchCache.clear();
+ clearGarbage();
+
mInitialized = false;
}