Fix onTrimMemory for HardwareRenderer
Also fixes detachFunctor possibly drawing after return
Bug: 15189843
Bug: 15990672
Change-Id: I64c48cb674c461a8eeaba407b697e09f72c98ce3
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 45714ff..fcc51ec 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -90,7 +90,7 @@
}
@Override
- void destroy(boolean full) {
+ void destroy() {
mInitialized = false;
updateEnabledState(null);
nDestroyCanvasAndSurface(mNativeProxy);
@@ -125,7 +125,7 @@
@Override
void destroyHardwareResources(View view) {
destroyResources(view);
- nFlushCaches(mNativeProxy, GLES20Canvas.FLUSH_CACHES_LAYERS);
+ nDestroyHardwareResources(mNativeProxy);
}
private static void destroyResources(View view) {
@@ -289,6 +289,11 @@
}
@Override
+ void stopDrawing() {
+ nStopDrawing(mNativeProxy);
+ }
+
+ @Override
public void notifyFramePending() {
nNotifyFramePending(mNativeProxy);
}
@@ -303,12 +308,8 @@
}
}
- static void startTrimMemory(int level) {
- // TODO
- }
-
- static void endTrimMemory() {
- // TODO
+ static void trimMemory(int level) {
+ nTrimMemory(level);
}
private static class AtlasInitializer {
@@ -403,9 +404,11 @@
private static native void nCancelLayerUpdate(long nativeProxy, long layer);
private static native void nDetachSurfaceTexture(long nativeProxy, long layer);
- private static native void nFlushCaches(long nativeProxy, int flushMode);
+ private static native void nDestroyHardwareResources(long nativeProxy);
+ private static native void nTrimMemory(int level);
private static native void nFence(long nativeProxy);
+ private static native void nStopDrawing(long nativeProxy);
private static native void nNotifyFramePending(long nativeProxy);
private static native void nDumpProfileInfo(long nativeProxy, FileDescriptor fd);