Lazy load Properties::isDrawingEnabled.
Properties::isDrawingEnabled can unexpectedly return true
even if the system property debug.hwui.drawing_enabled is false,
if its called before RenderThread is created.
This commit changes the underlying logic to lazy load the
debug.hwui.drawing_enabled prop value.
Bug: 193920054
Test: call HardwareRendererCompat.isDrawingEnabled()) from a new test
Change-Id: Ib69577745c26595ed3964a4341086138dd5d34b0
(cherry picked from commit 8e1ab42f51c501949211746c46a02a7564ebf292)
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 73fccb6..7f9782b 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -214,7 +214,7 @@
UniformScale // Uniform scale stretch everywhere
};
-enum class OverrideDrawingEnabled { Default, On, Off };
+enum class DrawingEnabled { NotInitialized, On, Off };
/**
* Renderthread-only singleton which manages several static rendering properties. Most of these
@@ -309,9 +309,8 @@
stretchEffectBehavior = behavior;
}
- // Represents if GL drawing is enabled. Should only be false in headless testing environments
- static bool drawingEnabled;
- static OverrideDrawingEnabled overrideDrawingEnabled;
+ // Represents if drawing is enabled. Should only be Off in headless testing environments
+ static DrawingEnabled drawingEnabled;
static bool isDrawingEnabled();
static void setDrawingEnabled(bool enable);