Remove RenderThread from EglManager

Refactor to make EglManager re-usable.

Test: hwuiunit passes, hwuimacro works

Change-Id: Ie8e9398c703fada1dc5d8baca5f42485eadea202
diff --git a/libs/hwui/renderthread/EglManager.h b/libs/hwui/renderthread/EglManager.h
index ef9effb..ca6d1b8 100644
--- a/libs/hwui/renderthread/EglManager.h
+++ b/libs/hwui/renderthread/EglManager.h
@@ -33,8 +33,12 @@
 // and EGLConfig, which are re-used by CanvasContext
 class EglManager {
 public:
+    explicit EglManager();
+
+    ~EglManager();
+
     static const char* eglErrorString();
-    // Returns true on success, false on failure
+
     void initialize();
 
     bool hasEglContext();
@@ -46,7 +50,7 @@
 
     bool isCurrent(EGLSurface surface) { return mCurrentSurface == surface; }
     // Returns true if the current surface changed, false if it was already current
-    bool makeCurrent(EGLSurface surface, EGLint* errOut = nullptr);
+    bool makeCurrent(EGLSurface surface, EGLint* errOut = nullptr, bool force = false);
     Frame beginFrame(EGLSurface surface);
     void damageFrame(const Frame& frame, const SkRect& dirty);
     // If this returns true it is mandatory that swapBuffers is called
@@ -61,10 +65,6 @@
     void fence();
 
 private:
-    friend class RenderThread;
-    explicit EglManager(RenderThread& thread);
-    // EglContext is never destroyed, method is purposely not implemented
-    ~EglManager();
 
     void initExtensions();
     void createPBufferSurface();
@@ -72,8 +72,6 @@
     void createContext();
     EGLint queryBufferAge(EGLSurface surface);
 
-    RenderThread& mRenderThread;
-
     EGLDisplay mEglDisplay;
     EGLConfig mEglConfig;
     EGLConfig mEglConfigWideGamut;