Reparent surface control for Webview overlay
When the root surface control changes, the parent of the Webview surface control must be changed.
Bug: 191900007
Test: switch app, or turn on/off screen
Change-Id: Ib7b34133776fd5944afc638bfee471afe6a17349
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 3279ccb..85af3e4 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -110,6 +110,7 @@
GrDirectContext* getGrContext() const { return mRenderThread.getGrContext(); }
ASurfaceControl* getSurfaceControl() const { return mSurfaceControl; }
+ int32_t getSurfaceControlGenerationId() const { return mSurfaceControlGenerationId; }
// Won't take effect until next EGLSurface creation
void setSwapBehavior(SwapBehavior swapBehavior);
@@ -253,6 +254,9 @@
// The SurfaceControl reference is passed from ViewRootImpl, can be set to
// NULL to remove the reference
ASurfaceControl* mSurfaceControl = nullptr;
+ // id to track surface control changes and WebViewFunctor uses it to determine
+ // whether reparenting is needed
+ int32_t mSurfaceControlGenerationId = 0;
// stopped indicates the CanvasContext will reject actual redraw operations,
// and defer repaint until it is un-stopped
bool mStopped = false;