Fix onTrimMemory for HardwareRenderer

 Also fixes detachFunctor possibly drawing after return

 Bug: 15189843
 Bug: 15990672

Change-Id: I64c48cb674c461a8eeaba407b697e09f72c98ce3
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index dbfb3d2..1bab1b1 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -66,7 +66,8 @@
 
     bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
 
-    void flushCaches(Caches::FlushMode flushMode);
+    void destroyHardwareResources();
+    static void trimMemory(RenderThread& thread, int level);
 
     static void invokeFunctor(RenderThread& thread, Functor* functor);
 
@@ -78,6 +79,7 @@
     ANDROID_API static void setTextureAtlas(RenderThread& thread,
             const sp<GraphicBuffer>& buffer, int64_t* map, size_t mapSize);
 
+    void stopDrawing();
     void notifyFramePending();
 
     DrawProfiler& profiler() { return mProfiler; }